[Help] Collision issues!

0 favourites
  • 5 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Help!

    Hi there! It's my first post in this forum. Hope I'm doing it right!

    OBS: I posted this same post in section "General Discussions", but realized it was at the wrong place. Gonna delete the previous one an maintain only this one here. I'm sorry for the mess!

    I have an issue related to collision. I'll adress it further.

    MY INTENT

    I wanted to recreate something similar do the main movement mechanic presented in the game Dandara (https://youtu.be/iWOrGvzUmZE?t=667 - already at the right time).

    First Try

    My first try went something like this: C3P File - drive.google.com/file/d/1ykUx-W_mu7tQ8bkVb5f6hzI-gFj3LcOx/view

    File Name: 0Grav 2

    Commands: A key, D key and Space key.

    THE FIRST PROBLEM

    It does what I want, but, since the obj_PlayerMover is, at the same time, the object responsible for player movement and for collision checking, when it rotates, the spr_Player - soon to contain the animations - will be in a different distance from the wall depending obj_PlayerMover orientation.

    Notice that obj_PlayerMover perfectly detects and collides with obj_Floor, which is amazing, and I presumed it would stay like that but...

    SECOND TRY

    My second try went something like this: C3P File - drive.google.com/file/d/1SkmXohduHqEyM7QCRaGVNUYBdBJJp4j-/view

    File Name: 0Grav 3

    Commands: A key, D key and Space key.

    THE SECOND PROBLEM

    In my second try I used 2 sprite objects - 1 responsible for collision (obj_PlayerCollider) and 1 responsible for player movement (obj_PlayerMover)

    obj_PlayerMover behaves essentially like in First Try, but obj_PlayerCollider has some issues when colliding with obj_Floor:

    It goes "in" obj_Floor...kinda digs itself in, and the amount that goes in varies each time I jump.

    Plus, after landing anywhere, if I point inwards obj_Floor and jump, it will just pierce through obj_Floor, not really detecting it's edges. How come this wasn't the case in First Try? If you try this in First Try file (0Grav 2), you will see it's not possible at all. I expected collision to work in Second Try (0Grav 3 file) the same way it did in First Try(0Grav 2 file).

    Thanks to all replies in advance.

    PS: I'm a Construct and general programming newbie.

  • Not sure why you need both Platform and Bullet behaviors, remove Platform if it's not used.

    Bullet at this speed will almost never stop exactly at the edge of the floor sprite. It travels ~20 pixels per tick, that's why it often digs into the floor. You can enable stepping in Bullet behavior and check for overlapping with the floor in "On step" event, it may work better.

    Also, to prevent jumping through the floor sprite, you can enable "Bounce off solids" or check that obj_PlayerPointer is not overlapping the wall when Space key is pressed.

  • Not sure why you need both Platform and Bullet behaviors, remove Platform if it's not used.

    Bullet at this speed will almost never stop exactly at the edge of the floor sprite. It travels ~20 pixels per tick, that's why it often digs into the floor. You can enable stepping in Bullet behavior and check for overlapping with the floor in "On step" event, it may work better.

    Also, to prevent jumping through the floor sprite, you can enable "Bounce off solids" or check that obj_PlayerPointer is not overlapping the wall when Space key is pressed.

    Regarding having Platform + Bullet: at some point I got to believe Platform would influence collisions. I probably got confused, because I tested it without Platform behavior and I'm having the same results, then I'm letting it go.

    Regarding Bullet Pixels traveled per Tick: Man, it would've taken me so much time to figure this out! So clever of you!

    Regarding Stepping and "On Step" Event: I checked Step on Bullet behavior at obj_PlayerMover, but I'm confused on how to use "On Step" event. I did some stuff but I'm not sure I did it right. Anyway, I'm testing and having the same results :(

    Here is the new C3P file (0Grav 3 1.1):

    drive.google.com/file/d/1u-wdztNvfZm4rVVC9SsmNIPJJtJtD2wv/view

    Here is a .jpg of it's current Event Sheet:

    drive.google.com/file/d/1zHdxiGAou1vKFZrsNOLeUcagbGxELFHs/view

    Regarding jumping through the floor: That gave me some ideas on how to prevent this issue! I'm definitely gonna try that, but tweak here and there mixed with some stuff that just came to my mind!

    Anyway, thanks for your help and attention, Dop!

  • Turned out bullet stepping is not triggered frequently enough for large objects. Also, you had a different sprite for collision detection, so it was useless anyway.

    I fixed your project, see this file:

    dropbox.com/s/uuf0b4vc8byrwbu/0Grav%203%201.1_dop.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Turned out bullet stepping is not triggered frequently enough for large objects. Also, you had a different sprite for collision detection, so it was useless anyway.

    I fixed your project, see this file:

    https://www.dropbox.com/s/uuf0b4vc8byrwbu/0Grav%203%201.1_dop.c3p?dl=0

    Maaaan! You really did haha! Thank you for your attention. Plus, you presented some cool tools that I didn't know of. Been messing around with the file these days and I can feel it flowing way better!

    Thank you so much, Dop!

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