How do I create tiles with different properties?

0 favourites
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • My first post and I am trying to do a version of an 80's platform game I worked on back in 84 (very similar to Manic Miner). I need to be able to set different properties to specific tiles and am not sure despite hours of online searching. I have four main types for this game; 1 solid wall block, 2 Jump thru but stand on block, 3 collapsible block and finally a block that moves the player either right or left if the walk on it (conveyor). Without creating different layers and tilemaps for each type of tile how can I do it? Any help would be appreciated. Cheers, Jim

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use Array for all your data values (tiles numbers, positions, etc) and then simply fill tilemap with data from array.

  • Hi, the map(s) or more accurately each level has already been done in Tiled as I was trying to use a cocos2d based engine but found learning C# to time consuming for now so hoped C2 would work. I am not understanding exactly what you are meaning re filling tilemap with data (unless you mean whats in the tmx files already?) What I am wanting to do is if the player walks on the conveyor block it moves him left/right or if he touches the ladder block in the tileset he starts to move up etc. Does that make sense? I just tried to create it via a sprite but alignment is a nightmare and creating 20+ sprites for just the conveyor blocks seems wasteful? I am sure I am missing something

  • You can compare what Tile ID is currently in collision with Sprite. So if Sprite is in collision/overlapping tileID=6 (ladder for example) -> do some stuff with sprite

  • Why the opposition to different tilemaps?

    I am guessing your mentality behind that is to avoid a mess in the editor?

    If so, make one tilemap who's only purpose is for editing, and how ever many tilemaps you need for your different tile types. Then on the start of the layout, loop through editor tilemap and use that to populate the secondary tilemaps.

    I am using this approach currently in a game that I am making.

    [attachment=0:3vrhhpyl][/attachment:3vrhhpyl]

    I have a static tilemap size that I am using, but if you need it to be dynamic, simply replace the the limits in the for loops to tilemap.width % [tilesize] and it should automatically cover the full tilemap.

  • You can compare what Tile ID is currently in collision with Sprite. So if Sprite is in collision/overlapping tileID=6 (ladder for example) -> do some stuff with sprite

    Thanks for the replies. Re above, that is pretty much exactly what I am wanting to do but simply do not know using Construct how I go about doing it? Eg How do I 'test which block the sprite is standing on' for example? Where is the option for me to access those kind of things which is basically how I did it on the Memotech and others all those years ago.

    Re having more than one tilemap. I was just thinking that if it is not possible to check what tile I am on (have not found out how to as said above as yet) then having different maps would allow for this perhaps but I would much prefer the simple option of creating an action based on what tile I am on so I can then have specific actions for Ladder,Spike,Key etc.

    Hope I am making myself clear as is it not always easy to write down things. Jim

  • Ok, I have spent pretty much the whole evening going through the search/topics and manual and cannot find anywhere that refers to how I can detect which block in a tileset my player is standing on at any one time? I am sure it must be possible but so far I cannot find out how and none of the options in any of the menu's are specific to this task that I can see so need someone who has done this before to help me please? Pulling my hair out at now with it cos it must be simple...

  • This should help.

  • Here's an example of getting the tile information around the player in a platform game.

    [attachment=0:1odsqu5f][/attachment:1odsqu5f]

  • Cheers guys, will take a look at them and see how I can adapt them to my game. VERY much appreciated...

  • Fantastic and many thanks again.I have managed to rip the code from the example and modify mine and eventually once I realised I had changed the point of origin to the bottom of the player and removed the +32 from the Y position it worked perfect. Yay. Gonna have a break from it now and carry on tomorrow. Great support and thanks again. Jim

  • I carried on messing with my example and added very basic platform logic to the tile checking.

    Added a spring - Up arrow on tilemap

    Added conveyor left & right - left & right arrow on tilemap (this needs a bit more thought to it to make it work correctly i.e you stop before falling off the edge due to tile checks)

    [attachment=0:2q1licm5][/attachment:2q1licm5]

  • Thats great and helps to show me how you add this type of thing to a game as I was confused on how to apply these type of checks in Construct. I am now trying to figure out if it is possible to have some tiles as solid and some as 'walk through' in the same tilemap? I am guessing I will have to check what time is to my left or right and then do an action to let it walk through somehow?

    Anyway the demo you did has been a great help and much appreciated.

    The conveyor blocks I only just noticed doh! Another major help and looking at the code fairly simple to implement so a ladder type one could be similar in principle.

  • Got conveyor block to work, yay!

  • Not sure if I need to do a different post for this question as it may help others looking for a similar solution but I am now faced with a tilemap where some of the blocks are solid and some are walkthrough. I have read the properties and info re 'solid' and it seems I cannot do it with a single tilemap as there is a danger of the player getting stuck in a block so my thinking is that I will need to create another map of the same dimensions with its own blocks that are all walkthrough and then compare where the player is at on both the solid and non solid tilemaps to ensure I do the correct action.

    EG: I have a ladder block, I have already made it so that the player when standing on it will move up automatically but of course the block is solid so I cannot walk into the block which is what I need. If I want to do this behaviour will I need more than one tilemap and is it possible to have more than one on the same level?

    Hope that makes sense, if not then I might be able to upload the game so you can see exactly what I am trying to do.

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