Forums → Programming Forum → I need help with AS3
- 2 Replies
I am working on a game where you need to avoid objects flying past you, I need code that will make it so if you hit the object it will go to a new scene/frame... if anyone can help that will be great!
I will also add your name to the credits if you like!
if(player.hitTestObject(Things Flying Past You))
gotoAndStop(Frame Number Here);
hitTestObject checks whether or not two objects are overlapping each other. If so this if statement just goes to the frame number you plug in. I assume you have multiple objects flying at you, so in that case you would need to throw a for loop around that if statement to cycle through all of the objects. Depending what class you are calling this from you may have to do this.
(parent as Document).gotoAndStop(Frame);
Assuming the Document class is the main class linked to your flash project.
I hope this helped.
i've played around with the code for a while but cannot seem to get it to work... here is what i've done:
frame 1 is the menu
the things flying at you are all contained in a symbol, so i just put the code on that symbol.
thanks for trying anyways... if you see anything i did wrong please let me know!
You must be logged in to post a reply!
We strive to deliver the best gaming experiences... on the internet and on your mobile phone. Play thousands of free online games, get access to free mmorpg games, online rpg games, fun online flash games, and more.
We offer free flash games in many different genres: online shooting games, online puzzle games, online war games, free online car games, free online hidden object games and dozens more.
This is the best place on the web to play online games for free... play on Armor Games! No matter what game style you prefer, we've got it here.
Gaming websites, passionate bloggers, and quirky streamers are welcome to share or review our games. If you need game keys, art, trailers, screenshots or more check out our press kit website.
Game developer? Visit developers.armorgames.com to request AG developer status, find documentation on our APIs, and get access to our development environment. Let's make sweet, sweet games together.
Looking for a publishing partner that can help your app rocket to success? Contact the mobile team to learn more about how we can help!