Everything works as it should except for the movement of the enemy ships.
They move back and forth going down a little bit when they reach the edges of the window.
There is one variable that controls their position on the x axis, and for every frame I compute its value like this:
xpos+=direction*elapsedMillis*xspeed;
there direction is either -1 or +1, elapsedMillis is of course the time since the last frame, and xspeed is a float equal to 0.1.
There are 2 problems:
1 - The ships seem to move a little bit faster when direction==1 (i.e. they're moving leftwards)
2 - When a sound is played, elapsedMillis goes from 16 to 10 (exactly, it goes down!) and the ships move faster while the sound is playing
I have no clue at all why this is happening.
Can someone help me?
Simone


Sign In
Create Account


Back to top









