Results 1 to 7 of 7
Thread: Programming a simple ball game
- 05-31-2012, 08:45 PM #1
Member
- Join Date
- May 2012
- Posts
- 6
- Rep Power
- 0
-
Re: Programming a simple ball game
You'll be better off in my experience to try to write your program, and then come on back with your code if you get stuck.
- 06-01-2012, 10:45 PM #3
Member
- Join Date
- May 2012
- Posts
- 6
- Rep Power
- 0
Re: Programming a simple ball game
Okay ive tried and im COMPLETLEY STUCK
ive gotten a man to walk left and right.
but i have no clue how to make the guy jump?
this is that part of the code:
package GamePackage;
import java.awt.Image;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
/**
*
* @author kezhall
*/
public class Player {
int x, dx, y;
Image still;
public Player(){
ImageIcon i = new ImageIcon("/Users/kezhall/Desktop/Player.png");
still = i.getImage();
x = 10;
y = 172;
}
public void move() {
x = x + dx;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public Image getImage() {
return still;
}
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
dx = -1;
if (key == KeyEvent.VK_RIGHT)
dx = 1;
}
public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
dx = 0;
if (key == KeyEvent.VK_RIGHT)
dx = 0;
}
}
- 06-01-2012, 10:53 PM #4
Re: Programming a simple ball game
Describe what a "jump" would look like. Do it in terms of the guy's x,y locations and how they'd change over time.how to make the guy jump?If you don't understand my response, don't ignore it, ask a question.
- 06-01-2012, 11:07 PM #5
Member
- Join Date
- May 2012
- Posts
- 6
- Rep Power
- 0
Re: Programming a simple ball game
im confused? :S
- 06-01-2012, 11:15 PM #6
Re: Programming a simple ball game
You'll have to explain.
If you don't understand my response, don't ignore it, ask a question.
- 06-02-2012, 06:51 AM #7
Re: Programming a simple ball game
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Breakout game ( When im out, i want the ball again to hit the remaining bricks)
By tulip in forum New To JavaReplies: 10Last Post: 06-25-2012, 11:21 PM -
simple game programming help
By b.m in forum New To JavaReplies: 0Last Post: 11-25-2010, 05:16 PM -
Need help with a third ball in game.
By vlan in forum Java AppletsReplies: 2Last Post: 05-30-2010, 03:37 PM -
Problem deleting ball from bouncing ball app
By adlb1300 in forum New To JavaReplies: 2Last Post: 12-03-2007, 09:08 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks