How do I make my characters physics actually work/Animations

Get help using Construct 2

Post » Thu Jun 23, 2016 11:37 pm

Hello C2 community :)

I tried hard and seem to fail:

I just can't make my characters animation phases/physics work reliable and really need some help. So please let me explain:

Character with animations like:

Idle
Run
Jump
Jumppunch
Attack
Fall
Hit

and some more.

They all have own animations with different "size" (Punching is wider then idle for example). I got actions like: play idle if not moving and on ground etc. I know some helpful people might wanna see the capx file? and i will upload it if needed but I think i just wrong-thought some points. I checked for all null points to be at the same point per animation. Also checked if all polygons are on the same height as well. My characters do all sort of things. Like "Falling" while on ground or glitching between animations in general.

Does somebody may have one or two wise words for setting proper null-objects / collision boxes in general? Or how they are supposed to be set and what you have to keep in mind while doing so?

Is it necessary to have aaaaall animation frames the same size (cropped)? same collision box. same null position?

I really need some help on this topic please. Couldn't find a tutorial or forum topic on how to do this properly.

Hope I could point out my problem well enough and thank you for any help ;)

Chris
Chris Hinz

Design, visual development and illustration

www.hinz-art.com
B
8
S
1
Posts: 56
Reputation: 581

Post » Fri Jun 24, 2016 1:47 am

Hey Chris, are you using a dummy object for your player character? (That is a base object with your character pinned to it).

Collisions can be different for each frame in an animation (you have complete control over that - there is a button in the image editor that shows what the collisions look like). To make it simple you can base collisions on the dummy object instead.

I'm sure there are tutorials but if you post a simplified capx it will be easiest to help.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Fri Jun 24, 2016 10:30 am

The dummy object is the easy way. And it might be the best way.
Althaught i almost never use it, it is more events, it is an object more to care for.

I just make all the frames in every animation the same in size. Normaly, i do that when i make the graphics.

But you can do this in Construct. Just find the biggest frame. Scale it to its size, (button in the ribbon), image = allign to center, check to do it for the whole animation. Do this (with this size) in every animation. If this gives problems as in the position of the animated thing gooing to slide, then a helper object will not help too.

For the origin, set it once in some frame, right click it in the image points list, apply to all animations. It is best, when working with a platform, to set the origin at the bottom. But within the collision polygones.

For the collission polygones. If they differ to much, the animation will animate the character into the solids. Result: the darn thing is stuck. With a helper object you have 1 collission polygone anywayz. So, you can as well set 1 collission polygone on all frames in each animation. Go to a frame that concerns you most, make the polygone. Richtclick the polygone (in image editor) set to all animations.

If you need animated collission polygones, thats is possible. (not with a helper object). You just need a lot of frames in the animation. And animations that are up speed. You have to animate the polygones in a way that they are no more differend frame by frame by kinda 2 pixels. That should work.

There is a polygine plugin: plugin-polygon-update-2013-04-23_t77970
But i dont know if it is up to date, and i never used it myself.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jun 24, 2016 10:40 am

Thank you Genki and 99! I will try it now and tell you if I managed it ;) Thanks for your support!
Chris Hinz

Design, visual development and illustration

www.hinz-art.com
B
8
S
1
Posts: 56
Reputation: 581

Post » Fri Jun 24, 2016 12:39 pm

Ok - for know I tried to sort out any issue about my null-objects, sprite cropping and collision polygons. There for I did the following:

When I make all frames dimension the same (sprite editor - resize - 350 x 350 center mid), set every animation and all their frames collision box to bounding box and give all animations/their frames the same null object position, everything works superb perfect!

But as soon as I start the last tweaking, customising the collision boxes, my animations go craaaaazy :P


EDIT:

I think I understand the problem. If the collision boxes height of the "idle" animation is less then the "fall" one PLUS both having the same null point position, it causes the glitch (fall hits ground - changes to idle - but idle is "shorter" and falls, creating a loop and glitching between the two)

But I thought if I rise the null position the same amount i raised the bounding box, it should fix it but its not. Am I thinking wrong there somewhere?
Chris Hinz

Design, visual development and illustration

www.hinz-art.com
B
8
S
1
Posts: 56
Reputation: 581

Post » Fri Jun 24, 2016 2:39 pm

idle animation starts this way ...

System > compare two values .. sprite.platform.speed = 0
System > trigger once while true
start animation "idle".

Jump is 'on jump'. That is a trigger. Means, it is only 1 tick true, it does not need a 'trigger once while true'

Sprite > platform > on jump
start animation "jump"

Left .. you do easy like this ....

System > compare two values .. sprite.platform.vectory < 0
is on platform
System > trigger once while true
start animation "left".

Falling ...

Is falling
once while true
set animation "fall"

or

System > compare two values .. sprite.platform.VectorY < 0
is on platform (inverted)
System > trigger once while true
start animation "fall".

jumping ...

System > compare two values .. sprite.platform.VectorY > 0
is on platform (inverted)
System > trigger once while true
start animation "fly".
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jun 24, 2016 3:25 pm

Hi 99Instances2Go!

Thanks for your in-depth tipp.
I tried to adapt it but couldn't get it going :(

Im definitely not asking anybody to fix it for me! but here is the .capx like genkigenga recommended, in case you wanna check it out and maybe see something or pinpoint any dumb mistakes.
https://www.dropbox.com/s/f3m8elhm5g834 ... .capx?dl=0

Press "P" to see controls when testing. run towards one of the "screens" on the left and right (keep running against the wall, theres one glitch showing). When you stand in front of the middle or top "screen" and simply jump and land again it'll glitch. Another one is that you can't jump while standing in front of "left and right screen". Sometimes jumping doesn't work at all.

My problem is that the game is almost done and the deadline is coming closer and now I try to fix those bugs that are found. Im not sure if I done the whole PlayerMovement wrong -.- and if there are any fixes I can do. Even if I recreate the whole Players, Im not sure what exactly to do better :D


EDIT!!! I might be on something! I will test and define and as soon as I can call it a solution I will tell you for future solution finders ;)
Chris Hinz

Design, visual development and illustration

www.hinz-art.com
B
8
S
1
Posts: 56
Reputation: 581

Post » Fri Jun 24, 2016 8:02 pm

At a glance, i see event 160, 195, 230 and 265.
When the player is not moving and when it overlaps itself, it plays "captured".
I dont know about the other conditions, i guess at least one of those combinations is true when on the left or right wall. Especially the health = 1 ... because

When the player is not moving and on the floor and health = 1, it wants to play "idle" too.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jun 24, 2016 8:04 pm

I like the graphics and the ethos.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jun 24, 2016 8:25 pm

i still dont understand why different collision boxes and null points but same distance between the two still cause gliitches.

thank you so much for your help! I took both your advice and did a lot of experimenting and debugging and solved the problem and ended up with a perfectly smooth and enjoyable to play movement system 😊 with no glitches!!

I created a new sprite, collision to binding box. Sized it to a general size, working for all the characters animation. Then I gave it all the platform behaviors of the character and deleted it's platform behavior. Set every tick position of the character sprite to the boxes.x boxes.y and made it invisible. I just had to change the events that were triggered by the platform physics behavior of the character to the new one of the box. Made it invisible a viola! A perfectly simple working box "styled" by a sprite sheet with complex animations.

My game will launch on the 15th July :)

Is it allowed to post a link to my website here so you or whoever wants to can check it out? Thanks for both of your help guys!!

Chris
Chris Hinz

Design, visual development and illustration

www.hinz-art.com
B
8
S
1
Posts: 56
Reputation: 581

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests