Asuma Posted April 26, 2008 Report Share Posted April 26, 2008 Is there anyway to get the animation not get stick in it's animation? Like, my character gets hit a lot and eventually gets stuck in it's hit animation. Link to comment Share on other sites More sharing options...
Serephim Posted April 27, 2008 Report Share Posted April 27, 2008 Depends on how you program the game. You'll have to show me the code for the conditions in which the action starts/stops. Link to comment Share on other sites More sharing options...
Asuma Posted April 27, 2008 Author Report Share Posted April 27, 2008 Every 0.50 seconds While [Laser] is overlapping [Player] Change [Player] Animation to Hurt Something like that. Link to comment Share on other sites More sharing options...
Damizean Posted April 27, 2008 Report Share Posted April 27, 2008 Hi, I'm a timer event and I'm such a bad boooy. Dude, use animation states, it's the best way to manage animation changes and not getting them stuck in between. Link to comment Share on other sites More sharing options...
Serephim Posted April 27, 2008 Report Share Posted April 27, 2008 Dami and DW call them "States", but ive been using technically the exact same thing for years now. I just came across the method out my head while programming an old fighting game around 2001. Basically, you should have a system that dictates everything that should be happening and why. I call them "Action Variables", because every single action in my engine can be carried out by simply changing this "Action Variable" to a different value. for example, when my AV is 0, this is mostly normal walking, running and jumping with no special events or actions happening. So, my animation events go something like this: [X of (player) = 0] [Y of (player) = 0] [ Ground Sensor of (player) = overlapping obsticle background] [Action Value of (Player) = 0] ---> change animation to Standing. [X of (player) > 0 ] [X of (player) </= 5] [Y of (player) = 0] [Action Value of (Player) = 0] ---> change animation to Walking. However, these events can be overridden completely with the change of one simple ingame alteration -- changing the Action Value to anything other than 0. (This includes decimals as well. You can use 0 /0.1/0.2/0.3 too, giving you an almost endless amount of actions and alterations possible to your engine. So, if those conditions are met and the Action Value is DIFFERENT than 0, then the animations will not play. From here you can actually create different things to happen when those exact same events happen and just assign a different variable, like 1 or 0.1. Also, you can easily do something such as getting hit, and have your animation not get stuck. Events for that : [(laser) collides with (player)] ---> Set Action Variable(player) to 1 [Action Variable(player) = 1] ----> Set Animation(player) to Hurt [Action Variable(player) =1] [Animation "Hurt" is over] ----> Set Action Variable to 0 This way, when your character gets hurt, they have no way of any other animation getting in its way. However, everything in your engine has to be setup this way, but in all truth this eliminates the amount of events you need by a pretty large fraction. Anytime you need your character to get hit, just change the action variable. This system is almost required for something such as a fighting game or action-adventure platformer. Simple [player collides with (laser) --> set animation to hurt] events clash with tons of other events in your game, so its really not smart to do it that way. And on top of that, having to put [Animation (x) is not playing] one hundred trillion times can be confusing and looks really sloppy too. Its far more simple to simply put [Action Variable =/= (x)] and have that count for about 10 different instances instead. Link to comment Share on other sites More sharing options...
Asuma Posted April 27, 2008 Author Report Share Posted April 27, 2008 You're talking about using Alt Vars as the "animation states" right? Link to comment Share on other sites More sharing options...
Serephim Posted April 27, 2008 Report Share Posted April 27, 2008 yep. You only really need one. Link to comment Share on other sites More sharing options...
Recommended Posts