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 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!
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.
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..
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..
Copy link to clipboard
Copied
So are you able to explain it to me?
Copy link to clipboard
Copied
Can someone please show me how to write the code or correct my above code?