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

2014/1/23

How to choose an actor

JustMe JustMe

2014/1/23

#
Im stuck and i really need help with this... i have 2 actor placed in my world. What i want to do is when the game is running. When i click on one of the actors i want to place it somewhere else in the world to make some other actors disappear. I've tried it with clicked dragged and so on but i still have troubles with this. If you a better idea how you can help me thats oke to.....
JustMe JustMe

2014/1/23

#
Ow, I got what i want to do... But now i need a code that when i drag my Firetruck actor to the fire how i can get my Firetruck back to where it was when it destroys the fire. This is what i have now if (Fire !=null) { World world; world = getWorld(); world.removeObject(Fire); getWorld().addObject(new Fire(), Greenfoot.getRandomNumber(getWorld().getWidth()), Greenfoot.getRandomNumber(getWorld().getHeight())); } if(Greenfoot.mouseDragged(this)) { MouseInfo mouse = Greenfoot.getMouseInfo(); this.setLocation(mouse.getX(), mouse.getY()); }
You need to login to post a reply.