Mouse avoider/Biggification remix prototype
Talking about Biggification game, Actionscript 2, Flash and Game development.
Learn cross platform HTML5 game development
Check my Gumroad page for commented source code, games and books.
Just a quick uncommented prototype involving growing (and moving) spheres and a sphere you control with the mouse.
Click the mouse to change color, if you touch a sphere of the same colour as yours, you’ll make it disappear.
Mouse.hide();
speed = 30;
passed = 0;
placed = 0;
growth = 0.1;
velocity = 5;
player = _root.attachMovie("ball", "ball", _root.getNextHighestDepth());
player.gotoAndStop(1);
player.onEnterFrame = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
};
_root.onMouseDown = function() {
if (player._currentframe == player._totalframes) {
player.gotoAndStop(1);
} else {
player.gotoAndStop(player._currentframe+1);
}
};
_root.onEnterFrame = function() {
passed++;
if (passed>speed) {
passed = 0;
collect = _root.attachMovie("ball", "ball_"+placed, _root.getNextHighestDepth(), {_x:Math.random()*500, _y:Math.random()*500});
collect.gotoAndStop(Math.floor(Math.random()*collect._totalframes)+1);
collect.angle = Math.random()*6.28318531;
collect.xspeed = velocity*Math.cos(collect.angle);
collect.yspeed = velocity*Math.sin(collect.angle);
collect.onEnterFrame = function() {
this._width += growth;
this._height += growth;
this._x += this.xspeed;
this._y += this.yspeed;
x_dist = this._x-player._x;
y_dist = this._y-player._y;
if (this._x<0) {
this._x = 0;
this.xspeed *= -1;
}
if (this._x>500) {
this._x = 500;
this.xspeed *= -1
}
if (this._y<0) {
this._y=0
this.yspeed *=-1
}
if (this._y>500) {
this._y=500
this.yspeed *=-1
}
distance = x_dist*x_dist+y_dist*y_dist;
touch_distance = ((player._width+this._width)/2)*((player._width+this._width)/2);
if (distance
Tell me if you have some good ideas to turn it into a game and I'll improve it as you want
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.