Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating an interactive animation

Community Beginner ,
May 11, 2015 May 11, 2015

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!

TOPICS
ActionScript
397
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 12, 2015 May 12, 2015

Here is a Google link that should help you find tutorials for making the diver rotate to follow the mouse.

https://www.google.com/search?q=AS3+follow+mouse+atan2

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 12, 2015 May 12, 2015

Thanks this really helps!!

Would you know where I could find a way to flip my sprite based on the location of my mouse?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 13, 2015 May 13, 2015

to flip use

object.scaleX *= -1;

object.scaleY *= -1;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 13, 2015 May 13, 2015

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 13, 2015 May 13, 2015
LATEST

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines