NEED HELP!
1) I made a basic aircraft game. The airplane can shoot and move, to the left and right, but i want it to move up and down too. Is there a simple script for that?
2) I wan't another plane to explode on impact with the shot, i already got the plane to explode with "void explode()" but not on impact.
import greenfoot.*;
// (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Plane here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Plane extends Actor
{
/**
* Act - do whatever the Plane wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(Greenfoot.isKeyDown("right")) {
move(1);
}
if(Greenfoot.isKeyDown("left")) {
move(-1);
}
if(Greenfoot.isKeyDown("space")) {
fire();
}
}
/**
* fire the cannon
*/
private void fire()
{
shot shot = new shot();
getWorld().addObject(shot, getX(), getY());
shot.setRotation(270);
shot.move(12.0);
}
}