i am doing a school project where i make a working copy of space invaders and at the moment i am ahead of most people but this one piece of code is still bugging me.
What i did was change the print order so that when the lifeboard detected it was at 0 it will not has a bunch of other things on the gameover screen the problem is now i have implimented code so that when a invader touches the player it show a gameover so my lifeboard shows over it because it is at the front of the print order.
i am very new to this but i think i need to either change the print order mid game or remove the lifeboard at the gameover screen and the latter is what i have being attempting.
please help :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Actor invader; invader = getOneIntersectingObject(Invader. class ); if (invader != null ) { Space space = (Space) getWorld(); this .setImage(explode); Greenfoot.delay( 100 ); this .setImage(player); setLocation( 400 , 300 ); getWorld().removeObject(Lifeboard. class ); //this is the problematic line specifically the '.class' part setImage( "gameover.jpg" ); Greenfoot.stop(); return ; } |