Animation woes...

Get help using Construct 2

Post » Wed Feb 08, 2012 9:15 pm

I was going to say don't worry about it, since Animmaniac's fix works, but after porting it into the full project, I just realized that it actually doesn't...

Alrighty, explanation time. The ninja, as you see, is just a blob, so most of his animations are him bouncing around like a cartoon ball. The previous animation system used frames to do all of this, but the new one uses far less frames and instead stretches and squishes him by changing width/height with events. Unfortunately, that makes it a lot more difficult to use mirroring; since that works (presumably?) by making the width negative, if you use "Set width" and set it to a positive number, it messes things up. I couldn't get that working right, so rather than use mirroring to make him face left, I used a second frame and flipped it in the editor.

This is the basic animation system, with everything but walking and turning cut out. Hopefully you'll see what I mean:

http://db.tt/UCWRhbcs
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Wed Feb 08, 2012 9:27 pm

I haven't downloaded your capx yet (won't tonight, it's too late) but reacting on what you wrote.
I'm wondering why you bothering with mirroring and frame changes if the trick about negative width/height actually really does change the orientation of the image, just use a single frame and lerp the way out of it's width/height all in events.
It sounds to me you did half the job of controlling your anim through events and you stopped in the middle when you should have gone fully for it.

I'll have a look at your capx after some sleep and if nobody has proposed something in the meantime.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Feb 08, 2012 9:37 pm

Kyatric, apparently you can't actually set it to negative and change the orientation yourself. At the same time, if the sprite is mirrored and you try to set the width, it cancels out the mirroring. So essentially it seems the two can't work together at all.

If anyone else who looks at the capx thinks they have a better way to do it, by all means take a swing at it! I just don't think it's possible to do that way.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Wed Feb 08, 2012 11:23 pm

works fine with me
ninjaTurn3.capx
Last edited by Yann on Sun Sep 14, 2014 9:38 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Feb 08, 2012 11:38 pm

So it does indeed work! The tough thing here is... I don't really understand that stuff. I'll be using these techniques for a lot more than just walking animations, and I'd rather stick to what I'm comfortable with for all that.

If it's literally impossible to do it the previous way, I'll force myself to learn how to effectively use lerp and sin and all that good stuff, but if it is possible I'd rather use that.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Thu Feb 09, 2012 11:50 am

the sin() part is really basic, sin() make things evolve from 0 to 1 to 0 to -1 to 0 etc... with the abs() I force it to evolve frome 0 to 1 to 0 to 1 to 0 etc... and then I just have to multiply this value by an amplitude to make the height evolve.

The lerp thingy is just used to quickly go back to the starting size. (If you don't use lerp it will just snap back instantly).

I strongly suggest you learn how it works. Your way is way more complicated. There's too much variables and situations to take into account. Once you get the hang of sine and lerp you will see that things get easier and well... You can use that for so many things.

Anyway, this capx was to demonstrate one thing: you can tweak width and height even with mirror. You just have to always put the mirror at the end of the event list for it to be applied. So you don't have to resort on your animation frame tricks anymore.
Using lerp and sine is not necessary, you can use a variable you increment and decrement for scaling as you already do. (with sine it's just more straighforward)

That's all (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Feb 18, 2012 7:36 am

Sooo... I'm having trouble again, @Yann.

I took a two-week-ish break to do schoolwork (design and make a game in two weeks, yikes), but now I'm getting back into this. I started redoing the whole animation system using your sine walking as a foundation, and got pretty far with it. The problem? The same dang flickering I started this topic for in the first place, at the end of the turning animation.

http://db.tt/PoGLIOlO

Mind taking a look?
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Feb 18, 2012 4:03 pm

ninjaTurn4.capx

Somehow, the walking animation was set one tick later. So the turn animation frame 0 was displayed. Very weird. But setting the animation in the state="Walk" subevent make sure you set frame 0 from animation "Walk" and not "Turn". Well look at it you'll see.
Last edited by Yann on Sun Sep 14, 2014 9:36 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Feb 18, 2012 8:01 pm

That did the trick! Weird problem, but thanks for the fix. Hopefully the rest of the animations will work in smoothly, but... well, I might be back soon.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Previous

Return to How do I....?

Who is online

Users browsing this forum: LeFuji and 22 guests