Jump to content
  • Advertisement
Sign in to follow this  

Conception problems on activity and animation

This topic is 1524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone,

I'm having trouble designing my 2d engine when it comes to displaying animation. I'm not quite sure if what I do is good in terms of object oriented conception and I need a little advice on it.

I've got thes objects :

FrameSet : a set of frames, each frames contains picture to display, hitboxes (created from white rectangles in images) and movement vector. It is created based on a xml file which is pretty self explanatory :

        <hitbox file="test_hitbox0.png" name="body" />
        <hitbox file="test_hitbox1.png" name="weapon" />
	<frame number="0" duration="2" />
        <frame number="1" duration="1" />
        <frame number="2" duration="3" />
        <frame number="3" duration="4" />
        <frame number="4" duration="1" />
	<kickvector frame="0" x="100" y="100" />
        <fixvector frame="0" x="20" y="20" />

Animation : It has a FrameSet as attributet, it adds a clock to it and it provides proper information whenever it is called.


Activity : Instancied by gameobject when gameobject has a certain state, it applies information given by animation (self.target.picture = self.animation.getpicture(), self.target.move(self.animation.kickvector etc...)


GameObject : moving object in the game with movement vectors, statemachines and one activity. A game master clock asks it to update periodically. When it does, it updates the activity, which apply information got from animation to GameObject.



The problem with all thes objects is they're so tied together that not a single one is functional when took apart and I'm not sure this is the way to do this. Another thing is that I've got one clock per animation, but also have a master clock that would be sufficient but my game (cpuspinner with clock asking for draw and updates) never asks things directly to the animation.


Thanks for your help.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!