Turning Animations on and off

For questions about using Classic.

Post » Thu Mar 13, 2008 11:10 pm

As far as creating animations go, I know what I'm doing. But how would I make a character play a run animation when a key is held and stop the on release of the key?
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Thu Mar 13, 2008 11:18 pm

I happen to have a tutorial .cap for this very occasion. Check it, yo:

HowToRun.cap

Edit: In case it isn't immediately apparent how to get the "not equals" sign in front of a condition, you right-click on it and select "Invert condition."
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Mar 14, 2008 7:15 pm

Thanks a lot! :D

I wish I had known about the inverse function a long time ago.

One question though, since I'm making my own controls would you happen to have any ideas as how to simulate 'player is moving'? I've been trying to do it for a while but nothing seems to work.
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Fri Mar 14, 2008 9:19 pm

Well, the "set ignoring input" and "stop ignoring input" are just in the .cap to keep the character from moonwalking when both keys are down. It's a side-effect of the default platform movement. If you're making your own controls then you probably won't have to worry about it.

But just in case, you can assume it's moving when the move keys are down. That would be the most simple way.

Or you could put in a couple variables called "lastX" and "lastY." Before your movement routine, put the player's X and Y coordinates in them. After your movement routine, check the player's X and Y coordinates against them. If they're different, the player has moved. If X is bigger than lastX then the player has moved right, and if Y is less than lastY then the player has moved up, etc.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Mar 14, 2008 9:43 pm

Well I'm trying to mimic your example but I must be missing something crucial because I can't even get one direction to work. :(


Link to .cap.
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Fri Mar 14, 2008 9:59 pm

Ah never mind. I got it to work. Though I have to ask, what exactly is the purpose of having those angles?
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Fri Mar 14, 2008 11:30 pm

They override sprite rotation. If you only had a sprite drawn for angle 0 and told Construct to change the angle to 180 when going left, then your sprite would be upside down. Making a sprite specifically for 180 degrees counters that.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Mar 14, 2008 11:53 pm

Alright then. I suppose I should use that method. I'm already setting separate animations for different directions. Oh well.

Thank you for all your help though. :)
B
2
S
2
G
4
Posts: 136
Reputation: 1,722


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests