Attempting a tile based game...

0 favourites
  • 6 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • I'm doing a top down RPG sandbox game, and wanted a little direction before getting too deep.

    I would like each part of the ground (a solid color) to be able to be set to other things. Would Tilemap be the best bet for this method? As in making one tilemap with all the possibilities that it could change into. For example, when hoeing, change it to the sprite of the a dug out hole or the start of a garden. Would this be the best method?

  • In short yes I would think so

    However when using tilemaps you have to take into account if things you want to add are bigger than the tile size, then it can start to become a bit difficult, as you would have to split the objects up in several tiles and make sure that they are loaded correctly. Meaning that they doesn't suddenly overlap other objects that they shouldn't. However if you plan on making a big game, then I would go for it anyway. If you plan on the player not being able to do a lot of things at the same time, for instant dig 1000 holes in the ground, then a mixture might be easier. So the background is a tilemap, but holes etc are just sprites added on top.

  • Yeah, I just want to make sure everything lines up properly. I was thinking I should find a way to determine which 32x32 square my character is standing in, that way I can specify where to place the "changed" block. I might find myself with 32x32 background tiles, and change them as the player uses said tile.

    I'm open to other options, too. I'm not wanting to get too complicated, as I like clean code.

  • Yeah, I just want to make sure everything lines up properly. I was thinking I should find a way to determine which 32x32 square my character is standing in, that way I can specify where to place the "changed" block. I might find myself with 32x32 background tiles, and change them as the player uses said tile.

    I'm open to other options, too. I'm not wanting to get too complicated, as I like clean code.

    Lucky its fairly easy to work with tilemap, here are some tips to get you started

    First thing is to keep track of tiles, since C2 doesn't show the tiles for you, adding a functionality that will always show this based on the mouse position is very helpful (The purple square is the mouse position). And in a lot of cases when working with tilemaps I personally find it a lot easier to work with the tile index rather than X,Y coordinates as it can be difficult to see what tile you are working with. So storing the converted mouse X,Y position in a variable can be useful, I would normally store these in a Game_controller sprite rather than as global variables, but either way will work. Storing these values can make it easier if you need to select tiles, as in the second event I use these variable to set the target tile for the green sprite or if you imagine that you want to check if there is a certain thing on a given tile.

    In the last event I store the units position in two variables.

    Tile_X and Tile_Y and you just have to make sure that these are always kept up to date and then you can use these whenever you need to check if a unit might be overlapping something on a tile etc.

    And I would add such conversion to all objects in your game, so you can just do a Object1.Tile_X = Object2.Tile_X and so on.

  • Hey the one for tracking works great for what I'm doing! Thank you! Good thing I have only a few things going right now, it will be easy to implement. BTW: you're saying each object I make, I should have a variable defining its location? This makes sense, because I'm using UO as my base idea, and each item in the game has TONS of properties. I don't intend on making it as complicated but I'm trying at least for detail. So this method makes sense in that aspect.

    EDIT! I need to know something! If I'm comparing a tile, how do I compare it to "empty"? I read in one thread the tilemap is considered empty, so comparing it to "0" will assume the first tile in the tilemap, but not as an empty space.

    Edit 2: I just used "-1" as my variable and it worked!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Yeah, I just want to make sure everything lines up properly. I was thinking I should find a way to determine which 32x32 square my character is standing in, that way I can specify where to place the "changed" block. I might find myself with 32x32 background tiles, and change them as the player uses said tile.

    >

    > I'm open to other options, too. I'm not wanting to get too complicated, as I like clean code.

    >

    Lucky its fairly easy to work with tilemap, here are some tips to get you started

    First thing is to keep track of tiles, since C2 doesn't show the tiles for you, adding a functionality that will always show this based on the mouse position is very helpful (The purple square is the mouse position). And in a lot of cases when working with tilemaps I personally find it a lot easier to work with the tile index rather than X,Y coordinates as it can be difficult to see what tile you are working with. So storing the converted mouse X,Y position in a variable can be useful, I would normally store these in a Game_controller sprite rather than as global variables, but either way will work. Storing these values can make it easier if you need to select tiles, as in the second event I use these variable to set the target tile for the green sprite or if you imagine that you want to check if there is a certain thing on a given tile.

    In the last event I store the units position in two variables.

    Tile_X and Tile_Y and you just have to make sure that these are always kept up to date and then you can use these whenever you need to check if a unit might be overlapping something on a tile etc.

    And I would add such conversion to all objects in your game, so you can just do a Object1.Tile_X = Object2.Tile_X and so on.

    nimos100 Thanks for the help. I keep looking for My Little Golden Book of Tilemaps and this fills in one page. Yay!

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