(i feel like a noob since this is my second discussion today) i am trying to make a rocket game, where you are shooting at the enemies. i cannot figure out how to make the player shoot. heres my player code so far...
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Player here. * * @author (your name) * @version (a version number or a date) */ public class Player extends MovingActors { /** * Act - do whatever the Player 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(5); } if (Greenfoot.isKeyDown("left")) { move(-5); } if (Greenfoot.isKeyDown("space")) { shoot(); } } public void shoot() { // this is where the code to call the shot actor will be. } }