How do I stop movement before a collision

  • Hello, I'm trying to make a tile game. I'm moving the tiles by using set position. I only want certain things to happen when only certain types of tiles collide into each other. Otherwise, I want the tiles to not be able to move.

    I have tried using solids and collision detection, but I cannot seem to stop them from simply overlapping each other in the movement.

  • Think you need to supply a bit more information. When you say tile game, you mean tilemap? or do you mean sprites that moves based on a fixed ratio, so it appear as if its tiles?

  • Well, the game movement is similar to that of a sliding puzzle. The way I have it set up is that there are eight boxes where different pieces can slide to. Each slide creates a new piece that can either go into different slides or get stuck if no move is available.

    The sprites or tiles do move at a fixed ratio so they do not go outside of my boxes.

  • Could you provide a capx? That would make it easier to diagnose.

  • I have tried using solids and collision detection, but I cannot seem to stop them from simply overlapping each other in the movement.

    check your collision polygon.

  • I've thought about my question a bit more. I'm still having the issue.

    The collision polygon looks fine. Maybe this will put my question into better terms.

    Is there a possible way to set sprites as a solid while only using set position to move the sprites?

    I can not make my sprites move the way I want them to with the behavioral movements. I need to use set position, but I also need them to be solid.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There was an example of this, somewhere I dont remember. It was about grid movment and will stop the player from walking over the rocks. Did you try something like:

    Keyboard---Right arrow down & player --- (invert)is overlapping "Wall" at offset(0,-gridsize) ----- then move

    It a little hard to understand it that way. I will try to find the tutorial.

    Edit: here is it, maybe I will help you. Note, fix the url because I cant post them.

    http s:// w ww.scirra.com/tutorials/1094/grid-based-movement

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