Friday 28 September 2012

Semplicity and rewrite

SEMPLICITY AND REWRITE

New ideas for reduce the complexity and speed up the development of reengineering the original POP.

Below are some notes about rewriting some classes and use a xml file for animation sequence configuration


CLASS ANIMATIONPLAYER

Proprieties

int currentFrameIndex
bool stoppable

Method

Play(Animation animation)

CLASS ANIMATION

Proprieties

List<Frame> frames

Methods

Count
GetFrameIndex(string framename)


CLASS FRAME

Proprieties

string name
string sound
string value
TypeFrame type
string parameter
Texture2d texture
Sound sound
bool stoppable
int xOffSet
int yOffSet

Enum TypeFrame {Sprite, Command}
Enum TypeCommand {Goto, Flip, ...}


XML

For fill the List<Frame> in Animation class i will use an XML file like this :

<animation name=TURN>
<frame name = startturn value=10 type=Sprite stoppable=false/>
<frame value=11 type=Sprite stoppable=false/>
<frame value=12 type=Sprite stoppable=false/>
<frame value=13 type=Sprite stoppable=false/>
<frame value=Flip type=Command parameter=-1 stoppable=false/>
<frame value=Goto type=Command parameter=STAND stoppable=false/>
</animation>
<animation name=RUNNING>
<frame name = running value=20 type=Sprite stoppable=true/>
<frame value=21 type=Sprite stoppable=true/>
<frame value=22 type=Sprite stoppable=true />
<frame value=23 type=Sprite stoppable=true />
<frame value=Goto type=Command parameter=running stoppable=true/>
</animation>
<animation name=STAND>
<frame value=1 type=Sprite stoppable=true/>
<frame value=Goto type=Command parameter=STAND stoppable=true/>
</animation>



No comments:

Post a Comment