Talking about Draw Game game, Actionscript 2, Flash and Game development.
Sometimes I play and mess with code to get some interesting game prototypes.
Although I am not satisfied about this one, I want to share it with you anyway.
You have to draw a lasso with the mouse trying to catch the ball inside the shape you will create. In this case you’ll win.
If the ball touches the line before you close the shape, you die.
Uncommented code because it’s just an early stage, but if you are interested I will try to turn it into something playable.
drawing = false;
angle = Math.random()*360;
speed = 5;
precision = 16;
xspeed = speed*Math.cos(angle*0.0174532925);
yspeed = speed*Math.sin(angle*0.0174532925);
_root.createEmptyMovieClip("drawclip", 1);
_root.attachMovie("ball", "ball", 2, {_x:250, _y:200});
_root.onMouseDown = function() {
x_points = new Array();
y_points = new Array();
drawing = true;
drawclip.clear();
still_inside = true;
drawclip.lineStyle(5, 0x000000);
x_points.push(_root._xmouse);
y_points.push(_root._ymouse);
drawclip.moveTo(x_points[0], y_points[0]);
};
_root.onMouseUp = function() {
drawing = false;
};
_root.onMouseMove = function() {
if (drawing) {
end_x = _root._xmouse;
end_y = _root._ymouse;
dist_x = x_points[0]-end_x;
dist_y = y_points[0]-end_y;
dist = dist_x*dist_x+dist_y*dist_y;
if (dist>400) {
still_inside = false;
drawclip.lineTo(end_x, end_y);
x_points.push(end_x);
y_points.push(end_y);
} else {
if (still_inside) {
drawclip.lineTo(end_x, end_y);
x_points.push(end_x);
y_points.push(end_y);
} else {
x_points.push(x_points[0]);
y_points.push(y_points[0]);
drawclip.lineTo(x_points[0], y_points[0]);
drawing = false;
drawclip.clear();
drawclip.lineStyle(5, 0x00ff00);
drawclip.beginFill(0x00ff00, 30);
drawclip.moveTo(x_points[0], y_points[0]);
for (x=1; x490)) {
xspeed *= -1;
}
if ((this._y<10) or (this._y>390)) {
yspeed *= -1;
}
};
_root.onEnterFrame = function() {
if (drawing) {
for (x=1; x
and enjoy the result...
When you "die", you just lose your drawing. When the ball dies, it simply respawns at the centre of the stage.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.