Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Swish Tutorials Arakanoid Style Game Engine
Your Ad Here

Arakanoid Style Game Engine


Example:

Click on the example above, and use the Mouse to control the Ship.

Add the following code to Scene_1.

onLoad () {
lives='2';
scr='0';
// Set ball speeds and directions
ballspeedx = 5;
ballspeedy = 10;
}
onEnterFrame() {
// Collision Tests
if (ball.hittest(left) || ball.hittest(right)) {
ballspeedx *= -1;
}
if (ball.hittest(bottom) || ball.hittest(top) || ball.hittest(user_pal) || ball.hittest(brick) || ball.hittest(brick2)|| ball.hittest(top_pal)) {
ballspeedy *= -1;
}
// Update stats
if (ball.hittest(top)) {
ball._y = 20;
}
if (ball.hittest(bottom)) {
lives=lives-1;
ball._y = 140;
}
if (ball.hittest(brick)) {
scr=scr +++10;
ball.brick_y=15*x;
brick.gotoAndStop("dead");
}
if (ball.hittest(brick2)) {
scr=scr +++10;
ball.brick2_y=15*x;
brick2.gotoAndStop("dead");
}
//LOOSER
if (lives == "0") {
nextSceneAndPlay();
}
// Ball Movement
ball._X += ballspeedx;
ball._Y += ballspeedy;
}
onFrame (2) {
stop();
}

You will need the following items for the code to work.

Four boundary shapes named Top,Right, Bottom and left

Two sprites with rectangles inside named, brick and brick2.

A circle named ball and a rectangle named user_pal, And finally two dynamic text boxes one named score marked as target with the variable name of scr.

And the other named life marked as target and with a variable mane of lives.



Author's URL: Craig Lowe
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Swish Tutorials at FlashPerfection.com

Add comments to "Arakanoid Style Game Engine"

Only registered users can write comment

No comments yet...