mhh...
the gravity...
Well first I created a double parameter, that saves the y position (called yPosition and one, that saves the y-Speed (called ySpeed).
then i rewrited the setLocation method to:
setLocation(int x, double y){ super.setLocation(x,(int)y); yPosition=y;}
and I added a method
double getYPosition(){return yPosition;}
and in my act-method is written:
setLocation(getX(),getYPosition()+ySpeed);
Then all I have to do for the gravity is raising ySpeed for 0.1
And if the up-key is pressed, I subtract 0.2
If you although want an x-move you have to do the same with x.
Nice made! I just got bored when I had ~1500 points, so I let the enemy shoot me down.
Maybe you want to add this: When two bullets (or missiles?) hit each other, they vanish. With this, you can block enemy bullets and he can block yours. I'd like it, just think about it. ;)
2012/4/11
2012/4/11
2012/4/12
2012/4/12
2012/4/12
2012/4/14
2012/4/15
2013/5/25
2013/5/27
2013/5/30