samjarman Posted July 3, 2014 Share Posted July 3, 2014 Hey all! Looking for a nice way to do movement of some animated sprites I have moving left to right so they look more like flying birds. Currently they just float left to right like this, bird.body.velocity.x = 100;Obviously thats too simplistic of a model of motion. It'd be cool to define a cos curve with amplitude and period to make them more like they're bobbing up and down. Thoughts? Cheers! Link to comment Share on other sites More sharing options...
LeonardoDigital Posted July 3, 2014 Share Posted July 3, 2014 One simple way could be adding a vertical tween looping to each bird and since they already have a horizontal movement they will end making kind of an arc. Link to comment Share on other sites More sharing options...
SeanEBaby Posted July 3, 2014 Share Posted July 3, 2014 Maybe you could use something from how John makes the missile wobbles in this example. Link to comment Share on other sites More sharing options...
eguneys Posted July 3, 2014 Share Posted July 3, 2014 Take a look at this code snippet for flying pigeons from the game canabalt: velocity.y = -50 - FlxU.random*50; acceleration.y = -50 - FlxU.random*300; int vel = (player.velocity.x-300)*FlxU.random; acceleration.x = (self.facing == 0) ? vel : -vel;https://github.com/ericjohnson/canabalt-ios/blob/master/src/Dove.m#L179 Link to comment Share on other sites More sharing options...
Recommended Posts