How do I Change the animations?

0 favourites
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hello everybody I'm having problems with the main character, basically I want to make that:

    When - Left mouse clicked (gun) >> set animation to (player_gun)

    But then:

    When Key (S) is down (Player Crouch) >> set animation to (player_crouch)

    But how do i make so when player has already picked up the gun before, then when he presses (S) then play animation (Player_crouch_gun).

    And another problem is when I get stopped by the wall because the player is too big to go through and still holding button go left.... as soon as I press S to crouch it's teleporting him as he was walking with out stopping? So it moves him to the position like the player never stopped.

    Thanks for attention!

  • Add subevents

    When key S

    -- player animation player_gun is playing

    set animation to Player_crouch_gun

    --else

    set animation to Player_crouch

    It might be even easier to give the player a boolean variable HoldingGun and check if that's true, especially if you are going to add more animations.

    If I have to guess the second question has to do with your collision-polygon and maybe origin-point..

    Check these or have the player's movement controlled by a square sprite with the animations pinned to it..

  • Thank you for replying! LittleStain

    I forgot to mention on how do you change Animations:

    Playing ( Player Animation ) and when you pick up the gun how do you change them ?

    • By destroying the Player Animation? or Making it invisible? while it's pinned to the Original Player or shade of the player?

    Whats the best way ?

    Because if I make it invisible it will not make the crouch (Player square) smaller? so he wont fit as the invisible square is there and not letting it go through small places where you need to crouch...

    Or if for example I will have inventory in the future then if Item is selected play animation?

    But...

    Then how do you make that the animation does not stop the legs for 1 sec in between changing the items? Because when you keep changing the other Items it will keep changing the animation to start from beginning ? So it's going to have like a body glitch? I hope You got what I mean Ty for listening!

  • I have no clue what you mean..

    Why should you destroy an animation?

    Do you mean:

    player on collision with gun

    player set animation to player_gun

    You can set animation from current frame instead of beginning if the frames of the animations are the same.

    If the animations are different you could first check the current animationframe and set the frame of the new animation to the corresponding one..

  • 19 - Doesnt work

  • 19 shouldn't be a subevent of 18, but a seperate event.

  • Okey LittleStain, But what if I set the Player(gun) Invisible and then Player(Crouch) Visible. The Collision Polygon will be not allowing to go through small holes as the player(crouch) Collision Polygon is smaller?

  • I'm not sure why you have different objects for the different animations..

    I would use a seperate sprite for the movement, pin the player sprite to it and have all animations in the player sprite..

  • LittleStain, I dont know how to explain better then that ...

    And I changed the height of it... here:

    But, is this the best way to do it?

    Thanks for attention!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It isn't the best way..

    Those three sprites could just be 1 sprite with three animations..

    All you'd have to do is set the animation instead of setting sprites invisible and settinging their height.

  • LittleStain you mean Adding Animations here on the main character?

  • Yes.. I don't understand the need for separate objects..

  • LittleStain Um, Im new in C2 Maybe that's why sorry

    Do you know why when I run into solid objects and then keep holding the button run (right) then wait.... 2 or more seconds....

    Next - I press (S) to crouch and it moves me forward?

  • It might be your origin-points or collision polygons are wrong, but could also be there is an event that's triggered unexpectedly..

  • It looks like the Player(gun) or (Player) Scroll To goes left like it's following something which means it's invisible Player? But I pinned them together but still they don't stay together ?? sad

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)