How to make a power-up float?
I'm wondering how do you make an object float like how power-ups usually do, with them slowly moving up and down. I'm guessing this requires use of interpolate but I'm not sure if thats the best way. Any help is appreciated.
Cheers, FM.
Cheers, FM.
Answers
first 100 is the range of movement ie 100 up/down. Second 100 is the speed and +400 is the starting position
Interpolate is good.
Rule: when self.pos.y > (top bobbing spot), interpolate self.pos.y to (bottom bobbing spot)
Rule: shen self.pos.y < (bottom bobbing spot), interpolate self.pos.y to (top bobbing spot)
You can adjust duration to however long you want it. Make sure the starting pos of the powerup is above the top bobbing spot or below the bottom bobbing spot so that one of the interpolate rules will be triggered. Also, if you want it to really bob nicely, you can set the interpolate to ease in or ease out.
Hope this helps,
Jack McGraw
Tshirtbooth's suggestion is exactly what I had it setup, so it's nice to know thats a good way to do it XD. Thanks for the help guys,FM.