java - Pause movement of a image with keyboard and enable again -


I have a class named Anemanian Pacan which is to move the keyboard to the keyboard with the keyboard. I want to implement a stopover that waits for a penance when the space bar is pressed, and that key continues again when pressed again. I tried to make a thread but I am a newbie in java. There is no error in the program, but pacman does not move forward. Here are some code:

  extends the square MiThread thread {Private Anenacin Pacman p; Public MiThread (Anenecin Pacan P) {this.p = p; } @ Override Public Wide Run () {p.move (); }} Public square scenario applies to ZPNL ActionListener {Private MiThread hilo; Animation = new Ancienpacan (); hilo = new mithahabad (anantician); Private class Tidapter KeyAdapter (Public Zero Key) extended (KeyEvent e) {animacion.keyReleased (e); } Public Zero Key Pressed (KEY EVE) {int key = e.getKeyCode (); Hilo.start (); Animacion.keyPressed (E); }}    

Depending on how you are going to implement it But do not worry it is very easy! You have a key adapter, and if a key is pressed PAC man moves you want to override a method from that epidemor (which you have to redefine that version), which is remotely PAC stops the man.

I will not write it in the code because I think it is trying to get you the benefit, but in your two options there is 1 key (say right arrow), when pressed the right move , And stop the release of the same key (right arrow). Your second option is to move the right arrow to the right arrow to move the right arrow, but press and press the spacebar. My own opinion is that it is easier to stop this key than to control a different key to prevent starting a separate key.

Both methods generally require a stop () method, as you have a trick () method. Again, depending on your implementation, how are the characters around you running, but generally the speed of the movement will be set to 0 due to the Kaleili ().

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -