How do I Get animations to play for actions?

Get help using Construct 2

Post » Thu Mar 13, 2014 9:22 am

I'm a big Sonic fan and finding out how powerful construct 2 is in programming a workable game I "jumped" at the chance.

So far I've managed to make a basic movement with mirror action (walking left and right),
also implemented crouch and jump, but I seem to be running into a few problems.

Crouch only plays the first frame (there are 3 frames)
Jump only plays the first frame (spin jump has about 7 frames)

I did manage to make an action for "Pressing Down" while crouching and Press "A" to start the spindash Rev"

Unfortunately this also plays the first frame but no others.

I'm not using the Player Box (invisible box) technique, just the sprite with actions.


Any help to solve these problems would help me have a good nights sleep lol.
B
1
Posts: 2
Reputation: 129

Post » Thu Mar 13, 2014 9:51 am

Did you check your Animation properties? Maybe the speed is 0? How do you switch Animations?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Thu Mar 13, 2014 10:03 am

I usually plan it all out: I write down all the animations I'm going to have. Then I take a placeholder as the main player and give it variables (boolean) like "jump" "run" "duck" etc. Then I make a page that says:

if NOT jump
if NOT fall
if NOT run
if NOT duck
---set animation to idle

Later on you might have:

Presses "SPACE" bar
Platform is on ground
if NOT jump
if NOT fall
---simulate platform jump
---set animation to jump
---set jump to "true"

For jumping and double jumping I use variables to determine if the player is double jumping etc. The Platform+ object doesn't need this I think, and I haven't played with it enough to know.

I hope this all made sense! Good luck!
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Thu Mar 13, 2014 10:13 am

Is it maybe possible that you set jump back to false too early?
And did you check about Animation speed?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Thu Mar 13, 2014 10:38 am

Oh yeah, that's another thing, doing things too soon. Remember, the computer can't read in 3D like we can. A human can assess his environment even if it's not being observed. A computer is similar, except it only does what it's told to do and with the things it's told to do them. AND IT DOES IT in a specific way, from top to bottom, one at a time, and the current piece of code takes authority over the one before it.

Take any action in your game, and write it out before you code it if you have to. For example, a problem I run into is like this:

Is touching something //here you're touching something
---Is Variable = 0 // if var is 0
------Set Variable to 1 // set to 1
---Is Variable = 1 //here is the authority problem, the "set to 1" above makes this statement true now, so it runs this instead of stopping at setting to 1
------Set Variable to 2 //same continues until the end value is 0.
---Is variable = 2
------Set Variable to 0

What happens here is the variable will be equal to 0 at the end because you are touching, and it's quickly turning it to 1, then turning it to 2, which makes it 0 again.
The same code, just fenagled with:

Is Variable = 2
---Set Variable to 0

Is touching something
---Is variable = 1
------Set Variable to 2
---Is Variable = 0
------Set Variable to 1

This way above it won't accidentally read previous values and update those, but is locked itself in a "dead end" situation with the block of code. This is an example of an "on off" switch or button etc.

This works for all things, not just switches but animations as well. My original reply is my favorite method because it creates a solid "rubber band" style of game play, where "jump" or "run" or "walk" is like "popping the rubber band" but it all goes back in place once you're done.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Thu Mar 13, 2014 10:56 am

Does that mean you found the solution?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Fri Mar 14, 2014 8:47 am

I'm totally stumped, not sure how to set variables.

Heres my actions so far that seem to work OK.


Walking works left and right
crouch works but only the first frame
Jump won't paly anything but the first frame.


Tried the simulate jump action but it still only plays the first frame.
B
1
Posts: 2
Reputation: 129


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, Darknessed and 39 guests