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

2017/11/26

Is there a way to switch an image of the actor if it gets to a certain coordinate?

mouseofgory mouseofgory

2017/11/26

#
I have a cat that if it reaches the edge on the left (all on its own without the keydown method) I want it to switch images so it looks like its going right, I want to also do it so when it reaches the edge of the screen on the bottom it switches the image to "up" and when it reaches the top it switches the image so the cat is facing down. I also wanted to add the random number method to it so it turns randomly, but it seems like I can't really switch the images when it hits a certain edge with the random number, I don't even know if this is possible, maybe with an if statement such as if y coordinate is this # switch image?
Super_Hippo Super_Hippo

2017/11/26

#
@last sentence: Yes, that's what you can try.
mouseofgory mouseofgory

2017/11/27

#
I did try that but I don't know how to assemble the sentence, because y is an integer is it not? And the if statement is a boolean.
danpost danpost

2017/11/28

#
mouseofgory wrote...
I did try that but I don't know how to assemble the sentence, because y is an integer is it not? And the if statement is a boolean.
See here.
You need to login to post a reply.