Wednesday, March 26, 2008

Universal Wall Code

The moment of truth... a C&Pable chunk of wall! I have formulated some code to be applied to an mc(movie clip) so that it becomes a wall. It was pretty easy now that I know what I'm doing. I also figured out how to control the movie clip from hitTest.

Here is the code for the universal wall:

onClipEvent(enterFrame){ //code applied to the mc of the wall
if(this.hitTest(_root.player.head)){
_root.player._x = this._x - 13;
}
}

And here is the code applied to the player to make the hitTest control the movie itself:

if(this.hitTest(_root.win)){
this.stop();
_root.gotoAndStop(20);
}

Turns out I have to stop the movie before I switch frames...

In other news, the naming scheme is as such: Graphical entities are name_g, Movie Clip entities are movieClip_mc, and Button entities are button_b (this was a naming scheme I adapted from the flash book back in 9th grade...)

No comments: