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

2014/5/15

HELP!!

molsbex molsbex

2014/5/15

#
hi, we're a bit stuck and want to make a game in which a fairy shoots mushrooms at spiders and the spiders disappear when shot. We have already made the fairy able to turn and shoot mushrooms but how do we make the spiders move around and then disappear when shot?
danpost danpost

2014/5/15

#
How, in as much detail as possible, do you want your spiders to move (include directions allowed, locations allowed, speed, orientation of spider when moving, etc.)
GRIFFIN GRIFFIN

2014/5/15

#
This is the collision code you will want to put in the spider:
Actor theMushroom = getOneIntersectingObject(Mushroom.class);
public void collision(){
     if(theMushroom != null){                
         getWorld().removeObject(theMushroom);
         getWorld().removeObject(this);
     }
}
And you probably should specify the type of movement you are looking for.
danpost danpost

2014/5/15

#
GRIFFIN wrote...
This is the collision code you will want to put in the spider:
Actor theMushroom = getOneIntersectingObject(Mushroom.class);
public void collision(){
     if(theMushroom != null){                
         getWorld().removeObject(theMushroom);
         getWorld().removeObject(this);
     }
}
And you probably should specify the type of movement you are looking for.
Lines 1 and 2 above are reversed from what they should be.
You need to login to post a reply.