A new Flash game prototype

I played some times ago a game similar to the one I am making the prototype… I think it was a PopCap game, or a game by another casual game developer… anyway it’s a game involving a balance and some spheres.

Just a quick, raw actionscript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
field = new Array();
for (x=0; x<10; x++) {
	field[x] = new Array();
	for (y=0; y<6; y++) {
		field[x][y] = 0;
	}
}
attach_sphere = true;
_root.attachMovie("bar", "bar", _root.getNextHighestDepth(), {_x:250, _y:400});
_root.attachMovie("triangle", "triangle", _root.getNextHighestDepth(), {_x:250, _y:400});
_root.onEnterFrame = function() {
	if (attach_sphere) {
		attach_sphere = false;
		sphere = bar.attachMovie("ball", "ball"+bar.getNextHighestDepth(), bar.getNextHighestDepth(), {_x:20,_y:-300});
		sphere.moving = true;
		sphere.onEnterFrame = function() {
			if (this.moving) {
				pos_x = Math.floor(bar._xmouse/40)+5;
				if (pos_x<0) {
					pos_x = 0;
				}
				if (pos_x>9) {
					pos_x = 9;
				}
				this._x = pos_x*40-180;
			}
			if (this.falling) {
				this._y += 20;
				pos_y = Math.floor((this._y+20)/40);
				if ((pos_y == 0)or(field[pos_x][pos_y*(-1)-1]==1)) {
					this.falling = false;
					field[pos_x][pos_y*(-1)] = 1;
					attach_sphere = true;
				}
			}
		};
	}
};
bar.onEnterFrame = function() {
	dir = 0;
	for (x=0; x<10; x++) {
		for (y=0; y<6; y++) {
			if (field[x][y]>0) {
				if (x<5) {
					dir -= (5-x);
				} else {
					dir += (x-4);
				}
			}
		}
	}
	dir *= 0.01;
	this._rotation += dir;
};
_root.onMouseDown = function() {
	if (sphere.moving) {
		sphere.moving = false;
		sphere.falling = true;
	}
};

and the result

Can you make a good game out of this? Download the source code

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 6 comments

  1. Ed

    on February 4, 2008 at 9:07 pm

    Interesting, I’m glad most of your tuts now involve mathematics, which I lack in my code. :)

  2. David

    on February 7, 2008 at 9:05 pm

    i like to program small programs, or use actionscript, bu i’ve never seen so many for atatements in a single piece of code!

    could you please explain the code for us

    good tutorials anyway

    keep it up

  3. Experiment: monetizing a Flash game - Part 8 : Emanuele Feronato - italian geek and PROgrammer

    on March 4, 2008 at 7:13 pm

    [...] almost an one-week game (it took me 18 hours to make it) based on A new Flash game prototype post. You should always check for new prototypes because new prototype = new game [...]

  4. A new player control concept : Emanuele Feronato - italian geek and PROgrammer

    on March 5, 2008 at 8:38 pm

    [...] just a prototype, but remember that BallBalance was started from this prototype and ended with this sponsorship… PLAIN TEXT [...]

  5. Thomas

    on March 6, 2008 at 6:49 am

    very good!

  6. Prototype of a Flash game like GearTaker : Emanuele Feronato - italian geek and PROgrammer

    on May 6, 2008 at 8:31 pm

    [...] are the most interesting ways to make a game, remember what I was able to make from this to [...]