Be a Supporter!

Quick AS Question..

  • 317 Views
  • 7 Replies
New Topic Respond to this Topic
Pookeh
Pookeh
  • Member since: Jul. 22, 2008
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Quick AS Question.. 2008-08-24 11:21:37 Reply

Alrighty, so I'm learning the AS to MC controls such as stop, play, etc. And I'm trying to do something but I can't really seem to do it right..

I'm making a game were MC1 has to come into contact with MC2 a certain number of times before moving to the next level. I've been able to code it so that MC2 goes to the next frame in it's own timeline when it hits, but I can't quite figure out how to make it go to the next scene after MC1 hits MC2 while it's on say, frame 5. (Or maybe the next frame on the main timeline)

Also, I'm trying to learn to make a timer for the game.

Can anyone help with this?

andy70707
andy70707
  • Member since: Sep. 30, 2007
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Quick AS Question.. 2008-08-24 11:27:07 Reply

Use _root.gotoAndStop to make it go to the next frame. As for the timer, there is a good tutorial in AS: Main, but im too lazy to find it.


My websites: MayesMods | FireStorm | I'm also on almost every other website in existence, mostly under the username: andy70707 (youtube: brainiac777, eBay: 10andy70707).

BBS Signature
Pookeh
Pookeh
  • Member since: Jul. 22, 2008
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Quick AS Question.. 2008-08-24 11:35:59 Reply

At 8/24/08 11:27 AM, andy70707 wrote: Use _root.gotoAndStop to make it go to the next frame. As for the timer, there is a good tutorial in AS: Main, but im too lazy to find it.

Thanks.
I was thinking that when it actually gets hit by the other MC that is would go to the next frame on the main timeline. Do you know the code for a hitTest that could work on the timeline of a Movie Clip?

andy70707
andy70707
  • Member since: Sep. 30, 2007
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Quick AS Question.. 2008-08-24 11:44:59 Reply

its the same code, but you need to use roots. Use _root.instance to target another MC (you can do _root.mc1.mc2) And just _root.action to taget the main timeline.


My websites: MayesMods | FireStorm | I'm also on almost every other website in existence, mostly under the username: andy70707 (youtube: brainiac777, eBay: 10andy70707).

BBS Signature
Pookeh
Pookeh
  • Member since: Jul. 22, 2008
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Quick AS Question.. 2008-08-24 11:55:15 Reply

At 8/24/08 11:44 AM, andy70707 wrote: its the same code, but you need to use roots. Use _root.instance to target another MC (you can do _root.mc1.mc2) And just _root.action to taget the main timeline.

I mean how can you put a hitTest into the timeline inside the MC, where it doesn't have to be on a Clip Event.

andy70707
andy70707
  • Member since: Sep. 30, 2007
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Quick AS Question.. 2008-08-24 11:58:26 Reply

for on a timeline, use onEnterFrame=function(){ instead of onClipEvent (enterFrame){ They do exactly the same exept one is for on an MC and teh other is for on a timeline.


My websites: MayesMods | FireStorm | I'm also on almost every other website in existence, mostly under the username: andy70707 (youtube: brainiac777, eBay: 10andy70707).

BBS Signature
Pookeh
Pookeh
  • Member since: Jul. 22, 2008
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Quick AS Question.. 2008-08-24 12:00:24 Reply

At 8/24/08 11:44 AM, andy70707 wrote: its the same code, but you need to use roots. Use _root.instance to target another MC (you can do _root.mc1.mc2) And just _root.action to taget the main timeline.

I mean how can you put a hitTest into the timeline inside the MC, where it doesn't have to be on a Clip Event.

Pookeh
Pookeh
  • Member since: Jul. 22, 2008
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Quick AS Question.. 2008-08-24 12:01:34 Reply

At 8/24/08 11:58 AM, andy70707 wrote: for on a timeline, use onEnterFrame=function(){ instead of onClipEvent (enterFrame){ They do exactly the same exept one is for on an MC and teh other is for on a timeline.

Thank you!

Oops! Sorry for the double post.