Prototype of a Flash game like Poux - Part 3
November 28th update: Finished project released
3rd update of the prototype. Remember to read part 1 and 2
It's beginning to become something like a complete one-day game... let me introduce what I did.
First, I added cute graphics... on zeus box you will find some cute free icons with a completely free license, no matter what are you doing with such icons. I downloaded a Christmas pack so now the game looks like a Christmas game. I called the game "Christmas Couples".
Then I added a score system, a time bar, some animations when you click on the icons, increasing difficulty, an highscore system, a game over status and a green "X2" bonus bar acting like a 2X bonus if you remove an icon touching the bar.
Obviously, just in a few rows.
About the highscores, I used an ArmorBot account. Installing it is very easy and you can change almost everything in the highscore page. You can even add your own ad.
The page I made sucks a bit but it's still under development... or maybe not... give it a look. At the moment you can only submit scores under the "triqui" name... but I am going to add a text field in the final version.
Anyway, let's see the actionscript
-
// high scores
-
import ab3.rankz.*;
-
function __rankz_send__(par1, par2, par3, par4) { /* can't show you the content or you may cheat hiscores */ }
-
// declaration of the array that will contain the game
-
field = Array();
-
// number of icons actually removed
-
removed = 0;
-
// your score
-
score = 0;
-
// number of frames to pass before inserting a new row
-
interval = 250;
-
// position of the horizontal x2 multiplier
-
x2_horiz_pos = 0;
-
// multiplier bonus
-
mult = 1;
-
// is a game over?
-
game_over = 0;
-
// turns passed. A turn = a new row to insert
-
turns = 0;
-
// tiles placed so far
-
tiles_placed = 0;
-
// loop that initializes the field
-
for (x=0; x<10; x++) {
-
field[x] = Array();
-
for (y=0; y<10; y++) {
-
field[x][y] = 0;
-
}
-
}
-
// blue background
-
_root.attachMovie("bg", "bg", _root.getNextHighestDepth());
-
// x2 bonus
-
_root.attachMovie("x2_horiz", "x2_horiz", _root.getNextHighestDepth(), {_x:10});
-
// icons container
-
_root.createEmptyMovieClip("things", _root.getNextHighestDepth());
-
// time bar
-
_root.createEmptyMovieClip("bar", _root.getNextHighestDepth());
-
// score
-
_root.attachMovie("score", "score_obj", _root.getNextHighestDepth(), {_x:350, _y:20});
-
// function that places a line of tiles in the bottom of the field
-
function place_line() {
-
for (x=0; x<10; x++) {
-
tiles_placed++;
-
// if the spot is not empty, must shift the colum
-
if (field[x][0] != 0) {
-
push_blocks(x);
-
}
-
tile = things.attachMovie("tile", "tile_"+tiles_placed, tiles_placed, {_x:10+32*x, _y:300});
-
num = Math.floor(Math.random()*6)+1;
-
tile.gotoAndStop(num);
-
field[x][0] = tiles_placed;
-
}
-
}
-
// function to be executed at every frame
-
_root.onEnterFrame = function() {
-
if (!game_over) {
-
interval--;
-
if (interval == 0) {
-
turns++;
-
// increasing difficulty
-
interval = 250-turns;
-
place_line();
-
// moving x2 bonus bar
-
x2_horiz_pos = Math.floor(Math.random()*10);
-
x2_horiz._y = 300-x2_horiz_pos*32;
-
}
-
// showing time bar
-
bar.clear();
-
bar.lineStyle(6, 0xfff153);
-
bar.moveTo(10, 350);
-
bar.lineTo(328, 350);
-
bar.lineStyle(4, 0xea8400);
-
bar.moveTo(10, 350);
-
bar.lineTo(10+318*interval/(250-turns), 350);
-
}
-
};
-
// function that shifts the column of blocks
-
function push_blocks(col_number) {
-
for (i=9; i>=0; i--) {
-
if (field[col_number][i] != 0) {
-
if (i != 9) {
-
field[col_number][i+1] = field[col_number][i];
-
things["tile_"+field[col_number][i]]._y -= 32;
-
} else {
-
// if I have more than 10 blocks in a column, remove the 10th block
-
// In a normal game, it would be "game over"
-
// update: now IT IS game over
-
things._alpha = 50;
-
_root.attachMovie("ohno", "ohno", _root.getNextHighestDepth(), {_x:100, _y:95});
-
game_over = 1;
-
// Here I removed some lines to send high scores
-
}
-
}
-
}
-
}
-
// when the player clicks...
-
onMouseDown = function () {
-
if (!game_over) {
-
// obtain tile clicked according to mouse position
-
x_tile_clicked = Math.floor((_root._xmouse-10)/32);
-
y_tile_clicked = -Math.floor((_root._ymouse-300)/32);
-
if ((x_tile_clicked>=0) and (x_tile_clicked<=9) and (y_tile_clicked>=0) and (y_tile_clicked<=9)) {
-
if (field[x_tile_clicked][y_tile_clicked] != 0) {
-
remove_tiles(x_tile_clicked, y_tile_clicked, 1);
-
update_field();
-
// calculating score
-
for (i=1; i<=removed; i++) {
-
score += (i*mult);
-
}
-
score_obj.score.text = "Score: "+score;
-
removed = 0;
-
mult = 1;
-
}
-
}
-
}
-
};
-
// removing tiles of the same color of the one clicked
-
function remove_tiles(tx, ty, clicked) {
-
// checking tile color according to its current frame
-
tile_type = things["tile_"+field[tx][ty]]._currentframe;
-
// check if the tile to remove is the one you clicked. In this case, wait to have at least two tiles to remove
-
if (!clicked) {
-
// icon animation
-
things["tile_"+field[tx][ty]].onEnterFrame = function() {
-
this._y++;
-
this._alpha--;
-
if (this._alpha == 0) {
-
this.removeMovieClip();
-
}
-
};
-
field[tx][ty] = 0;
-
removed++;
-
if (ty == x2_horiz_pos) {
-
// bonus
-
mult = 2;
-
}
-
}
-
if ((field[tx+1][ty] != 0) and (things["tile_"+field[tx+1][ty]]._currentframe == tile_type)) {
-
remove_tiles(tx+1, ty);
-
}
-
if ((field[tx-1][ty] != 0) and (things["tile_"+field[tx-1][ty]]._currentframe == tile_type)) {
-
remove_tiles(tx-1, ty);
-
}
-
if ((field[tx][ty+1] != 0) and (things["tile_"+field[tx][ty+1]]._currentframe == tile_type)) {
-
remove_tiles(tx, ty+1);
-
}
-
if ((field[tx][ty-1] != 0) and (things["tile_"+field[tx][ty-1]]._currentframe == tile_type)) {
-
remove_tiles(tx, ty-1);
-
}
-
}
-
// update the field, making tiles fall if bottom tiles disappear
-
function update_field() {
-
for (i=0; i<10; i++) {
-
for (j=1; j<10; j++) {
-
if ((field[i][j] != 0) and (field[i][j-1] == 0)) {
-
falling = j-1;
-
while ((field[i][falling] == 0) and (falling>=0)) {
-
field[i][falling] = field[i][falling+1];
-
things["tile_"+field[i][falling+1]]._y += 32;
-
field[i][falling+1] = 0;
-
falling--;
-
}
-
}
-
}
-
}
-
}
and this is the game
At the moment, if you die you have to reload the page. That's life... play and don't forget to look at the highscores to see if your score was awesome or you're just a rookie....
Read the post about the finished project!!
Tell me what do you think about this post. I'll write better and better entries.
They can be easily customized to meet the unique requirements of your project.
18 Responses to “Prototype of a Flash game like Poux - Part 3”
Leave a Reply
Trackbacks
-
Prototype of a Flash game like Poux - Part 2 : Emanuele Feronato - italian geek and PROgrammer on
November 22nd, 2007 1:56 am
[...] 22nd update: part 3 [...]
-
Prototype of a Flash game like Poux : Emanuele Feronato - italian geek and PROgrammer on
November 22nd, 2007 1:56 am
[...] 17th update: part 2 released November 22nd update: part 3 released Ok, I know, you are asking for full tutorials and not prototypes, but you have to know [...]

