Skip navigation
Mastemah
Currently Being Moderated

Multiple levels/Interactive environment in a platform game

Apr 21, 2012 11:19 PM

Tags: #problem #error #as3 #3.0 #action #3 #action_script_3 #as3.0 #movieclip #ac3 #game #actionscript3 #actionscript_3.0 #platform #platformer

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 284
1067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Number.

Scene 1, Layer 'Actions', Frame 1, Line 284
1136: Incorrect number of arguments.  Expected 2.



 

 

Help would be appreciated!

 
Replies
  • Currently Being Moderated
    Apr 22, 2012 4:23 AM   in reply to Mastemah

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points