Sunday 22 May 2016

POINT COLLECT GAME AS2


-----------------------------------------------------------------------------------------------------------



-----------------------------------------------------------------------------------------------------------
CODES:
-----------------------------------------------------------------------------------------------------------
INSIDE FRAMES CODES:
-----------------------------------------------------------------------------------------------------------
//MAIN TIMELINE UNDER FRAME 1 CODE:
stop();
//MAIN TIMELINE UNDER FRAME 3 CODE:
Mouse.hide();
-------------------------------------------------------------------------------------------------------------
//ON FRAME 1 UNDER LOADING MC CODE:
onClipEvent (enterFrame){
if (_root.getBytesLoaded() == _root.getBytesTotal()){
_root.gotoAndStop(2);
}
}

//ON FRAME 2 UNDER STARTGAME MC CODE:
on (press){
_root.gotoAndStop(3);
}

//UNDER Ball_Mc CODE:
// FIRST ON FRAME 3 MAKE TWO BUTTONS WITH INSTANCE NAMES  
// WITH Ball_Mc, player
//MAKE TEXT BOX WITH VARIABLE BOX score
onClipEvent (load){
rot = Math.random() * 2 * 3.141593E+000;
setProperty("", _x, Math.random() * 550);
setProperty("", _y, Math.random() * 400);
while (this.hitTest(_root.player)){
setProperty("", _x, Math.random() * 550);
setProperty("", _y, Math.random() * 400);
}
if (_name == "Ball_Mc"){
gotoAndStop(1);
}
else{
gotoAndStop(random(2)+1);
}
}
onClipEvent (enterFrame){
setProperty("", _x, _x + _root.player.bSpeed * Math.cos(rot + _root.player.rot));
setProperty("", _y, _y + _root.player.bSpeed * Math.sin(rot + _root.player.rot));
if (_x >= 550 || _x <= 0){
rot = 3.141593E+000 - rot;
}
if (_y <= 0 || _y >= 400){
rot = 6.283185E+000 - rot;
}
if (_root.player.hitTest(this)){
if (_currentframe == 1)
{
chance = random(10);
if (chance == 0){
_root.special.duplicateMovieClip("spec" + _root.player.specNum, 9999999 + _root.player.specNum);
++_root.player.specNum;
}
++_root.player.score;
if (chance < 10){
this.duplicateMovieClip("Ball_Mc" + _root.player.ballNum, _root.player.ballNum);
++_root.player.ballNum;
}
rot = Math.random() * 2 * 3.141593E+000;
setProperty("", _x, Math.random() * 550);
setProperty("", _y, Math.random() * 400);
++_root.player._xscale;
++_root.player._yscale;
}
else{
_root.gotoAndStop("DeadLabel");
}
}
if (_root._currentframe == 4){
setProperty("", _alpha, _alpha - 5);
if (_alpha <= 0){
this.swapDepths(9999);
this.removeMovieClip();
}
}
}
//UNDER player CODE:
onClipEvent (load){
ballNum = 0;
specNum = 0;
rot = 0;
bSpeed = 1;
score = 0;
}
onClipEvent (enterFrame){
_root.score = score;
setProperty("", _x, _root._xmouse);
setProperty("", _y, _root._ymouse);
}







EmoticonEmoticon