You could update the speed every timer tick, but why not update the position every tick?
make something like an update function. something along the lines of:
public void update(){
x+=xspeed;...
Type: Posts; User: elamre
You could update the speed every timer tick, but why not update the position every tick?
make something like an update function. something along the lines of:
public void update(){
x+=xspeed;...
That's true indeed. Now look at the line i pointed out. It will execute that every 10 ms i believe. so every once in a very short while it will execute ball.getXPoint() and ball.getYPoint(). And...
Try to get just 1 ball able to bounce and move properly. If you follow Norm's tips on his post, and then read what i said, you should be able to make a conclusion on what is going wrong :) .
Owh, well mine thought me to use this. by this. you refer to a private data field. Also i'm not quite inderstanding your code. Do you want a simple ball bouncing on the screen? If so, look at this...
Also another tip, instead of writing a "_" in front of every variable the class has, you could also use "this." makes everything a bit easier in my opinion. Example:
private int speed = 0;...
To slow it you could always make the x and y positions a double or float i suppose and do the same for the x and y point. then multiply them by 0.1 or something. It should go slower now.
I dont...