Sunday, May 4, 2014

Simple Minigame - Electric Rod

Simple Minigame
1) Draw a maze using Brush Tool, then convert it into MovieClip
2) Create a new layer for buttons with 3 key frames
3) Create a start button at the first key frame
4) Create a end button at the second key frame
5) Pull in the custom cursor MovieClip into the second key frame
6) Create the third key frame for victory
7) Put a "stop();" at the first key frame
8) Copy the code into corresponding buttons and MovieClips

Source Code:
//Custom cursor
onClipEvent (load) {
this._x = _root._xmouse;
this._y = _root._ymouse;
Mouse.hide();
startDrag(this);
}
onClipEvent (unload) {
Mouse.show();
}

//Maze
onClipEvent (mouseMove) {
if (_root.bln && this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.prevFrame();
}
}
onClipEvent (enterFrame) {
if (_root.bln && this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.prevFrame();
}
}

//Start button
on (release) {
_root.bln = true;
_root.nextFrame();
}

//End button
on (rollOver) {
nextFrame();
}

No comments:

Post a Comment