lol im the 10th on the score board xD
Nice tut!
Vey good!
Thx :D
even Tho right now im working on a line rider
cooooooooool
Good job emanuele. And nice theme! ;)
Of course it could be better. But anyway, you’re teaching us in a great way :D
Did you just make it you couldn’t reset because you couldn’t be bothered to make a reset button and get rid of all the complicated annoying variables and duplicated MCs? :P
Nice tut, and I came 37th (though make it we can submit our scores) :)
brilliant
Emanuele, can you help me by having a tutorial on how to create a handbrake motion for a car?
I got 10219 points, cool passtime.
I miss some sounds or music. Good tut
I can’t wait for the next platform tutorial!
I was 3rd with 545.
681! Now I’m second
Watch out, CGR!
your tutorial is impressive for someone beginner like me!you rock!
do you have tutorials on creating multiplayer flash games?i mean just the basic things to know and how to do it as what you did on you game tutorial(step by step)…it was really a great lecture for a beginner like me..i think i could create my own game out of it.thx!
by-the-way, im talking about the one you post in here: http://www.gotoandplay.it/_articles/2007/02/game_tutorial_part3.php
hi emnauele,
whats up?
I was creating this game with multiple levels and when I published it, I saw one great bug. A player can simply roam through my levels just by right-clicking and then clicking play, he automatically advances to the next frame, or next level.
Please tell me how can I solve this problem.
shiv, have a look at this tutorial:
http://www.newgrounds.com/portal/view/201218
Take a look at the customizable right click menu.
Ur almost there tony ^^
hey can you plz make a AI tutoreal for a platform game? like you run around,attack, and other enemyes attack.
if you can make code this complicated then cant you make AI enemys thet you can fight.
oh and look at dead frontire!
thanks Ed,
now I can give a good reply to those cheaters!
hey
could you post the source file here? i tried to code this but the background, scoreboard and multiplier bar dont show up.
thanks