How do I make objects cancel out Solids?

  • I was wondering if an object is over a solid, the player can move in the object, but cannot move outside the object. But this must apply to the tiles of a TileMap object. So, if you are inside the tilemap object, you can move, but cannot leave it.

  • You can try the same principle as you did with the sprite box to limit player movement. Only instead of BBoxTop, BBoxLeft etc. use coordinates of this tile edges. It will be a bit trickier though.

    You can use PositionToTileX(player.x) and PositionToTileY(player.x) to get tile coordinate.

    Then add event Compare Tile State to see if this tile is "unlocked" and player can move inside it.

    https://www.scirra.com/manual/172/tilemap

    Are you sure you want the player to move freely inside the tiles with 8-behavior?

    If you only allow movement from one tile center to another (like in most grid-based games), this will be much easier to do:

    Player presses Left button, you check if the sprite on the left is unlocked and use MoveTo behavior to move player sprite there.

  • Ok. And I want to move freely because it is a tunnel and you should be able to move freely.

  • I have an idea: since my regular sprites work as a "BoundToObject", what if I have a tilemap tile on top of the regular sprites, making it a texture, but over the original object. So, the tile would overlap my working sprite. How could I make the tile go in the exact place as my working sprite?

  • I meant like this:

    https://youtu.be/pUvevR16qlU?t=7m52s

    Skip to 7:50

    It looks like the player is moving freely, but in fact it moves from one tile to another.

    This will be much easier to make. There are lots of tutorials about this:

    https://www.scirra.com/tutorials/all

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That is pretty much what I would need it to look like, but I don't want it to look like it is jumping across tiles.

  • It's not jumping across tiles on the video, is it?

    To move player sprite smoothly from one tile to another use one of the movement behaviors - the best and easiest to use is MoveTo.

    You can also do it without any behaviors, simply moving a couple of pixels on every tick:

    Player-> Move 1px at angle (angle(self.x, self.y, destinationX, destinationY))

  • So, how would I use MoveTo use solve this problem?

  • Don't forget the other question:

    The Connected Textures :P

  • Have you read any of the tutorials?

    MoveTo is the easiest part, just do "Move to (x,y)".

    But before that you need to check if the destination tile is unlocked and get its coordinates. All this you can find in the tutorials.

  • How would I detect if the tile is "unlocked"? I get how the MoveTo plugin works, but how would I implement that in my game? I tried using the PositionToTile (MoveTo X,Y -> X= Tilemap.PositionToTile(Player.X), Y = Tilemap.PositionToTile(Player.Y)

  • No, Tilemap.PositionToTile(Player.X) will give you the X-index of the tile player is standing on.

    Ok, I see you don't like to read tutorials. Here is the demo.

    https://www.dropbox.com/s/osj3ud6ri8h0y ... .capx?dl=0

  • Is it possible to make it so I can hold down the button and have it continue?

    I read some tutorials, they weren't that helpful. I did a CTRL+F and found ONE tutorial.

  • Of course it's possible. Just change "On key pressed" to "Key is down"

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