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

2014/6/3

Changing images after an object no longer exists

SeanWinder1997 SeanWinder1997

2014/6/3

#
I'm having a problem in Greenfoot, where I am making a PacMan-style game, and when a power pellet (Pineapple) is eaten, it allows you to eat the Ghosts (Burgers). Then, the ghosts are set on a timer for when they can be eaten, and when this timer is up, they should change back to their oiginal image, however (as shown below), this gives me an eror code. I believe this may be because it is trying to find a burger that no longer exists once it has been eaten, and thus gives me an error, but I am basically wanting to say "If the burger still exists, change the image, if not, then do nothing." Can anyone help me with this please, as it's really bugging me. Thanks in Advance, Sean
SeanWinder1997 SeanWinder1997

2014/6/3

#
Btw, on the left is the code that changes the colour originally (which works) and the code on the right is the non-working code to change them back. https://docs.google.com/file/d/0B-3nge5y5auXQzlJQTJONlItMW8/edit?usp=drive_web an a re-upload of the image above: https://docs.google.com/file/d/0B-3nge5y5auXS190UjR5bGJlTXc/edit?usp=drive_web cheers again :D
You need to login to post a reply.