Changing Animations

Get help using Construct 2

Post » Tue Jun 19, 2012 1:24 am

.capx fileAnimation Test

I'm having the following issues with this layout:

1. When the character is crawling (down arrow + left or right arrow), the crawling animation doesn't play. Instead, only one frame of the crawling animation is displayed and the character appears to slide along on all fours. NOTE: This code block also changes the size of the player object.

2. While crawling under the obstacle on the layout, if the player releases the down arrow, the character will become stuck. I'm sure it is because the player object changes size, by design, but I don't know how to fix this.

3. When the player executes a forward flip (left or right arrow while falling to floor), the character animation should change to the running animation. Instead, the character freezes, and appears to skate along while standing upright.

**UPDATE-CLARIFICATION** The animation will reset to the proper running animation when the player releases the arrow and allows the character to stop.

**UPDATE-SOLVED (SORT OF)** I imported my running sprite sheet to the end of the flipping sprite sheet. I then set the new flipping sprite strip to repeat at the frame where the running begins. The effect is to make the character appear to flip and then continue running as originally envisioned.

The revised .capx can be downloaded here: Revised Animation Test .Capx

Bonus points: keep the animations from activating when flying (space bar) against the ceiling.

Thanks,

Tonyageiser2012-06-19 19:52:53
B
30
S
5
G
4
Posts: 26
Reputation: 5,247

Post » Tue Jun 19, 2012 2:07 am

bonus..... write a system condition when object touching then combine with it write a stop animation action for the player

2. write everytick system condition then combine with it a set object size action
1. write a every 0.3 seconds system condition then write a player action start animation from beginning and set animation speed action of 50 for example

3. increase animation speed of the player in actions
set angle to angle of motion
B
6
G
1
Posts: 10
Reputation: 1,056

Post » Tue Jun 19, 2012 2:19 am

i checked out your capex ...slow down the speed of the player when he is crawling by set speed action on player where you have the animation action
B
6
G
1
Posts: 10
Reputation: 1,056

Post » Tue Jun 19, 2012 6:54 pm

Thanks for the advice. Have you been able to get this to work? I have not.

I wonder if this is a bug?
B
30
S
5
G
4
Posts: 26
Reputation: 5,247

Post » Tue Jun 19, 2012 11:08 pm

Still not working.
B
30
S
5
G
4
Posts: 26
Reputation: 5,247

Post » Tue Jun 19, 2012 11:50 pm

Only set the crouching animation if the player isn't crawling ie. when action = 0. Otherwise the animation is being set to crouch and then crawl every tick so the crawl animation keeps getting reset and you only ever see the first frame.

For the flipping, use the 'On animation finished' trigger to change to the run animation.

animationTestUpdate.capx

*edit* I changed the origin point to the bottom of the animation. It stops the player 'jumping' when you change it's sizeramones2012-06-19 23:57:43
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Wed Jun 20, 2012 12:00 am

To prevent the player standing up inside a wall do something like:

If the player is crawling and down is not pressed then
   change the player size to (39,126)
   if the player is not overlapping wall at offset 0,-1 then
      stand up... set animations etc..
   else
      set size back to (39,126) + stay crouching
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Wed Jun 20, 2012 3:29 pm

Outstanding! Thank you. Sometimes you get so buried in the code blocks it's hard to step back and see the big picture.

I truly believe this is the best community on the web.

I found the 'On Animation Finished' condition yesterday, believe it or not. Thanks for showing me how to use it.

When I have fixed the other issues I'll post the revised .capx here for C2 users, who find it useful, to implement in their own projects.

Thanks again.
B
30
S
5
G
4
Posts: 26
Reputation: 5,247

Post » Mon Jun 25, 2012 5:19 pm

Funny, it looks like we're trying to do the exact same thing animation-wise, though your setup looks to be more state-driven :)

I have all the same locomotion (my 'running land' doesn't flip' but it is unique from a stationary land) but I found this thread while trying to implement crouching and crawling.

I see you are manually resize your player object but wouldn't it be a more flexible system if you were to make your crouch values a percentage of the original, standing size? The 'scale' property is looking for a percentage but height and width are looking for integers.

I've searched around a bit but haven't been able to find an expression to set height or width to a percentage of their original. Any takers?
B
5
Posts: 20
Reputation: 1,015

Post » Mon Jun 25, 2012 8:59 pm

Have you been able to do this?
B
30
S
5
G
4
Posts: 26
Reputation: 5,247

Next

Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 32 guests