This site requires JavaScript, please enable it in your browser!
Greenfoot back
Fallen_Bird
Fallen_Bird wrote ...

2022/8/25

how do i make an actor disappear when they hit

Fallen_Bird Fallen_Bird

2022/8/25

#
hi i'm new to greenfoot and i'm doing a rocket and robot activity and i just wanted to know how to make the rocket disappear when it hits the robot. i have already make the code for controlling the rocket but i don't know what type of void act to put and the code. pls help
Fallen_Bird Fallen_Bird

2022/8/25

#
in my book it saying to put a code but it's not working here is the code: void hitrocket() { if(canSee(Rocket.class)) { eat(Rocket.(class); Greenfoot.playSound("Gameover.wav"); Greenfoot.stop(); } } }
danpost danpost

2022/8/25

#
The method needs to be in and called from the act method of the class of the robot.
rdFx rdFx

2022/8/26

#
Fallen_Bird wrote...
in my book it saying to put a code but it's not working here is the code: //... if(canSee(Rocket.class)) { eat(Rocket.(class); //...
Typo here!? Should be eat(Rocket.class); I guess..
You need to login to post a reply.