Saturday, 20 October 2012



Finally i understood how to implement and continue in fast developing POP, but i need to rewrite and rebuild the program structure... (especially for the coordinate and position system..) why ? simple i started from an example of platform game in Microsoft XNA and isnt compatible with POP engine.

KID action/movement are based of an XML file KID_sequence.xml, the structure is

<sequence name><frames><frame></frames></sequence>

There are two types of FRAME : sprite and command

Sprite are definition of single frame : sprite name, texture name, stoppable bool, sound, x pixel movement, y pixel movement
Command there are two types: GOTOFRAME and GOTOSEQUECE are looping command for looping animation (run etcc)

POP structure

class PRINCEOFPERSIA -> main class load content resource
class LEVEL
class ROOM
class TILE

class FRAME

interface iCharacther
class PLAYER

class SEQUENCEANIMATION -> draw on screen sprites based on sequences wrote in the xml

The focus is how to manage the collision and position of KID in the room, for this i will write a new class called POSITION,
In the previous the coordinate are saved in a Vector2 with help with another Vector2 origin (x y sizeof sprite focus on bottom center of this) and a Rectangle structure for save the size of
the bounding of the sprite kid. ..... too complex to manage....

The class POSITION will manage the real screen and the draw position of KID in the screen and its bounding rectangle for collision detect.

XNA consider the x=0,y=0 the upper  left corner of the screen and when draw a texture (in default parameters) taking the left upper corner of this. The Position class translate this coordinate system based on the bottom center of kid texture.
Kid on x=0,y=100 the sprite will be on the left screen with feet on x=0, half sprite on screen. Other purpose of the class is consider the real screen, POP have 640x400 resolution but the last 20 pixel are reserved for enegy bar and messages, the class position manage the sprites on 640x380 (the room size).

In next post i will post the class diagram of POP

No comments:

Post a Comment