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

2014/11/4

How do i make a random moving target and shoot rockets from another actor?

Fuzzion Fuzzion

2014/11/4

#
Hi, i am very stumped on how to create a random moving target and shoot rockets out of an actor subclass. Any help for the noob?
danpost danpost

2014/11/4

#
Please show what you have tried. Also, work on one thing at a time (like -- use this discussion thread for creating a random moving target; and when you got that squared away, start another thread for shooting rockets. Always attempt to code it first; then, when you run into issues ask about how to fix it (the code, that is), showing what you have tried.
jimboweb jimboweb

2014/11/10

#
I've created some useful classes that will do some of what you're looking for. Two of them in particular. The MoveRandomly class can be found here: http://mrstewartslessons.com/useful_class_moverandomly.html and the Projectile class can be found here: http://mrstewartslessons.com/useful_class_projectile.html To use them, download the files into your Greenfoot project's folder. Close the project and open it again and you'll see the classes listed among your actors. If you open them and switch 'Source Code' to 'Documentation' you'll see directions telling you how to include them into your actors' code. There are different arguments you can include, such as choosing an image for the Projectile class. The code for the classes is very well documented so you can figure out how they work and try to tinker with them until they do what you want.
You need to login to post a reply.