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

2015/2/17

Rotation help.

toastyteenagers toastyteenagers

2015/2/17

#
Hello, im refining a game i made a while back, and i would love to have an actor, when it exceeds 35 degrees then switch to an image.
if (Greenfoot.isKeyDown("left"))
        {
            setLocation(getX()-4,getY());
            turn(-1);
        }
I know how to switch images, but i just need the code, in an if... thing. you know the blue one. (try as hard as you can to not act like a total noob programmer in future posts, toasty)
danpost danpost

2015/2/17

#
You did not act like a total noob -- you did use code tags around your code (or used the 'code' link below the reply box to insert the code into the post). (good job!)
if (/* condition */)
I used the blue 'if', and the condition is 'when it exceeds 35 degrees'. There is an Actor class method to get how many degrees the actor is turned and you know what you want to compare it to (or, at least, should be able to figure it out).
You need to login to post a reply.