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

2014/7/13

How do I do this?

danaman2001 danaman2001

2014/7/13

#
I need to know how to add a "Bullet" to the background at the X and Y of an actor and make the "Bullet" go up.
danaman2001 danaman2001

2014/7/13

#
I know how to make the "Bullet" go up but i just need to know how to get the bullet added at the X and Y of the actor. I'm A little new to Greenfoot so if the answer is obvious don't make fun of me :D
danpost danpost

2014/7/13

#
Have the actor at (X, Y) add the bullet into the world, using 'getX()' and 'getY()' for the coordinates to add the bullet into the world at. If all bullets created go up, you can have the constructor of the bullet set its rotation to 270 and have the act method 'move' it by its 'speed'. If the bullets do not all go straight up, then you will either have to pass the rotation to the constructor for it to set or you will have to get a local reference to the bullet and set its rotation before adding it to the world. If you have any trouble with any of this, please post what you tried and explain what it is you are having problems with.
danaman2001 danaman2001

2014/7/13

#
Thanks
You need to login to post a reply.