Why does "turn on/off Solid on collision" apply to more than one object? [Example provided]

  • Hi guys, I have a top down rpg using Tile Movement (snapping perfectly to grid - important!).

    I finally figured out pushing Rocks which is working nicely - it turns on/off solid behaviour on collisions.

    But when I rub next to two Rocks it doesn't turn the solid back on for the far Rock, meaning I can push Rocks into each other. It seems the Solid doesn't trigger because maybe I'm *technically* still colliding with a Rock? (just not the far one)?

    Gif explanation

    Thoughts how to fix?

    Project available to download here.

    (Any advice on minimising the snapping/jittering appreciated too!).

  • When you stand next to any rock the overlap its always true, if you stand next to 3 rocks it will pick 3 of them this is without pushing and just standing next to them.

    If you look at your gift, the first rock you push to the right then you go away to go around to the Second rock when you move away from the first rock you give space of one tile and that's enough to no overlap any rock so the "Event 26" can be true and make all the rocks solid.

    But when you coming back of pushing the second rock you never stop overlapping the rocks you pass next of both of them making them None solid because "Event 9" is true for each of them because you oberlap one by one, that's why when you push the last rock to the right both of the rocks are no solid, if you want to make them no solid you need to go away at least one tile far like when you first push.

    So the Logic is wrong plus you checking for collision constantly unnecessary when you are next to any rock even if you don't push, you could save collisions check for better performance.

    Maybe by doing something like this:

    Capx: dropbox.com/s/o2gq5furliw8hsp/pushblocktest2.c3p

  • Here is my version, I managed to make the rocks and the player move smoothly.

    dropbox.com/s/kfvczdlqplt5hiu/PushBlockTest_dop2000.c3p

    It's a useful demo, will it be ok with you if I upload it to my website?

  • Interesting When The "TileMovement" Behaviour was released first-time I'm pretty sure that you couldn't move the object if it had the solid active but now I think that has been updated and you can move it even if the solid is active, which works much better now, you can move it without doing extra events.

    Or maybe I mistook for another behaviour, not sure now.

  • Thanks for the replies guys!

    tarek2 - that logic error makes sense thanks, but for your capx file the blocks don't move with the character, which is what I need. In yours they move while the player remains where they are (which is still nice!).

    dop2000 - yours fixes that error, but I'm also getting some slight misalignment when the Player pushes the rock. He stays still while it moves, or it moves two squares ahead instead of one etc.

    See this gif here of yours in action.

    Any idea why that happens? I had that error in an earlier draft and I really need it to be a perfect push as its for a puzzle game, even if its slower and more forceful.

    Yep you can use it on your website - even though it seems simple, it took a long time to get to that stage and obviously its still imperfect! I tried at least 15 different methods!

  • Further to my last reply dop2000 if you stand diagonally up and to the right from a rock, and then quickly press down and left, it moves left while you only move down.

    It's little things like that I think I need to iron out, but your version is closer to what I need! Any thoughts would be great.

  • steve1984

    Ho sorry I though the player needed to push first the rock, I see what you need now, see if this is what you need, this Tile buy Tile

    https://www.dropbox.com/s/rdkwpgcemiq40yv/pushblocktest3.c3p?dl=0

    ====================

    mm not sure what's going on but If you try to do a continuous movement instead of Tile by Tile like my last Example :

    It looks like there is a bug with the condition is not moving I think is triggering before the rock stops moving and sets the solid before time? this makes the player do small stuttering.

    The only way I managed to fix it it's by setting the solids manually adding a boolean and few more variables but it shouldn't need to add those extra things.

    https://www.dropbox.com/s/bxd4d7envpp5lu6/pushblocktest4.c3p?dl=0

    So you have two now, one continuous Moving and the other Tile by Tile, Pick the one you like

  • Amazing! Thanks so much for that tarek2 - the second one seems to work great.

    The only slight hiccup is the animation which seems to stutter a bit while pushing, but I'll organise a way around that (that artwork is not mine - just an example from Construct).

    Thanks again!

  • steve1984 I polished my version. It works correctly even if you press multiple buttons, there is no jittering and animations are changing smoothly.

    dropbox.com/s/218jgm3ps3dzix5/PushBlockTest_dop2000_2.c3p

  • Np steve1984 glad it's sorted out)

    Ho yeah, I didn't even look on the Animation sorry, I thought you still have to work it out because it looked unfinished the events.

    However, if you want to count for every possible situation to get the right animation and Direction + Smoothenes you are gonna need to rework a bit more the events for that.

    I had to remove all the events because it didn't count for some situations

    Example:

    If you are in a corner-blocked by solids from the (Top & Right) and the player is looking up but you start pressing right it will not change the animation to "Idle_Right" it will just stay on "Idle_Up", this is just an example of many situations that you need to count for.

    If you want to see what I mean check the last Example from dop2000 it has those problems swell

    ========================

    Another Example:

    Will be if you going Left and you stop in a Tile and below you have two rocks on the next two tiles down so you start pressing down you cannot move because the path is blocked by the rocks but the animation still keeps looking Left even you are pressing Down.

    Basically, you want the player to look always on the direction it's pressing even if he cannot move to that Direction.

    Here is the new one with the Animation fixed:

    Check it properly because Not sure if it's 100% Bug-free:

    Construct 3 Project:

    https://www.dropbox.com/s/b9quj5d24613lnr/pushblocktest6.c3p?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good Catch dop2000 "TileMoevement" is Not Moving on the Top of the other Events.

    That's why it worked some times yes and some times not, while I was moving the Events until I decided to replace it by distance.

    It looks like a bug to me as it doesn't make sense, it shouldn't matter the order where you place that "condition" either above or below, is gonna confuse many people and they gonna end up creating extra events unnecessarily, like me yesterday I had a very short time so I couldn't debug properly and I ended up adding distance to make it safe.

  • tarek2, yeah, took me a while to figure out that after you do "Simulate control", condition "Is moving" will still be false until the end of the tick. Not sure if this is a bug, but other behaviors (8direction, platform) start moving in the same tick.

  • Moved the topic to the Construct 3 How do I section.

    Glad Dop and Tarek have been helping you out steve1984 but if you've got a Construct 3 issue, make sure to post it in the Construct 3 forum! :)

  • tarek2, yeah, took me a while to figure out that after you do "Simulate control", condition "Is moving" will still be false until the end of the tick. Not sure if this is a bug, but other behaviors (8direction, platform) start moving in the same tick.

    I see, it makes sense now why it doesn't work when is at the bottom but I still think is a bit unintuitive especially for new beginners but hey the behaviour its been around for some time now and no one reported it, so looks like no one has a problem with it lol )

    I don't use it normally I use "MoveTo" behaviour most of the time so for me doesn't bother me much.

    Also, another thing that I notice is that the Condition "is Not moving" is a bit misleading because it behaves more as "MoveTo >>>> on Hit Target"

    Example:

    Right Key its Down >>> MoveRight

    If you keep moving right none stop then still the "is Not moving" condition it will fire up on each tile even if you didn't stop moving so its look more like on "Hit Target" condition

    I will instead do it like MoveTo where it has the same thing but separated into two conditions:

    1-Is Moving

    2-Oh Hit Target

    The "MoveTo" >>>>("is Moving" << Inverted) condition it will not run unless you stop moving

    That's why the "TileMovement"-- "is Not Moving" it feels like they have both conditions in one

    Anyway, it was a good thread to refresh everything about "TileMovement" as I didn't use it since it came out.

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