Category Archives: Games

Create a breakout game with the Citrus Engine

Today this is a new tutorial on the great Citrus Engine framework. Before starting my school project, I wanted to try using box2D inside the Citrus Engine, so I will show you how create a breakout game !

Click here to play the game, don’t forget to click in the swf to enable keyboard.

Continue reading Create a breakout game with the Citrus Engine

Beat the bot

At the Gobelins school, we made a game in less than 5 days. The concept was to create a musical and memory game : a sequencer. We worked in pairs : a developper and a graphic designer, he did a great job !

To developp the game I used the Gaia Framework and made MVC design pattern ! Gaia saves me some precious time : preloader, external loading, swfadress, transition between pages ; and MVC helps cleaning my code.

The game : Beat the bot !

Recently I’m trying to syncrhonize an iPhone with a website using BlazeDS on Google App Engine. I just need to find how can I export a flex project into an ipa… Hope it will be soon ok !

Box2D with the WorldConstructionKit

Before the weekend, I suggest to dig into the Box2D API for Flash with the great WorldConstructionKit.
Box2D is a physical engine wrote in C++ and translated into many languages such as Java, Objective-C, AS3, JavaScript…

For ActionScript3, there are 2 ports : Boris the brave’s port, and the WCK. You can find a performance comparison here made by Allan Bishop.
The WCK is the best thanks to the Alchemy port : it translates the C++ into something which can be understable by Flash. More information here.

The WCK provides a “a toolset / framework for rapidly developing physics based games / websites within the Flash IDE. WCK allows you to layout your 2d worlds / game levels entirely within Flash and have them hook into the physics simulation without writing any code.”

Continue reading Box2D with the WorldConstructionKit

Testing as3isolib

Hi, folks !

I know my last post was taken a while, the sandwich course is really intensive. However I will try to post more article. I’ve made many experiments since two months that I would like to share : stuff on games engine and datastructure.

For this firts post of 2011 (already !), I will introduce the actionscript isometric library : as3isolib. There are two others actionscript isometric library : TheoWorlds and OpenSpace but they are not free !

We will create an isometric world and add random boxes, if you click on one it will be removed. The result.

The code :

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package {
 
	import as3isolib.display.IsoView;
	import as3isolib.display.primitive.IsoBox;
	import as3isolib.display.scene.IsoGrid;
	import as3isolib.display.scene.IsoScene;
	import as3isolib.enum.RenderStyleType;
	import as3isolib.geom.IsoMath;
	import as3isolib.geom.Pt;
	import as3isolib.graphics.SolidColorFill;
 
	import eDpLib.events.ProxyEvent;
 
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
 
	public class Main extends Sprite {
 
		private const _CELL_SIZE:uint = 50;
 
		private var _grid:IsoGrid;
		private var _scene:IsoScene;
		private var _view:IsoView;
 
		private var _box:IsoBox;
		private var i:uint;
 
		private var _timerCreationBox:Timer;
 
		public function Main() {
 
			this.addEventListener(Event.ADDED_TO_STAGE, _init);
		}
 
		private function _init(evt:Event):void {
 
			this.removeEventListener(Event.ADDED_TO_STAGE, _init);
 
			_grid = new IsoGrid();
			_grid.setGridSize(10, 10, 1);
			_grid.showOrigin = false;
			_grid.cellSize = _CELL_SIZE;
 
			_scene = new IsoScene();
			_scene.hostContainer = this;
			_scene.addChild(_grid);
 
			_view = new IsoView();
			_view.setSize(800, 600);
			_view.centerOnPt(new Pt(200, 200, 0));
			_view.addScene(_scene);
			this.addChild(_view);
 
			_timerCreationBox = new Timer(300, 0);
			_timerCreationBox.addEventListener(TimerEvent.TIMER, _createNewBox);
			_timerCreationBox.start();
 
			this.addEventListener(Event.ENTER_FRAME, _ef);
		}
 
		private function _createNewBox(tEvt:TimerEvent):void {
 
			_box = new IsoBox();
			_box.styleType = RenderStyleType.SHADED;
			var couleur:uint = Math.random() * 0xFFFFFF;
			var alpha:Number = Math.random();
			_box.fills = [new SolidColorFill(couleur, alpha), new SolidColorFill(couleur, alpha), new SolidColorFill(couleur, alpha), new SolidColorFill(couleur, alpha), new SolidColorFill(couleur, alpha), new SolidColorFill(couleur, alpha)];
 
			_box.setSize(_CELL_SIZE, _CELL_SIZE, _CELL_SIZE);
			_box.moveTo(_CELL_SIZE * Math.floor(Math.random() * 10), _CELL_SIZE * Math.floor(Math.random() * 10), 0);
 
			_box.id = "box" + i;
			++i;
 
			_box.addEventListener(MouseEvent.CLICK, _deleteBox);
			_scene.addChild(_box);
		}
 
		private function _deleteBox(mEvt:ProxyEvent):void {
 
			mEvt.proxyTarget.removeEventListener(MouseEvent.CLICK, _deleteBox);
			_scene.removeChildByID(mEvt.target.id);
		}
 
		private function _ef(evt:Event):void {
			_scene.render();
		}
	}
 
}

The _scene.render() function is really important : it updates the scene of all your graphical change !

Later it will be a post on Box2d, stay tuned !