Button click --> Player change

For questions about using Classic.

Post » Tue Apr 12, 2011 9:54 am

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
B
1
G
1
Posts: 6
Reputation: 437

Post » Tue Apr 12, 2011 10:00 am

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.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Apr 12, 2011 10:08 am

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. :P
B
1
G
1
Posts: 6
Reputation: 437

Post » Tue Apr 12, 2011 10:13 am

yeah, I was just suggesting another way of doing it
after switching the animation, did you use a Play Animation action?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Apr 12, 2011 10:17 am

I know, thanks for that! :D
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?
B
1
G
1
Posts: 6
Reputation: 437

Post » Tue Apr 12, 2011 10:35 am

I think each time you Set a new animation you have to Play it as well
could be wrong though. just try it!
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Apr 12, 2011 2:23 pm

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. :)
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Apr 17, 2011 12:33 pm

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:



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).
B
1
G
1
Posts: 6
Reputation: 437


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests