Game Development with Flex and Action Script 3.0 -Baloon Shooter
What buddies, quiet excited about the title??Now I am going to narrate how i have developed a simple game with flex.
Development of Game Characters :
In this Game we have three game characters they are Balloon,Bow and Arrow.The Balloon.as Class is the balloon object which is formed by drawing a ellipse with a tail.The Balloon class has also motion associated with it and also a method to burst the balloon.In burst balloon we have redrawn the ellipse and changed the motion towards the land.
Next comes the Bow.as class which serves as a Bow on screen.This Object is made by drawing a curve and line(String to pull).The Bow Contains the pull Arrow method which makes the string line to curve based on the value that is passed.
Then we have the Arrow.as class which forms the Arrow object .This is also done by drawing line and then a triangle like appearance at the left end.
Development Of the Game Field
We have all the Game Objects in our hand and now we have to develop the field to put these objects together to watch the action.For this we have the BalloonField.mxml which has everything to make this happen.
In the Balloon Field I have a set Timer method which is going to generate balloons at equal intervals starting from random positions and with random speed.
Balloon Movement
On every Tick of the Timer tick method will be called which creates balloon instances with move effect from bottom to top with random durations.The reference of each move associated with a balloon will be tagged with associated balloon so that when the balloon bursts that tagged move effect’s moveYTo property will be changed to the height of application so that it starts moving downwards.
On every end of the balloon’s move effect(after that has been out of the screen ) that balloon object will be removed from the stage.
Bow and Arrow Pulling
When you press CTRL key loadArrow method will be called which creates a Arrow instance and a move effect instance will be associated with the arrow.The move effect will be moving the arrow from left to right.Like in case of Balloon Movement, in Arrow Movement also when the move effect is completed for the arrow the arrow is removed from the stage.
After loading the arrow when u hold space for some time u can see the bow’s string pulling the arrow producing a real effect of arching.You know how this has been done??I have started a timer on key down event and i am drawing a curve for a specified radius and on key up event the timer is stopped and the curve is again redrawn as a line .
When the timer is stopped the bow is brought back to normal state and the arrow is launched with the speed proportional to the “SPACE BAR” key holding time.
Collision Detection
The collision detection part in this game is done by maintaining two separate collections for holding the enemy(balloon here..) and the other for holding the weapon(arrow).
Then on Enterframe event the two enemy and weapon collection are checked with each other for their positions(x and y) for overlapping or touching each other.If they do so,then the enemy object (i.e balloon ) is said to get hit and hence at this stage the balloon is said to burst and fall downwards.
This may also have bugs, i will soon test it and publish a new version.
Game Instructions
- Press CTRL to load arrow
- Press and Hold SPACE bar to pull the arrow
- Release SPACE Bar to shoot at the target.
Any comments to improve the game and any better algorithm for collision detection are welcome.
Cheers.

feedback