no presses - first ball moves.
one press - first ball stops, second ball starts to move.
two presses - second ball stops (both are not moving).
Then some small action happens in the game and the...
Type: Posts; User: scorpas
no presses - first ball moves.
one press - first ball stops, second ball starts to move.
two presses - second ball stops (both are not moving).
Then some small action happens in the game and the...
So, shortly...
My mini game:
When I press a 'Space bar' key - the first ball (A) stops moving, and the second ball (B) starts moving.
The problem: How to make the second ball (B) stop moving...
actually, i rewrote my JFrame class.
delete those instance of JFrame class in other classes.
when i call setText() method by just writing:...
i don't get it... sorry, my english skills are poor, specially about programming things :D
what do you mean?
i can see that textbox, when i run my project.
and as i said, if I use setText() method in the same (baaaa) class, i can see the value of the textbox.
one instance of a frame...
how it can be invisible if it is declared:
public JTextField textField;
and it is set:
textField.setVisible(true);
aa: Zaidimas.baaaa@b162d5
aa.textField:...
When i run my project and select Main class as a main, only applet starts (no GUI): Example
ok i modify that Window class, now it looks like that:
public class baaaa {
public JFrame frame;...
actually, i create this, by using windows builder in eclipse :D so most of the source code, was auto-generated by Eclipse. i just picked an element (for example JTextBox), draged it on that window,...
ok, so i modify my Window class to minimum: no buttons, no menus, only that textfield and applet starts when Play button is clicked...
this is how it looks:
public class Window extends JFrame {...
it's two times.
but my project works like that:
- firstly, the small window shows up with the button "play".
- after that buttont is clicked, the same window becames bigger (resize method) and an...
don't get it...
do you mean i call Window class twice w/ the same name (win)?
where i should call repaint()?
tried to put it, just after win.textField.setText(Integer.toString(app.score)); line:
win.textField.repaint();
Still, text field empty.
If i use...
ok, i manage to fix that error, it was my bad in text field declaration.
now in my Window class, that extends JFrame, i have:
public JTextField textField;
private void initialize() {...
it is textfield...
win:...
That's right.
so i declare in a ball class:
Window win = new Window();
Main app = new Main();
and tried to write this, right after that if:
...
method in a ball class.
public void CheckCollision(Block b){
Rectangle2D.Double ball = new Rectangle2D.Double(x-radius, y-radius, radius*2, radius*2);
Rectangle2D.Double block = new...
I do understand that.
But i can't imagine how to do that :D
So, i have Main class, in which 'score' value is updating, every time the ball hits a block (brick).
And i do have a class for a GUI...
ok, done, this one is SOLVED.
Big thanks to Norm. :)
if i understand what u asking, then:
i have array list of blocks (bricks).
when an applet is running blocks are destroying by a ball collision. So yes, list are changing while the game is playing....
i understand that, but can't figure out, how to load images only once.
i do load same image for all blocks. and sometimes when the ball hits a block, errors appears:
Exception in thread...
sleep change the speed of an applet, but lag still remains.
i guess it is something with repaint() method.
Yeah. Finally, u are genius, man!!! \m/
THANK YOU!
It works, but its very laggy :D
any ideas how to fix lag? :(
an app for a PC (my task is to create something who works on Linux). Runnable from .jar file after double clicks on it.
as I said, my images are in 'this_project/src/images' folder.
display existing ones.
the problem is, that i don't understand ur suggestion.
my applet is in Main class...
i tried to create in the Main class getCodeBase() and getDocumentBase() methods. ...