Sprite Animations
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
Sprite Animations
How do you handle sprite animations in your games? I'm just trying to find the different methods you all use in PB.
Please do not mention Sprite3d in here whatsoever.
Please do not mention Sprite3d in here whatsoever.
Re: Sprite Animations
Since they are handled the same way, I wont mention Sprite in here at all either.dracflamloc wrote: Please do not mention Sprite3d in here whatsoever.
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
I was responding to your flappant remark. If you cant take what you give out, then it's best to keep quiet, no?
Anyways, for myself, if I am aiming for around 60 fps, then I create code much like the following assuming you actually wany 60 frames per second:
In your game loop, check current time against the last time to see if your myDelay value is reached. If it is, up the frame by one, be sure to make sure your frame does not past 59, or reset to 0 
If you set your delay in the structure, you can dynamically change it according to how many frames are used in your animation ...
This is roughly the way I do mine, except for now Im moving to pointers so I wont have to shift graphics around different variables (less lookup time
).
Concerning the Linux issue, Im running into the same problem
Thus I use a whole slew of CompilerIfs thoughout my engine whenever Sprite3D is involved. I know it's a pain, but until PB/Linux is uptodate .. 
Hope this helps!
Anyways, for myself, if I am aiming for around 60 fps, then I create code much like the following assuming you actually wany 60 frames per second:
Code: Select all
Structure strAnimation
LastTime.l
CurrentFrame.l ; Tell the engine what frame we are on.
Frames.l[60] ; 0 - 59 = 60 Frames
EndStructure
Global Sample.strAnimation
Global myDelay.l
Sample\CurrentFrame = 0
myDelay = 16 ; 16ms per frame = roughly 60 frames per second.
;Load up your sprites for each frame however you do it
; ..
Sample\LastTime = ;however you set the current time :)
If you set your delay in the structure, you can dynamically change it according to how many frames are used in your animation ...
This is roughly the way I do mine, except for now Im moving to pointers so I wont have to shift graphics around different variables (less lookup time
Concerning the Linux issue, Im running into the same problem
Hope this helps!
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
Actually, I think I woke up on both sides of the bed, I was doing pretty good about 10 hours ago, hehe. I apologize for my rude response.. argh, gotta love it, eh?
Anyways, there's another way to do animation .. use the PureTools
Im thinking about converting over, depending on how much overhead and speed penalty there is (if any).
Anyways, there's another way to do animation .. use the PureTools
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
-
Brice Manuel
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
-
Brice Manuel