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

2015/11/18

Help how can i get an actor to spawn another actor

Tocho Tocho

2015/11/18

#
Help how can i get an actor to spawn another actor, originally i wanted my actor to shoot lazers or something but i couldnt so either code to do either of these things would be awesome tyvm
Super_Hippo Super_Hippo

2015/11/18

#
Laser laser = new Laser();
getWorld().addObject(laser, getX(), getY());
laser.setRotation(getRotation());
laser.move(2);
You can place this code when a certain button is pressed for example. It will add a Laser object (if you named the class like this) at the position of the actor.
You need to login to post a reply.