Pixas Tutorial Series Part 1: Building Your First Application

This entry is part 1 of 5 in the Pixas tutorial series
• part 1: building your first application
part 2: coordinate system
part 3: primitives
part 4: color
part 5: dimension

In this part, I will show you how to build a brand new application with Pixas. Probably you have no idea what does this object mean but no worries, I just want to bring the idea that how easy this Engine works.

The project is hosted on GoogleCode:
http://code.google.com/p/pixas/

In terms of your personal preference, three ways to get code are as follows:
check out the code through svn
download an rar file (15.4 KB)
download an swc file (11.0 KB)

Also, you can check out the code from GitHub:
https://github.com/rison/pixas

After that, you should add the source folder to your global or project Classpaths.

Ok, let’s take it simple. If you have any preceding knowledge about pixel art, to create an isometric pixel cube must be the first show you would like to see. Here’s the code:

import com.risonhuang.pixas.objects.primitives.Cube;
import com.risonhuang.pixas.objects.PixelObject;

var cube:Cube = new Cube();
var po:PixelObject = new PixelObject(cube);
po.x = 200;
po.y = 150;

addChild(po);

Cube is a type of Primitive, we create an instance of Cube, then assign it to the PixelObject’s constructor parameter.
The PixelObject holding all of the primitives is extended from Sprite, which means we can simply add it onto the stage.

Run this program and you will see this cube on your stage:

It’s really easy right? Let’s zoom in the cube to take a closer look at it:

Now we’ve made the first application work, and you can see all of the pixel lines arrange fine. In the next part, we will learn about the coordinate system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s