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

2014/3/17

Detecting the way an actor is facing

patrick26 patrick26

2014/3/17

#
Hi, Is it possible to determine which way the actor is facing so that when shooting, the bullet will travel in the direction it is facing?
danpost danpost

2014/3/17

#
If this is in reference to your Bowser and Fireball classes, as you have it now, only the direction Bowser is facing can be determined; and only by which image it currently is using. It would be a lot easier if your 'left-facing' images were just upside-down 'right facing' images (in both classes). Then rotating 180 and switching images would give the proper image and movement both. Without using upside-down right-facing images, I do not see much help for the Fireball class with your SPEED field being static. If more than one fireball can be in the world at one time, then the 'static' modifier should probably be removed from the field because of the multiple states that a fireball can be in (moving left or right). Then you will need something to set the value of the field, making it positive or negative, depending on the direction it is to move (it would then set the appropriate image, as well).
You need to login to post a reply.