Ononmin Flash prototype
I want you to play a bit Ononmin.
It’s a simple and addictive game that does not require any physics or 3D library to work.
So it’s the best candidate to be prototyped.
In this first part we’ll create the “mushroom” you control. In the original game, you can’t move the mushroom, allowing the player to just move the launchable ball.
To change the game a bit, in this version you can move the “mushroom” along the x axis with the mouse, and the launchable ball will move from left to right just like in Create a Flash game like Gold Miner.
So at the moment I created these two objects:

The “mushroom” and the ball.
The main file, called onon.as, simply creates the player:
1 2 3 4 5 6 7 8 9 | package { import flash.display.Sprite; public class onon extends Sprite { public var player:mushroom = new mushroom(); public function onon():void { addChild(player); } } } |
As you can see at line 4, I’m calling mushroom.as that just make the mushroom follow the mouse along the x axis at line 12 and creates the ball at line 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | package { import flash.display.Sprite; import flash.events.Event; public class mushroom extends Sprite { public var bullet:ball=new ball(); public function mushroom():void { y=100; addChild(bullet) addEventListener(Event.ENTER_FRAME, on_enter_frame); } public function on_enter_frame(e:Event) { x=stage.mouseX; } } } |
And finally ball.as manages the ball. This is a little more “complex” so I commented all lines
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 | package { import flash.display.Sprite; import flash.events.Event; public class ball extends Sprite { // starting degrees value public var degrees:int=0; // value to transform degrees to radians public var deg_to_rad=0.0174532925; // rotation speed public var speed:int=2; public function ball():void { addEventListener(Event.ENTER_FRAME, on_enter_frame); } public function on_enter_frame(e:Event) { // updating the degrees degrees+=speed; // inverting the speed if degrees are > 80 or < -80 if (Math.abs(degrees)>80) { speed*=-1; } // placing and rotating the ball along the mushroom circumference // using a bit of trigonometry y=-20-30*Math.cos(degrees*deg_to_rad); x=30*Math.sin(degrees*deg_to_rad); rotation=degrees; } } } |
And this is the result:
Use the mouse to move the mushroom along the x axis
Download the source code.
They can be easily customized to meet the unique requirements of your project.

















(7 votes, average: 3.29 out of 5)









This post has 5 comments
LingoLux
I look forward to the next part :)
gamesloop
I must admit this is a very nice game. Simple and original and this one was my favorite in the 60 minutes to fame contest.
Ononmin Flash prototype – step 2 : Emanuele Feronato - italian geek and PROgrammer
[...] added some features to the Ononmin Flash prototype I showed you some days [...]
copyrightSensitive
I don’t like the way you mention games without crediting their authors.
Moreover you teach how to clone (“prototype”???) them but I suppose it’s for educational purpose (however you don’t explicit this policy either).
Ononmin Flash prototype – step 3 : Emanuele Feronato - italian geek and PROgrammer
[...] 3rd part we’ll manage stage edges and balls collisions. You’re invited to read steps 1 and 2 if you didn’t [...]