Jump to content

ironicnet
 Share

Recommended Posts

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

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

  • 10 months later...

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...