Script Game Pong

Embed Size (px)

DESCRIPTION

Script Game Pong

Citation preview

Scene 1:

onSelfEvent (load) {

ballspeedx = 10;

ballspeedy = 10;

}

onSelfEvent (enterFrame) {

// Collision Tests

if(ball.hitTest(left) || ball.hitTest (rigth)) {

ballspeedx *= -1;

}

if(ball.hitTest (user_pal) || ball.hitTest (top_pal)) {

ballspeedy *= -1;

}

if(ball.hitTest (bottom) || ball.hitTest(top)) {

stop();

}

ball._x += ballspeedx;

ball._y += ballspeedy;

if (ball._y top_pal._x) {

top_pal._x+=13;

} else {

top_pal._x-=13;

}

}

}User_pal:

onSelfEvent (load) {

startDragLocked(1,600,386,386);

mouse.hide(true);

}