Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package game;
- public class Player
- {
- private Sprite sprite;
- private boolean left,right;
- public Player(float x, float y)
- {
- sprite = new Sprite("player.png",x,y);
- }
- public void draw()
- {
- sprite.draw();
- }
- public void move()
- {
- if(left)
- {
- sprite.setX(sprite.getX() - (float)0.2*CL2.delta);
- }
- if(right)
- {
- sprite.setX(sprite.getX() + (float)0.2*CL2.delta);
- }
- }
- public void left(boolean b)
- {
- left = b;
- }
- public void right(boolean b)
- {
- right = b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement