How do I work around no angled jump-thru?

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • i see in the manual that jump-thru does not support slopes, which does seem to be the case from my testing. what i'm wondering is if anyone has found a good work-around for this--searching the forum doesn't make it sound like something people have attempted much, but it doesn't hurt to ask, and maybe someone else could see my thought process later when they were also trying to do this.

    so far my best work-around seems to be to make a collision box that looks like this:

    since it has no slopes, and the collision seems to usually handle 1-pixel "steps", but i have fallen through it a few times. the main downside is that it's time-consuming to set this up, especially for steeper slopes or more complex objects. the other downside is that once you get more than 16 points, construct keeps telling me using too many collision points could lead to performance issues, which i definitely buy, but haven't personally tested. i also tried stacking jump-thru platforms which worked similarly but is also time consuming

    i also tried using a solid behavior and then doing this:

    but obviously this doesn't work, because once you collide with the thing it changes you to be falling, so it's impossible to evaluate what you were doing just before the collision, without saving your vectors every frame in an array to check against later--and then everything with platform behavior would be saving its vectors every frame, which i guess is possible. using "overlaps at offsets" actually let me pass through as desired, but also feels like it's going to cause performance issues at scale, and this exact method here creates a kind of jarring visual where it pushes you upwards through the platform

    these are just first attempts, and later i would expand them to families that include the various types of platforms i would need. ideally i want to be able to have "jump-thru" peaks of pointed houses or steeples of buildings. also hoping to have one-way horizontal platforms that block movement from one direction but allow it from the other, which seems to be an overlapping (lol) issue. maybe i can figure it out, but for now i'm just wondering if anyone else has any insights or experience on this

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i dont see why your jump-through needs to be a slope.

    can it not be just 1 line of pixels?

    unless you want the player to move up the mushroom i guess?

  • weird thing to say tbh, it's my game so why shouldn't i try to make things work the way i want? and it's just an example of the step thing i was talking about, where a more complex shape is too time consuming. like this one i didn't finish:

    and then there's this part:

    ideally i want to be able to have "jump-thru" peaks of pointed houses or steeples of buildings. also hoping to have one-way horizontal platforms that block movement from one direction but allow it from the other, which seems to be an overlapping (lol) issue. maybe i can figure it out, but for now i'm just wondering if anyone else has any insights or experience on this

    i want to have long slopes that the player can walk up. like this:

    super mario world did sloped "jump-thrus" in 1991 so i don't see why it would be impossible or i should limit myself if i can get around it. actually kind of surprised i wasn't able to find anyone dealing with this

    anyway, more constructively, here's my best solution so far:

    it handles long angles pretty well like this, and since player collision and all the other stuff that uses platformer behavior already has an "on fall" section for animation i could add this to them pretty readily. for the points i think i'll have to use sprite objects with platforms trailing to the side to get the effect i want (i use platform objects (they're 9-patches) instead of tiles with collision so that it can play sound effects, make particles, and change the player's movement physics based on the surface material, but i imagine it would work if you used tiles.)

    the last problem is i'm not totally sure yet how to handle 8 direction or bullets, which i have a lot of both, and definitely want my thrown objects to bounce off of them at the correct angles. i guess i will update when i figure it out but i still wonder if anyone has dealt with this problem before

  • Do you need to jump through these platforms up, or fall through down?

    I haven't tried it, but perhaps you can use both JumpThru and Solid behaviors. On pressing jump or down key - disable Solid on nearby platforms. When the character is on the ground - enable Solid.

  • i was going for platforms you could jump up through and not fall down through, at least without a separate action or something to pass downward through them. i would be interested in having one-way solids that work in other directions--like solids you could pass downward through but not go back up through, and one way doors like in mario maker.

    i did try putting jumpthru and solid together on an object and switching between them, but i want the slopes to still be walkable for NPCs/enemies even if the player isn't on them--but actually, i do think this would work for bullets, which could have an exclusion list with every platform in the layout on it, so that they'd only interact with the jump-thru behavior and ignore the solid behavior of the objects. it would probably work for most of what i need from 8-direction behavior as well, since they're mostly just bouncing off of solids--i think the oddity of objects with platform behavior sliding through sloped jump-thrus is mostly from how gravity works with left/right movement. i think i have an idea of how to work this out so let me test it and see how the bullets end up working...

    edit: ah, so, the "bounce off solids" attribute of the bullet behavior, which i maybe should have predicted, only bounces off of... solids! it already does not bounce off of jump-thrus. i had apparently already ran into this because i had bullets checking if their angle was between 0 and 180 (ie downwards) and if so bouncing, which doesn't like *technically* work for sloped jump-thrus (an object traveling at an angle of -5 could collide with the top of a jump-thru at a slope of <-5--additionally many of my bullets are affected by gravity so they could arc inside of a jump-thru which might result in weird behaviors...) so i have to figure that one out still. anyway, i did give bullets an exclusion list by doing this, which they seem to obey:

    (note that my game has a "layoutMaster" object that's present on all layouts already, to hold information like whether the layout is "inside" or what angle it is at relative to compass directions, so it was easy to add the variable here--i imagine you could use a global string variable just as easily!)

  • If you were to make a jump thru behavior from scratch it would basically work by stopping the object if it was above the object and trying to move down into it.

    Now you can replicate solid and jump through by correcting the position and velocity when there is a collision. Position correction would be moving the object out of the other object, and velocity correction would be to stop any velocity going into the other object.

    Anyways, here's an idea on how to handle slopped jump through platforms.

    dropbox.com/scl/fi/htipsix3dn1asnx8laj68/sloped_jumpThru.capx

    The general idea is if the previous frame the player's bounding box overlapped the platform bounding box or was above it. And if the previous position wasn't colliding with the platform, then the player is considered to be above the platform. After that and collisions are resolved by moving the player up. It works but the logic could probably be simplified further.

    To move the object up out of the collision I just incrementally moved the sprite by a small amount till it wasn't overlapping. There are more exact ways but that would involve rolling our own collision detection which is more involved. You could also try the custom movement behaviors push out actions.

    For those that prefer utilizing behaviors you could also attempt to enable/disable the solid behavior on the fly once you detect the player is above the platform. That would theoretically eliminate the need to manually correct the position and velocity and handle onFloor in a custom way. You'd have to test to see if it works first though.

    EDIT:

    Here's a modification to just toggle the solid behavior. Simplifies things a bit

    dropbox.com/scl/fi/3qt5pr4l4mcdk6mn61pdz/sloped_jumpThru2.capx

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