GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Binding Actors To Grid Help!

I was messing around with a game design similar to terraria/minecraft and I found a template that used the following:
For Each block:
Change Attribute: Self.Position.x to (floor(Self.Position.x/64)64)+32
Change Attribute: Self.Position.y to (floor(Self.Position.y/64)
64)+32
Essentially, that would allow me, to place an actor on screen and the actor would always snap to a grid 64x64. Now, if you know about the game Clash of Clans, they use a 3d layout, it binds buildings to a grid similar to my game, except 3d, is there a variation of the "Change attribute" example I gave that could allow me to bind buildings to a grid similar to Clash of Clans? If It depends on the buildings size, for this example, lets say this building takes up a 1x1 square.

Comments

  • SikkJewFroSikkJewFro Posts: 75Member

    http://tinypic.com/r/18bqja/8

    See, the formula would bind each block_Wall actor to the center of those squares, but how can I get them to bind to how the look in the image? I would need a different formula right? If so, can anyone tell me what that might be? (The actors in my game will most likely be 64x64 3d images like the boxes in the picture)

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    edited September 2014

    In that case you do your art in a 3d type angle and use the same grid or make the grid match the size of the objects. The grid will always be a grid as it is 2d. You fool the eye with the art.

    Also just change the values of the grid to make it any size you want.

  • SikkJewFroSikkJewFro Posts: 75Member

    Aha! Just had to half the formula instead of using "/64)64)+32" I used "/32)32)+16" Derp! :)

Sign In or Register to comment.