StephenDunne Posted February 4, 2015 Share Posted February 4, 2015 I have a helicopter sprite and I want the wind to slightly blow my sprite either left or right. And idea on how to do this? ylluminarious 1 Link to comment Share on other sites More sharing options...
Daniel Belohlavek Posted February 5, 2015 Share Posted February 5, 2015 Well the first thing that comes to my mind is a system like the following: Let's suppose that your helicopter can only fly in one direction (to the right).Then, in the update loop you can decrease the X value of the sprite.When the player presses the RIGHT key, the X value of the sprite increases (the speed value must be higher than the 'strength of the wind'). This way if the player does nothing the sprite will move backwards. But if it presses the RIGHT key the sprite will try and move forward slowly against the wind. You should be able to adapt the system to give a boost or reduce the speed of the sprite depending on the wind direction and the movement direction. Warning: this idea has not been tested and anything could go wrong. EDIT:Tested: http://codepen.io/anon/pen/RNLzEP Link to comment Share on other sites More sharing options...
ragnarok Posted February 5, 2015 Share Posted February 5, 2015 If you're using physics, maybe use gravity.x? Link to comment Share on other sites More sharing options...
StephenDunne Posted February 6, 2015 Author Share Posted February 6, 2015 Thanks guys. Link to comment Share on other sites More sharing options...
Recommended Posts