2D wave-like sprite movement XNA

Posted by TheBroodian on Game Development See other posts from Game Development or by TheBroodian
Published on 2012-03-29T02:12:57Z Indexed on 2012/03/29 5:42 UTC
Read the original article Hit count: 274

Filed under:
|
|

I'm trying to create a particle that will 'circle' my character. When the particle is created, it's given a random position in relation to my character, and a box to provide boundaries for how far left or right this particle should circle. When I use the phrase 'circle', I'm referring to a simulated circling, i.e., when moving to the right, the particle will appear in front of my character, when passing back to the left, the particle will appear behind my character.

That may have been too much context, so let me cut to the chase:

In essence, the path I would like my particle to follow would be akin to a sine wave, with the left and right sides of the provided rectangle being the apexes of the wave. The trouble I'm having is that the position of the particle will be random, so it will never be produced at the same place within the wave twice, but I have no idea how to create this sort of behavior procedurally.

© Game Development or respective owner

Related posts about XNA

Related posts about 2d