Platformer Player Animation

For questions about using Classic.

Post » Mon Dec 08, 2008 3:32 am

Well, after messing with the basic Platformer, it'd be nice to know about the animation of sprites and how to control them.

I'd use Midnight's example but Construct crashes on my when I try to open a sprite the second time.

And yea, I've been asking for a lot >_<
B
2
G
4
Posts: 10
Reputation: 1,070

Post » Mon Dec 08, 2008 3:17 pm

Hey hey hey! Sorry to hear of your problems. Animations confused me big time until I got some help from the Captain (RIP).

If you want, you can send me your cap or upload it and I can take a look.

Basically, you're going to only be making the animations for facing right, and check the "auto mirror" under properties to flip the animation. When player presses the right key, set the angle of the player to 0; when left set the angle to 180.

Here is the code I'm using for my project: (edited for simplicity)

MouseKeyboard: Key Right arrow is down
System: 0 SpankyBoot[Platform].VectorY Equal to 0
Spanky: Value 'Dead' Equal to 0
System: Trigger once
> SpankySet animation to "Walk"
> SpankyPlay current animation
> SpankySet angle to 0
> SpankyBootSet angle to 0

The 'dead' value thing is just so that player cannot move once marked as being dead.

When trying to change the animation of the sprite (from Idle to walking for example) make sure to use this guideline:
1. Change Sprite to "animationname"
2. Set Sprite Animation Frame to 1
3. Sprite: Play Animation

(yes i know that isn't followed in the above code :P )

Making duck animations is a little trickier, and attack animations that involve not shooting objects (like using a sword attached to the player or a punch) is definately a bit more complex. My game's sprite has three detectors: Hit Detector, Attack detector and Floor detector.

LOL this is probably more confusing than I intended for ti to be...explaining things isn't my strong point :wink:

perhaps I'm better off looking at you cap to help ya out :mrgreen:
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Mon Dec 08, 2008 9:34 pm

I was actually using your spanky.cap file for a tutorials :D

But for some odd reason when I tried "Spanky(or any other name)Boot[Platform]VectorY", it didn't work because it said the VectorY wasn't a choice or variable or whatever :S - even though VectorY was check/there.
B
2
G
4
Posts: 10
Reputation: 1,070

Post » Tue Dec 09, 2008 5:09 am

LOL to be honest the whole vector.Y thing was a suggestion from another user. I just figured it means the player is on ground. I'll have to re-examine the code when I get back on my pc.

I have another (rather silly) platform mock up that I will send you, just email me at midnight_aaron at yahoo.com and I'll send it your way. It's the same stuff but also handles using multiple characters and jumping on enemies.

Let me know what you're trying to achieve, as in Mario, Mega Man, ect. and I can help you more.

Kippis!
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Tue Dec 09, 2008 2:21 pm

Okay, now I am back on my pc, so I'm checking the code.

I better solution for left/right animation is this:
FootDetector: is on ground
MouseKeyboard3: Key Right arrow is down
> FootDetectorSet animation to "Walking"
> FootDetectorSet animation frame to 1
> FootDetectorPlay current animation

Now we are using the "is on ground" event instead of that vectorY stuff. This should be rather easy to understand. I'll send you the cap still, just email me .
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Tue Dec 09, 2008 10:47 pm

Ok ,thanks! I'll try this out ASAP.
B
2
G
4
Posts: 10
Reputation: 1,070


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests