Test 1 – Prince animation

Prince of Persia

As a first step I’ve tried to reproduce, as faithfully as possible, the movements of the prince. Analyzing the source code and the technical documentation available it can be seen that the movement of all characters in the game is defined in two files: FRAMEDEF.S and SEQTABLE.S

The FRAMEDEF file defines, for each animation frame, the following parameters:

Fimage: the id of the graphic image of the character
Fsword: the id of the graphic image of the sword
Fdx: the horizontal offset in pixels
Fdy: the vertical offset in pixels
Fcheck: mainly used to detect ground collision

The SEQTABLE file defines the command sequence for each animation. There are two types of commands:

$00-$EF: identifiers of frames that matches the listed frames in FRAMEDEF file
$FF-$F1: are special instructions that executes specific actions

For example, $FB moves the character N pixels in horizontal direction.


Clipped spritesheet of prince

With this information we have enough data to handle the characters animation. What is missing now are the graphics. For this, I used a tool called PR (Princed Resources) to extract the game’s graphics, then I used ImageMagick to convert the background color for each sprite to transparent and finally I used TexturePacker to generate the spritesheet compatible with Phaser.

The results can be seen here.

For the next post I will try to look into build the game levels.

2 thoughts on “Test 1 – Prince animation

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s