Button click --> Player change

This forum is currently in read-only mode.
  • Hi, everyone!

    I'm currently creating a little platform game in Construct for some contest, and I'm having the following question.

    The main system consist of age changing. You have three buttons in a HUD, each one holding a different age. You have young, which means that you're fast and physicly capable, there's adult (grown man) which means you can lift and move heavy things, and there's old, and in that case you have a walking-stick with which you can hit monsters and thus attack.

    Now I'm asking if there are any suggestions on how to do this. I'm currently having the following system: when you click one of the buttons, the animationsheet changes, as does the part in the event sheet where the walking animations are defined. Also, your platform movements stats change to either better or worse, minding which state/age you are currently in. Also, when you're a man, objects like boxes and heavy stuff become available, and when your old, you can attack monsters instead of only the other way around.

    But that doesn't work very well. When I change my age, the kid and the gramps don't animate, they keep stuck in one of the two frames of my walking animation that I have set for them.

    So is there a better way to do this? Like, set up the first 3 players with different stats and variables, and then change players everytime you click a button?

    Thanks in advance for thinking with me,

    Japur

  • there are many ways to do this of course. personally I would probably take what you already have there, and make it an invisible character sprite. Then add 3 sprites, one for each age, and add the animations to that individual sprite, and then always set it's location to the invisible character sprite (when it's the selected age), and make them invisible or visible as needed. Just seems a less messy way to handle the animation sheets. Each age has it's own full set of animations in a separate sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, by default, you're the adult man. So I've just created some new animations for old and young, and then set the animation to those animations when you're young and old. But, as I mentioned, that doesn't seem to work; I'm having a problem with the animation. Because when I walk as an old or as a young player, the animation stucks at the first frame, but I'm having exactly the same event sheet for animation as with the adult version.

    I don't know if I'm explaining it correctly, but that is what I see.

  • yeah, I was just suggesting another way of doing it

    after switching the animation, did you use a Play Animation action?

  • I know, thanks for that!

    Hmm, that could be the case! So after I set the animation, I have to play the animation? Once? Twice? Every time the control is being pressed?

  • I think each time you Set a new animation you have to Play it as well

    could be wrong though. just try it!

  • Animations act a bit strange sometimes. You definitely don't ALWAYS need a Play Animation action, unless you're always pausing it or something, but sometimes it seems to be necessary. Not sure what's up with that.

  • Okay, so now I've created a system that I call a 'Paralleling Animation Structure', in which there is a physical, invisible player (a block) and three almost identical sprites, which represent the different ages. It works great, but there is something that does not work: mirroring. The sprites won't flip horizontally when I press "Move left", while they should be turning around.

    Any ideas? This is my control event sheet:

    <img src="http://i54.tinypic.com/1zyc5dl.png">

    I've set the sprites' locations to (PlayerX-[number],PlayerY) because then I can see what they're doing, and they don't overlap each other, but in the end, I will just set them to (PlayerX,PlayerY).

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