Is Falling on platform doesn't always work

0 favourites
  • 11 posts
From the Asset Store
This Girls Game allows young fashionistas to develop their taste and skills as a fashion designer.
  • I have a platform game started and my character needs to be able to jump onto an animated sprite. The sprite is simulating an object jumping or a wall going up and down.

    When my hero jumps onto its head, I want it to be destroyed. Just like the basic enemies in super Mario.

    My problem is sometimes when the animated enemies is not in animation, it doesn't catch the Is Falling flag.

  • I am a bit suprised that it works at all. Because, when the collision is happening it is done with falling.

    That logic is flawed.

    Did you check the collision polygones? Do they grow with the animation (and shrink) ? That would explain why it sometimes does work. Because the animation, when it goes from frame 2 to frame 1, schrinks the collsion polygones on the moment it dedected a collsion, therefor it goes falling again.

    A better way of dooing this is with ONLY a 'is overlapping at offset' with y = 15 pixels or so. Dunno how big your objects are.

    More about those collision polygones animating. Imagine an object 1 pixel above animation fram 0. All is fine. No solids stuck in eachother. Then it animaties (like poof, in big steps) to animation frame 2, and suddenly the solids are caught up in eachother. Got to watch that, dangerus, errating movements as result.

  • The collision polygons are different for each frame. They match the blue square in area.

    I am unsure of what is flawed. I will have to re read what you wrote a few times.

  • Ok an easier method is this

    1) Make an invisible sprite and have it under your sprite

    2)Then when the invisible sprite collides with the enemy , it destroys the enemy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Download my capx. file here to see how I use the invisible sprite . Its not exactly what your doing but it shows how I use it with collision events.

    https://www.scirra.com/tutorials/5343/h ... -game-capx

  • An 'is falling' under a 'on collision' can not work = flawed logic. Because when the collision happens it cant be in a state of falling after the collision check.

    It works sometimes because of the animating colision polygones. Wich is a bad thing.

    Animating colision polygones in big steps can NOT handle Collisions, Solids, nor Physics.

    Use One conddition. the condiditon 'is overlapping at ofset' for this situation. Replacing the 'on condition' and the 'is falling'.

  • rkruis did you try my methods yet?

  • rkruis did you try my methods yet?

    Aww, OK. I understand how the collisions are working with animations. If I slow the animation speed down to 5 from 10, it works 90% of the time.

    Yes, this is flawed and to fix it I have no real solution, but there are ways to adjust it to make it less prone to error.

    1. Add more frames.

    2. slow the animation speed.

    3. use a solid object at the bottom, not a good solution for how the game works.

    4. Use your suggestion, where I do not use Is falling, which i will check this out later tonight and let you know how it goes.

  • Pixel's option is a good 'general' solution too. But first you gots to learn eh ? : )

    See it like this. I am supposed to tip you gentle on the nose. But, on the moment that i tip, i animate my finger with out moving my hand. In no time, i make my finger 3 times longer. Where is my finger then? This kind of animations cant be handled in a physics world. Platform is a physics world.

  • Yea, I completely understand the issue.

    15 years as a developer but only 2 weeks on construct. It is a bit different than writing the code yourself.

    Thanks for all of the help.

  • There 1 (in fact only one) page in the manual that you have to read to understand 90% of C2.

    This one:

    https://www.scirra.com/manual/75/how-events-work

    Have fun coding.

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