Introducing the new Citrus engine
Almost a couple of years ago I showed you how to create a Flash platformer using Citrus Engine, so if you are an old time reader, you should already know Citrus Engine
Now a completely new version of the engine has been released, with these breath-taking features:
* GPU accelerated via Stage3D technology which supports your choice of 2D or 3D using either the Starling Framework or Away3D.
* Open-source ActionScript 3 based community project that you can extend or alter in any way to fit your needs.
* Box2D, NAPE and AwayPhysics are available out of the box. With Citrus you have access to three supported physics engines enabling you to create 2D or 3D experiences. You can even build a 3D game that uses 2D physics, like a side-scroller platformer.
Although Citrus still features a lot of platform game oriented classes, with automatic generation of platforms, heros, coins, crates, cannons and so on, I will show you how to create a basic level of the famous Totem Destroyer game, which has nothing to do with platform games.
First, the main class:
|
1 2 3 4 5 6 7 8 9 |
package { import citrus.core.starling.StarlingCitrusEngine; public class Main extends StarlingCitrusEngine { public function Main() { setUpStarling(true); state = new starlingState(); } } } |
where starlingState is:
|
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 |
package { import citrus.core.CitrusEngine; import citrus.core.starling.StarlingState; import citrus.physics.box2d.Box2D; import citrus.objects.Box2DPhysicsObject; import Box2D.Common.Math.b2Vec2; public class starlingState extends StarlingState { public function starlingState() { super(); } override public function initialize():void { super.initialize(); var box2D:Box2D=new Box2D("box2dworld",{gravity:new b2Vec2(0,5),visible:true}); add(box2D); var ground:Box2DPhysicsObject=new Box2DPhysicsObject("ground",{x:320,y:480,width:640,height:40}); ground.body.SetType(0); add(ground); add(new Box2DPhysicsObject("block 1",{x:380,y:440,width:40,height:40})); add(new Box2DPhysicsObject("block 2",{x:260,y:440,width:40,height:40})); add(new Box2DPhysicsObject("block 3",{x:320,y:400,width:160,height:40})); add(new Box2DPhysicsObject("block 4",{x:320,y:360,width:80,height:40})); add(new Box2DPhysicsObject("block 5",{x:300,y:320,width:120,height:40})); add(new Box2DPhysicsObject("block 6",{x:320,y:260,width:160,height:80})); } } } |
Look how easy is to create a primitive Box2D body, but it’s not over… next time I am showing you how to embed your own graphics and extend Box2DPhysicsObject class to have our custom, destroyable bricks.
Meanwhile, the result:
I have to say I like this engine a lot, probably I’ll create some kind of game with it.
They can be easily customized to meet the unique requirements of your project.





(13 votes, average: 4.46 out of 5)







This post has 5 comments
Introducing the new Citrus engine – Emanuele Feronato « eaflash
[...] on http://www.emanueleferonato.com Share this:TwitterFacebookLike this:LikeBe the first to like [...]
Janitha
All of a sudden I feel it’s so much better than using Starling.
v0rbis
I’ve created two games with it. Nice engine
Maras
Stage3D rox, but there is still too low number of portals supporting it :-/
Fakhir
Hi,
I ran some comparison tests: Cirtus vs Cocos2d-x. I found that that citrus is horrendously slow and probably useless for real gamedev and deployment on “mobile devices”. For prototypes on PC it maybe ok.
Tests done on iPod touch 4:
No. of Sprites: Cirtus FPS
10 ——————— 53
100 ——————– 29
150 ——————– 20
250 ——————– 12
300 ——————– 10
400 ——————– 7
700 ——————– 4
For further derails and raw numbers please see:
http://forum.starling-framework.org/topic/starlingcitrus-vs-cocos2d-x-performance-benchmarks