Selecting tiles similar to stardew?

0 favourites
  • 8 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • I'm making a farming sim style game similar to stardew valley but I'm having trouble figuring out how to select specific tiles for for example tilling or placing items down. I want to make a grid style system but unsure where to even start. Any tips or ideas? Thanks is advance!

    -JezusOfJordan

  • I envision having a selection square like this that targets a tile in a 32x32 pixel grid in front of the player. just don't know how to make it move around in said grid style.

  • Round positions but instead of rounding to numbers without decimals u divide by like,

    the size of your tiles first, and then you round the number, and then multiply it back by the size of your tile, and u get numbers that jump from tile to tile, like, any number you put into this math will pop out a tile number.

    Math is awesome

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah I'm sure it would be fairly easy with the correct calculation with the proper code but I am just dumbstruck by trying to figure out what the equation and line of code should be lol

  • should be like, selectionbox.x = round( character.x /32) *32 or something

  • and then u use the same math to round coordinates and store a plant's UID inside a dictionary with the rounded X and Y as the key, so like, if you attack a selected ground tile, instead of testing collision against every tile, you can pick by the uid dictionary.at(rounded x & " " & rounded y) and if you stored the UID there properly in the code when you plant something then u can harvest it with good performance

  • omg you're awesome.it may need a little tweaking but it is now moving with the character and popping to the tile locations! thanks so much!

  • You got it?

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