I'm making my own game for an assignment in my Digital Media class and i'm having this issue where at the end of the public boolean isAtEdge code, it gives the error "missing return statement". If somebody can show me whats wrong I would be extremely grateful. Btw i'm completely new to coding so if its obvious what the problem is please don't judge.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Bullet here. * * @author (your name) * @version (a version number or a date) */ public class Bullet extends Actor { /** * Act - do whatever the Bullet wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move( 4 ); impact(); isAtEdge(); } public void impact() { Actor Enemy1; Enemy1 = getOneObjectAtOffset( 0 , 0 , Enemy1. class ); if (Enemy1 != null ) { World world; world = getWorld(); world.removeObject(Enemy1); } Actor Enemy2; Enemy2 = getOneObjectAtOffset( 0 , 0 , Enemy2. class ); if (Enemy2 != null ) { World world; world = getWorld(); world.removeObject(Enemy2); } Actor Enemy3; Enemy3 = getOneObjectAtOffset( 0 , 0 , Enemy3. class ); if (Enemy3 != null ) { World world; world = getWorld(); world.removeObject(Enemy3); } Actor Enemy4; Enemy4 = getOneObjectAtOffset( 0 , 0 , Enemy4. class ); if (Enemy4 != null ) { World world; world = getWorld(); world.removeObject(Enemy4); } } public boolean isAtEdge() { World world; world = getWorld(); world.removeObject( this ); } // Error Occurs Here } |