ironicnet Posted September 17, 2013 Share Posted September 17, 2013 Hi guys, how are you doing? I'm new in phaser and in game development with JS. Anyone has implemented some kind of behaviors logic like flocking? I tried to "Port" this example in processing.js into phaser, but i didn't have any luck. http://processing.org/examples/flocking.html Can someone show me some light and give some guidelines? Thanks! Link to comment Share on other sites More sharing options...
rich Posted September 17, 2013 Share Posted September 17, 2013 Adding in your own boids system should be pretty straight forward. You'll have to find your own Vec2 implementation, but otherwise it shouldn't be too much effort. You'd just have to spawn a Sprite for each boid and update its position and rotation. I'd recommend doing it as a plugin, but you don't have to - could easily just be a State to start with. Link to comment Share on other sites More sharing options...
ironicnet Posted September 17, 2013 Author Share Posted September 17, 2013 I ported the example but i had some problems when doing the "render" part because i don't know the methods to rotate, translate and those in phaser and i can't find any doc about it. But i will try to get it working =) Link to comment Share on other sites More sharing options...
rich Posted September 17, 2013 Share Posted September 17, 2013 For rotation just use the sprite.rotation property (if the value is in radians, otherwise use sprite.angle). For translation you modify the sprite.x and sprite.y coordinates directly. ironicnet 1 Link to comment Share on other sites More sharing options...
Heppell08 Posted July 19, 2014 Share Posted July 19, 2014 For rotation just use the sprite.rotation property (if the value is in radians, otherwise use sprite.angle). For translation you modify the sprite.x and sprite.y coordinates directly.This might have just saved me a whole load of time with some coding of exactly the same type of feature! Link to comment Share on other sites More sharing options...
Recommended Posts