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

Multiple levels/Interactive environment in a platform game

New Here ,
Apr 21, 2012 Apr 21, 2012

Copy link to clipboard

Copied

Hey all.... So i have a project due in for class soon and I know the code to this is very simple but i can't seem to figure it out -.-

What i want is when 'player_mc' touches 'hitbox_mc' the movieclip  'bat_mc' will play and when it reaches its last frame it will be erased off the stage. (bat_mc will be stuck on first frame until 'hitbox_mc' is touched... )

So pretty much when the character walks through an invisible box it activates a bat on the tree to fly away...

Also

I want something simular to the idea above, however when the character touches 'hitbox_mc' it will switch to 'room2' which is the next frame, here is the code so far

if(player_mc.hitTestPoint(hitbox_mc)){

          gotoAndStop("room2");

 

}

However the code above is giving me these errors:

Scene 1, Layer 'Actions', Frame 1, Line 2841067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Number.
Scene 1, Layer 'Actions', Frame 1, Line 2841136: Incorrect number of arguments.  Expected 2.

Help would be appreciated!

TOPICS
ActionScript

Views

739

Translate

Translate

Report

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 ,
Apr 22, 2012 Apr 22, 2012

Copy link to clipboard

Copied

You need to look up the hitTestPoint method to see why specifying a movieclip for the argument is leading to the two errors you see.

Votes

Translate

Translate

Report

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
New Here ,
Apr 22, 2012 Apr 22, 2012

Copy link to clipboard

Copied

Would you be able to explain it to me?  Here is a picture of what i'm trying to do..player_mc.png

When 'player_mc' touches' hitbox_mc', the movieclip 'bat_mc' plays once and erases itself.

And for the level change its the same concept... Player touches box and gets sent to second frame on timeline which is t he next level...

Been trying to figure this out all weekend and just turned to pros for help now..

Votes

Translate

Translate

Report

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
New Here ,
Apr 22, 2012 Apr 22, 2012

Copy link to clipboard

Copied

So are you able to explain it to me?

Votes

Translate

Translate

Report

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
New Here ,
Apr 22, 2012 Apr 22, 2012

Copy link to clipboard

Copied

LATEST

Can someone please show me how to write the code or correct my above code?

Votes

Translate

Translate

Report

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