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

2014/11/13

STUDENT IN DIRE NEED PLEASE HELP

xstudentx xstudentx

2014/11/13

#
im making a game for my ICT class where basically, my character (celebrity) shoots another character (samara) with pie. i was able to make my character shoot pie in the direction it's facing by placing it under the 'mover' class as demonstrated by a video tutorial i saw. problem is, i want the pie to "eat" the other character. i realized that i cant use the 'canSee' and 'eat' method because it's not under the animal class (i made my game under the trick the turtle game and just worked around that). is there a way for me to use those methods for the pie which is under the 'mover' class? basically what i means is that is there a way for my samara character to disappear and turn into a blob picture once the pie "eats" it? i really need this done in 3 days so please please help me guys
danpost danpost

2014/11/13

#
In later versions of Greenfoot (3.2 and up, I think), new methods were added to the Actor class to do just what 'canSee' and 'eat' do. They are the 'isTouching' and 'removeTouching' methods. For more info, refer to the Actor class API documentation.
davmac davmac

2014/11/13

#
Another option is to copy the 'canSee' and 'eat' methods from the Animal class into your Pie class. Or even just look at how they work and write similar code where it's necessary.
You need to login to post a reply.