permith Posted May 21, 2015 Share Posted May 21, 2015 So my current system has the sprite object that manages the "animation reel" IE: timing, switching to the next sprite, and looping, and the character object which controls physics, location, collision-requests, and animation requests(of the player). These two are are completely decoupled. Which means that I have the hard decision of having to decide where the sprite animation time is "fed from". For example I could have the sprite reel have it's time fed from the game loop or I could have the sprite reel time fed from the actual drawing logic. Depending on the situation the game loop could end up being less frequent than the animation loop(but not the otherway around), or ocassionally the game loop will fire twice before an animation frame to not "lose time"(maybe more if very few screens are being drawn). The game loop itself runs at a "near perfect" 15MS between each step. The animation logic runs as fast as the computer will let it(using Javascript and requestAnimationFrame()). Also the logic of switching to the next frame in the sprite or even changing the animation are less intensive than camera manipulation, so I'm not worried about that._____________The advantages of having the sprite animation in the draw area is that it will run "for sure" and more accurately. and that a stutter from a double game loop isn't something I need to worry about. But it's going to come at a cost of needing more logic to count time. Possibly being able to get briefly out of sync from character actions. On the other hand it's possible that I'm just being silly and over thinking it since the most I see something getting out of sync is 30MS, but maybe 60MS(if an added status effect would trigger an animation, though that's not implemented and won't be for the game I'm working on)._____________ looking for advice of where people have put the logic of control which frame a sprite should be on before. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.