I want to make a multiplayer game with two bees that fly and want to shoot each other with some kind of bullet.
They both should be able to move in 8 directions (N, S, E, W, NE, SE, NW, SW). Bullets should fly in the direction that bee was while shooting.
One shooting the other adds 1 on it's score.
How to make them shoot on the button pressed and how to make game to be playable in two players?
Also, i have problem with this code i made, when a bee flies in directions which needs two button pressed (left-up, right-up, left-down or right-down) it sometimes flips the opposite of that side and continues flying like that.
public class bee extends Actor { public void act() { int speed = 6; if(Greenfoot.isKeyDown("up")){ setLocation(getX(), getY() - speed); setRotation(270); } if(Greenfoot.isKeyDown("down")){ setLocation(getX(), getY() + speed); setRotation(90); } if(Greenfoot.isKeyDown("left")){ setLocation(getX() - speed, getY()); setRotation(180); } if(Greenfoot.isKeyDown("right")){ setLocation(getX() + speed, getY()); setRotation(0); } if(Greenfoot.isKeyDown("up") && Greenfoot.isKeyDown("right")){ setRotation(-45); } if(Greenfoot.isKeyDown("up") && Greenfoot.isKeyDown("left")){ setRotation(45); } if(Greenfoot.isKeyDown("down") && Greenfoot.isKeyDown("left")){ setRotation(135); } if(Greenfoot.isKeyDown("down") && Greenfoot.isKeyDown("right")){ setRotation(225); } } }