Talking about Eskiv game, Flash and Game development.
Do you know a Flash game called Eskiv? No?
Never mind, it’s not the best game around there, but there is a thread called Eskiv Clone? in the forum asking help in making a game like that one.
First, play it a minute
Then, take this prototype, starting from an old tutorial called Flash game creation tutorial – part 1.
_root.attachMovie("score","score",1);
_root.attachMovie("hero", "hero", 2, {_x:250, _y:200});
_root.attachMovie("target", "target", 3, {_x:Math.random()*400+25, _y:Math.random()*300+25});
power = 3;
enemy_power = 5;
points = 0;
hero.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) {
this._x -= power;
}
if (Key.isDown(Key.RIGHT)) {
this._x += power;
}
if (Key.isDown(Key.UP)) {
this._y -= power;
}
if (Key.isDown(Key.DOWN)) {
this._y += power;
}
};
target.onEnterFrame = function() {
dist_x = this._x-hero._x;
dist_y = this._y-hero._y;
distance = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
if (distance<(hero._width+this._width)/2) {
points++;
score.scoretxt.text = points;
this._x = Math.random()*400+25;
this._y = Math.random()*300+25;
foe = _root.attachMovie("enemy", "enemy", _root.getNextHighestDepth(), {_x:Math.random()*400+25, _y:Math.random()*300+25});
foe.dir = Math.floor(Math.random()*4);
foe.onEnterFrame = function() {
switch (this.dir) {
case 0 :
this._x += enemy_power;
if (this._x>500-this._width/2) {
this.dir = 1;
}
break;
case 1 :
this._x -= enemy_power;
if (this._x<0+this._width/2) {
this.dir = 0;
}
break;
case 2 :
this._y += enemy_power;
if (this._y>400-this._width/2) {
this.dir = 3;
}
break;
case 3 :
this._y -= enemy_power;
if (this._y<0+this._width/2) {
this.dir = 2;
}
break;
}
dist_x = this._x-hero._x;
dist_y = this._y-hero._y;
distance = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
if (distance<(hero._width+this._width)/2) {
points--;
score.scoretxt.text = points;
this.removeMovieClip();
}
};
}
};
And this is the result
Move the purple ball with arrow keys and take the red one. Avoid blue ones and score as much as you can.
This version has better collision detection than the original one
Download and play with it
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.