home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 35
/
jogo-disk-35.iso
/
Games
/
puppy_fetch.swf
/
scripts
/
frame_19
/
DoAction.as
Wrap
Text File
|
2007-03-01
|
5KB
|
218 lines
stop();
score1 = 0;
score2 = 0;
score3 = 0;
score4 = 0;
score5 = 0;
score6 = 0;
score7 = 0;
score8 = 0;
score9 = 0;
score10 = 0;
hint._visible = false;
x1 = 240;
x2 = 260;
x3 = 250;
y1 = 130;
y2 = 160;
y3 = 150;
sekundy = 0;
setne = 0;
napis = "Score: " + score;
timer = "time: 00:00";
czasujemy = function()
{
if(sekundy <= 9)
{
seconds = "0" + sekundy;
}
else
{
seconds = sekundy;
}
if(setne <= 9)
{
mili = "0" + setne;
}
else
{
mili = setne;
}
timer = "time: " + seconds + ":" + mili;
if(setne <= 92)
{
setne += 4;
}
else
{
setne = 0;
sekundy++;
}
};
reset = function()
{
score = 5000;
timer = "time: 00:00";
sekundy = 0;
setne = 0;
mapX = map._x;
mapY = map._y;
wziety = false;
gramy = false;
dog._visible = false;
gravity = 0;
horizontal = 0;
landed = false;
friction = 0.9;
dog.patyk._visible = false;
};
reset();
this.onEnterFrame = function()
{
if(gravity <= -15)
{
gravity = -15;
}
if(score <= 0)
{
score = 0;
}
napis = "Score: " + score;
if(gramy == true)
{
zegarek.play();
}
else
{
zegarek.gotoAndStop(1);
}
if(gramy == true)
{
score--;
czasujemy();
map._y += gravity;
map._x -= horizontal;
tlo._x -= horizontal / 3;
horizontal *= friction;
if(Key.isDown(39) && horizontal < 10)
{
horizontal += 2;
dog._xscale = 100;
}
else if(Key.isDown(37) && horizontal > -10)
{
horizontal -= 2;
dog._xscale = -100;
}
gravity--;
if(gravity < 0 && landed == false)
{
dog.gotoAndStop(3);
}
if(Key.isDown(32) && landed == true && gravity >= -4)
{
landed = false;
gravity = 10;
map._y += 10;
dog.gotoAndStop(2);
}
if(gravity <= -7)
{
dog.gotoAndStop(3);
}
if(map.hitTest(x1,y2,true) && map.hitTest(x2,y2,true) && map.hitTest(x3,y2,true))
{
gravity = 0;
landed = true;
dog.gotoAndStop(1);
map._y += 5;
}
if(map.hitTest(x2,y1,true) && map.hitTest(x2,y2,true) && map.hitTest(x2,y3,true))
{
landed = false;
horizontal = -5;
map._x += 10;
}
if(map.hitTest(x1,y1,true) && map.hitTest(x1,y2,true) && map.hitTest(x1,y3,true))
{
landed = false;
horizontal = 5;
map._x += -10;
}
if(map.hitTest(x1,y1,true) && map.hitTest(x1,y2,true) && map.hitTest(x2,y1,true) && map.hitTest(x2,y2,true) && dog._xscale == 100)
{
landed = true;
map._x += 10;
}
if(map.hitTest(x1,y1,true) && map.hitTest(x1,y2,true) && map.hitTest(x2,y1,true) && map.hitTest(x2,y2,true) && dog._xscale == -100)
{
landed = true;
map._x -= 10;
}
if(map.patyk.tester.hitTest(dog))
{
wziety = true;
map.patyk.gotoAndStop(2);
hint.nextFrame();
}
if(map.kamienie.hitTest(dog) && hint._currentframe == 3)
{
hint.nextFrame();
}
if(dog.hitTest(map.rzucenie) && wziety == true)
{
gramy = false;
map.rzucenie.play();
dog._visible = false;
}
z = 0;
while(z < 10)
{
eval("map.kot" + z).onEnterFrame = function()
{
if(this._x + _root.map._x >= 250)
{
this._xscale = 100;
}
else
{
this._xscale = -100;
}
if(this.tester.hitTest(_root.dog) && this._currentframe == 1)
{
_root.horizontal = (- _root.horizontal) * 2;
_root.gravity = Math.abs(_root.gravity) * 0.6;
this.play();
}
};
z++;
}
e = 0;
while(e < 10)
{
eval("map.gem" + e).onEnterFrame = function()
{
if(this.tester.hitTest(_root.dog))
{
_root.score += 500;
this.play();
}
};
e++;
}
e = 0;
while(e < 20)
{
eval("map.winda" + e).onEnterFrame = function()
{
if(this.hitTest(_root.dog))
{
_root.map._y += 2;
this.play();
}
};
e++;
}
}
};