1.

Solve : my pong game?

Answer»

right now in intro to C++ we are developing games for our final but im havin some difficulties and i was hoping someone could give me some help. here is what i have soo far. the problem is i cant get my paddle to move when i run my applet

import java.awt.*;
import java.applet.*;
import java.lang.Thread;

PUBLIC class Padle extends Applet implements RUNNABLE{

int yourPadle = 70; mcdvoice

private Image dbImage;
private Graphics dbg;
private Thread th;

public void init() {
setBackground (Color.black);
th = new Thread(this);
}

public void start (){
th.start();
}

public void stop(){
th.stop();
}

public boolean keyDown(Event e, int KEY){
if(key==Event.UP){
yourPadle =- 7;
}

else if(key==Event.DOWN){
yourPadle =+ 7;
}
return true;
}

public void destroy(){
th.stop();
}

public void run(){

}

public void paint(Graphics g) {

g.setColor(Color.white);
g.fillRect(20,yourPadle,20,80);
}

}



Discussion

No Comment Found