I'd like to create context sensitive death animations in my own game but, I even know where to start. How can I make context sensitive death animations similiar to the game Perfect Dark? The game has enemies will lean over a rail and fall from a high place after being shot to death. You have enemies that will fall on the wall and then slowly slide down after being shot. The reason why I'm using Perfect Dark as an example is because it's an incredibly old game. Now this video example that I found on Youtube probably isn't that good of an example as it's incredibly specific but, these types of animations can pop up in less specific circumstances.

    Audiobellum it's likely just logic inserted into the kill animations. How exactly they coded it is something I can't tell you. But it's probably a lot of small lines of codes like (this is made up) if wall, then enemy.fall_over_wall() or something equivalent and probably several lines of that peppered in dependent on the circumstances.

    Let's just make-believe here and say you have a "kill" function that happens when an enemy dies. In that function, you likely have some sort of state machine that has functions for different animations dependent on the situation. So assuming this is the case (more made up code here):

    Note this is pretty simple logic, you can probably code it more efficiently, but this will at least make it digestible if you're learning.

    func _kill_animation(condition): ## you make a function to sort your kill "states" and the condition is well, the conditional
       
               if wallContact: ## let's say you have logic that flips when you touch a wall
                  _aerial_wall_deathscene()
               if wallContact and FloorContact:
                  _ground_Wall_deathscene()
    ## and so on and so on

    Basically make functions for each "type" of death and logic to sort out what animation happens when.

    Many of these types of scenes are far more 'scripted' than they appear, with modern software you could potentially make something more procedural with raycasts, however it would have to be something fairly impressive for the average gamer to appreciate otherwise they might rightly think it's just a bunch of scripted death scenes. Even then though, I do think that the death animations in a lot of games are some of the most half-arsed you could ever do in a lot of cases, most of the time game devs nowadays rely on explosions or ragdoll physics or if they PG-13 it up they have the characters simply fade out of existence.

    The most impressive thing I've seen in the industry with regards to these types of techniques are the original Left for Dead games where the devs went to a ridiculous amount of effort to do limb damage and then Fallout games where of course you can shoot off the limbs of synths and they'll fall to the ground and still try to shoot you. I get what you mean though, context sensitive death animations are largely something that isn't explored very much these days, it's all about quick and dirty physics.

    I still remember how in Goldeneye if you shot a soldier in the arse he'd jump up in surprise which is pretty hilarious.