I used emthree to build a prototype, but realized that I was going in the wrong direction, then I tried to build the grid of the playing field using tilemap, but I ran into the fact that I didn’t understand how to spawn objects in tiles, and also so that they were of different lengths.
Here is my code for building a board:
local emthree = require "emthree.emthree"
local blocksize = 64
local boardwidth = 8
local boardheight = 10
local function create_block(board, position)
local id = factory.create("/spawner#block_spawner", position)
msg.post(id, "set_parent", { parent_id = go.get_id(), keep_world_transform = 0 })
return id
end
local function init_board(self)
self.board = emthree.create_board(boardwidth, boardheight, blocksize, { direction = emthree.COLLAPSE_DOWN })
emthree.on_create_block(self.board, create_block)
for x = 0, self.board.width - 1 do
for y = 0, self.board.height - 1 do
if not self.board.slots[x][y] then
emthree.create_block(self.board, x, y)
end
end
end
end
function init(self)
init_board(self)
end
Then I tried to spawn objects on top of the created board, but that didn’t work either
I want to make a similar game and practice in this genre, which way should I look? I’m more interested in the approach of constructing such logic: a grid, randomly spawning objects, and not complete filling as in match-3.
In the game, an object spawns from below and lifts all the blocks up, I also wonder if there should be blocks. Then I tried to spawn objects on top of the created board, but that didn’t help either.
I want to make a similar game and practice in this genre, which direction should I look in? I am more interested in the approach of constructing such logic: grid spawning, randomly spawning objects that move blocks from above, and not completely filling the playing field as in match-3. Do objects have to have a physical body to lift each other up and fall down if there is nothing underneath them?
I am attaching a link to the reference
I really hope for your help, this is the 5th time I’ve tried to do something, but apparently my hands are growing from the wrong place.