E
Evil Monkey
Hi there,
I am having a bit of trouble with a game I am building based on breakout.
I am trying to animate a ball travelling across a screen but i am having a
problem with the screen flickering when I animate it.
As I understand it the problem can be resolved using a double buffer.
I am using a class that extends JPanel (part of swing) which is meant to
solve the problem automatically but it dosent.How do I tell JPanel to use a
double buffer so the animation is smooth??
My other problem is that the ball is moving too quickly ..what would I need
to do to slow it down?? The ball is currently set to increment the variables
delta x and y by
only a few pixels before repainting it. Can anyone suggest how I can slow it
down? Should I be looking to use a timer?
I woudl like to put soem numbers on my background which is set to
black..where will I need to look to solve this problem ??
My last problem is that I have a rectangle drawn from a rectangle class i
have defined that I can move using a keyListener. However I
know I need to use multithreading to allow them to move at the *same* time.
Where should i look to do this??Would it be the rectangle class or the class
that extends JPanel that eeds to implement runnable?
mant thanks for any help
regards
I am having a bit of trouble with a game I am building based on breakout.
I am trying to animate a ball travelling across a screen but i am having a
problem with the screen flickering when I animate it.
As I understand it the problem can be resolved using a double buffer.
I am using a class that extends JPanel (part of swing) which is meant to
solve the problem automatically but it dosent.How do I tell JPanel to use a
double buffer so the animation is smooth??
My other problem is that the ball is moving too quickly ..what would I need
to do to slow it down?? The ball is currently set to increment the variables
delta x and y by
only a few pixels before repainting it. Can anyone suggest how I can slow it
down? Should I be looking to use a timer?
I woudl like to put soem numbers on my background which is set to
black..where will I need to look to solve this problem ??
My last problem is that I have a rectangle drawn from a rectangle class i
have defined that I can move using a keyListener. However I
know I need to use multithreading to allow them to move at the *same* time.
Where should i look to do this??Would it be the rectangle class or the class
that extends JPanel that eeds to implement runnable?
mant thanks for any help
regards