How to get the active animation of a character

  • #1, by dionousTuesday, 31. October 2017, 11:06 7 years ago
    Hi all,

    anyone has any idea how to get the active animation of a character with lua?

    I'm doing some tests with collisions in VS and i was thinking that if there was a way to get the active animation of the characters participating in the collision i could define the outcome of the collision, i.e. if the character's active animation is e.g. 'Punch' during the collision then the npc would drop dead etc.

    Forum Fan

    246 Posts


  • #2, by ke4Tuesday, 31. October 2017, 11:15 7 years ago
    You can get the animation state. If character is standing/walking/playing random animation or playing individual animation.

    game.CurrentCharacter.AnimState

    Not sure if you can get the name of currently playing animation but what you can do instead is seting up some condition when this animation starts and seting the condition back when the animation ends. You can do it in the animation frames actions.

    Key Killer

    810 Posts

  • #3, by afrlmeTuesday, 31. October 2017, 11:28 7 years ago
    You can get the animation state. If character is standing/walking/playing random animation or playing individual animation.

    game.CurrentCharacter.AnimState

    Not sure if you can get the name of currently playing animation but what you can do instead is seting up some condition when this animation starts and seting the condition back when the animation ends. You can do it in the animation frames actions.
    Maybe a value would be better than conditions for this. What Ke4 said about updating it when the animation starts is a nice idea, but a value would be better than conditions as you would only need 1 value rather than a bunch of conditions. You could either use the integer (number) field of a value or you could use the string (text) field of the value - bearing in mind that the string field can only be written/read with Lua script.

    Imperator

    7278 Posts

  • #4, by dionousTuesday, 31. October 2017, 11:35 7 years ago
    Thanks guys, yes conditions or values sound good.

    Generally i can see that VS has the potential for other games genres also like platform games etc. and while some major functionalities are lacking (e.g. tiling or sprites spawning), the devs have a goldmine here that they should develop.

    Forum Fan

    246 Posts

  • #5, by ke4Tuesday, 31. October 2017, 11:51 7 years ago
    The problem here is it's only Simon now. It's hard to do all the work alone.

    Key Killer

    810 Posts

  • #6, by afrlmeTuesday, 31. October 2017, 11:53 7 years ago
    Apparently you can now duplicate (create) & destroy objects with Lua script, but it's not like GameMaker Studio where you can create Finite State Machine per object type to give it random properties on creation such as speed, rotation, direction & so on because as far as I'm aware I can't declare the target as self.

    In regards, to platforming, I believe Simon is working on implementing the box2D physics engine.

    Tiling, not so sure about that & as you know, the engine doesn't like massive backgrounds. I guess it would be kind of pointless seeing as you would be able to draw collision masks over the tiles to determine if they are a wall, an hill/slope, floor or ceiling.

    Imperator

    7278 Posts

  • #7, by dionousTuesday, 31. October 2017, 12:28 7 years ago
    Yes, I think it's not pretty far from making some solid platformers and practically you can even now make some relatively simple ones (or even action mini-games in an adventure game). The fact that Simon is working on this is positive and shows that the devs really want to have a versatile engine; time will tell but i think we are on the right track here.

    Forum Fan

    246 Posts