Detecting the tile next to the player...

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Okay, imagine this, it's simple really:

    You are on a playfield that is a tilemap. When the player is NEXT to a particular tile, I want a variable (let's call it "speed") to be set to 2, and when it's NOT NEXT to that tile, it should be set to 4.

    The problem is when I go to add the event, I'm using "Tilemap -> Compare Tile At -> player.X-32,player.Y = 11" then "set varSpeedLeft to 2" (I figured I would need various speed vars for each direction)

    This will say "If the tile to the left of the player is 11 (swamp) then set speed to 2"

    Of course the action is to set the speed to 2 if the tile is tile number 11. However it doesn't seem to be picking up on this at all. Is there a step I'm missing?

    Keep in mind: my movement is all custom, not 8dir or anything else.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Compare tile at" need a tile coordinate not a pixel coordinate, so you have to convert it first. Like this:

    Therefore its often in my opinion a lot easier to keep track of each objects TileX and TileY in some variables, so you don't have to convert the coordinates all the time. But can just use these to check vs the tilemap.

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