Copy link to clipboard
Copied
So, I am making a game using flash and I have little experience with action script but I know I will need it for my idea.
I have started making a game about a scuba diver that goes under water to find underwater animals that she likes - it's a children's game.
My plan is to make it a side scrolling game and the scuba diver is directed with the mouse. I want the scuba diver to tilt in angles as it follows the mouse and if the mouse swaps directions, the scuba diver will do so as well.
I have already made my scuba diver on Flash as a movie clip with moving legs and arms. I need help actually coding the action script for the scuba diver to follow the mouse, change angle if the mouse is high or low and horizontally swap if the mouse moves back in the other direction.
Thanks!
If anybody has questions, please let me know. I am eager to make this game and finish it as soon as possible!
Copy link to clipboard
Copied
Here is a Google link that should help you find tutorials for making the diver rotate to follow the mouse.
Copy link to clipboard
Copied
Thanks this really helps!!
Would you know where I could find a way to flip my sprite based on the location of my mouse?
Copy link to clipboard
Copied
to flip use
object.scaleX *= -1;
object.scaleY *= -1;
Copy link to clipboard
Copied
Can I put that in an IF statement to say that if the mouse X value is less that the edge of the scuba diver, then flip the scuba diver?
How would this be written?
Copy link to clipboard
Copied
That depends on when you want to flip the object. Assuming you want it to flip at 0/90/180/270/360 degrees...
if(mouseX > diver.x){
//mouse is to the right of the diver
} else {
//mouse is to the left of the diver
}
if(mouseY > diver.y){
//mouse is bellow the diver
} else {
//mouse is above the diver
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now