How do I make my characters physics actually work/Animations

0 favourites
From the Asset Store
_______ Huge collection of metal fixtures ________
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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:

    But i dont know if it is up to date, and i never used it myself.

  • Thank you Genki and 99! I will try it now and tell you if I managed it Thanks for your support!

  • 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

    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?

  • 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".

  • Hi 99Instances2Go!

    Thanks for your in-depth tipp.

    I tried to adapt it but couldn't get it going <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    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 <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    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 <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • 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.

  • I like the graphics and the ethos.

  • 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

  • Don't know if your deadline is gone. I looked into your animations.

    I found 2 things.

    1/ Several events start different animations on shared little moments.

    2/ The collision box of the capturing and the captured animations jumped up. That way there came a gap under the player. And player started to fall. Triggering the fall animations.

    I can't make all your animations right. To much work. You would have had the same problems with a helper object. But i like to share with you the capx that i used to test the animations pair by pair. On the end of the events sheet, you find all animation changes i made/tested in 1 place. I renamed the animations for the green player, to be able to do this. Do not use this as your project ! It is just an example, and i only made changes for the green player.

    I hope that if you see this, you are convinced about getting those darn animation changes neat and cosy in one small block.

    https://www.dropbox.com/s/oizt90ztopdsa ... .capx?dl=0

  • Thank you so much 😙

    Oh, I can't open it cause its from a newer version and I wont update C2 before the deadline last time i did it killed the ogg converter within C2. Have to convert oggs with audacity since then.

    But i guess im good with the dummy box solution. it really runs smoothly. I still would like to check out your suggestions on the buggy parts of my code.

  • You may have already decided but I would second the pinning the animation object to the physics object.

    Physics can be touchy. If you are animating a physics object you are constantly changing the size and location of the object. This could cause unexpected results from the physics calculations because:

    If part of the object is animated from one location to the other it translates into very high speed and could react like a high speed collision

    If the animation changes sizes (of the collision polygon) it affects the mass of the object (size x density). So if one animation had arms and legs sticking out (running or something) and had a bigger collision border it would have more mass to throw around in that instance.

    Not to mention an animation causing collision polygons to suddenly overlap.

    I would pin the animations to an object with an unchanging polygon or else crazy things could happen.

  • I must admit that I only understood have of that but I may need to correct myself: I think I don't use phzsics - only the platforming behavior (so gravity)

  • I must admit that I only understood have of that but I may need to correct myself: I think I don't use phzsics - only the platforming behavior (so gravity)

    Ha, okay. If you are using platform then ignore all of that

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)