Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

animate 2d character

All about the StoneScript

animate 2d character

Postby siml » 11 Jul 2012, 14:59

hi.
i want to animate a 2d character in Shiva.
should i use timer to animate it (change texture) or use onEnterFrame event?
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 54

Re: animate 2d character

Postby Kwaung » 11 Jul 2012, 15:25

What you are using for your character animation, HUD system or a texture map to a plane?
If you use HUD timer, I have no idea about that.
But if you use the plane one. I suggest changing texture's UV will be more faster than change texture itself. And yes you need the animation system to update every frame. It up to your design that you will use Event's onLoop() or onEnterFrame().
I suggest that create one main AI to taking care of all animation update will faster than per object(character) basis.
Kwaung
Fresh Boarder
Fresh Boarder
 
Posts: 14

Re: animate 2d character

Postby siml » 11 Jul 2012, 15:48

my character animation is 2 second long,and 24 frame(24 texture).how can animate it in onloop while keeping normal movement?
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 54

Re: animate 2d character

Postby broozar » 11 Jul 2012, 16:03

User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3514
Location: Berlin - Germany

Re: animate 2d character

Postby siml » 11 Jul 2012, 16:09

hi dear broozar.
i have so many character in my scene,doesn't it make game slow?
do i have define anim2DTimer for every character in scene?
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 54

Re: animate 2d character

Postby broozar » 11 Jul 2012, 19:53

"many" is a very relative term, not only depending on the actual amount, but on the target platform as well. you have to conduct tests on your own. of course, as always, using less objects is always better.
siml wrote:do i have define anim2DTimer for every character in scene?

no, this hud action only tells the main ai when to animate. make sure you object.sendEvent() the animation from onAnimate in the main AI to every onAnimate event in every object you want to update though.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3514
Location: Berlin - Germany


Return to Game programming