HEEEEY!
okay ive been set as a task to make a "Basic Game" where you can move a ball around the screen with the arrow keys.
does anyone have any good links to places/vidoes/ source-code examles that would help me?:s:
- Thanks..
Printable View
HEEEEY!
okay ive been set as a task to make a "Basic Game" where you can move a ball around the screen with the arrow keys.
does anyone have any good links to places/vidoes/ source-code examles that would help me?:s:
- Thanks..
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.
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;
}
}
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.Quote:
how to make the guy jump?
im confused? :S
You'll have to explain.