I'm making a game like Clash of Clans, and I need somewhere to start on the map generating aspect of it. So basically, I have rocks and trees built, they need to be on a grid (of 5 by 5 bricks). I'm just looking for feedback on how I would generate the items on the grid.
I just need some advice on how'd I would do that, I'm not requesting, don't get me wrong, I just need help on how I could make this, all I need is to know how to generate something on a grid.
No, I don't have any example code, as I said I need somewhere to start.
This is interesting idea as I haven't really seen much of this done on roblox my thinking would be is to make a bunch of 5x5 parts and then store their positions within a table
using
table.insert
and then pick a random position from that table to place a tree at btw if you are moving a model doing
local model = game.Lighting.MODELNAME -- this would be a tree or rock local table = {} -- create a empty table local children = workspace:GetChildren() for i = 1, #children do if children[i].Name == node then print(i, children[i].Position) table.insert(children[i].Position) else end local chosenposition = table[math.random(1, #table)] -- pick random position from the table local c = model:Clone() -- copy the model c.Parent = game.Workspace -- move the copied model to the workspace c:Move(vector3.new(chosenposition)) -- move the model to the position of the part table.remove(table, chosenposition)
I think that's roughly how it would work hope it helps :)
Closed as Not Constructive by TheHospitalDev, Azmidium, theCJarmy7, and General_Scripter
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?