Home / Software / Computer programming / my pong game
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: my pong game  (Read 1205 times)
southsideskater
Guest
« on: December 22, 2004, 08:47:01 PM »

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;
     
     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);
     }
     
}
« Last Edit: December 22, 2004, 08:47:41 PM by southsideskater » IP logged
Pages: [1] - (Top) Print 
Home / Software / Computer programming / my pong game « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.085 seconds with 18 queries.