Hello,
I have an actor called "DonkeyKong" and he shoots bullets from a class named "Weapons"
DonkeKong has 3 Images, left, right and up
How do i make it that if he looks left the bullets go left?
DonkeyKong Class (Shooting Bullet Part)
Weapons Class
if (!spaceDown && Greenfoot.isKeyDown("space")) { spaceDown = true; Weapons bullet = new Weapons(); getWorld().addObject(bullet, getX() + 60, getY() - 15); } if (spaceDown && !Greenfoot.isKeyDown("space")) { spaceDown = false; }
public void act() { this.setLocation(this.getX() + 5, this.getY()); this.touchingEnemy(); } public void touchingEnemy() { Actor ast = getOneIntersectingObject(Enemies.class); if(ast != null) { if(this.isTouching(Enemies.class)) { getWorld().removeObject(ast); getWorld().removeObject(this); } } else if(this.atWorldEdge()) { this.getWorld().removeObject(this); } }