-
What do you want to achieve?
A NES tile system like, well the NES. -
What is the issue?
My issue is that the tiles are not being added to the tile ROM even thou I calltable.insert()on the tile table (on a module script) it isn’t adding anything -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tried changing values, printing for debbuging and other things like that,
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The server loads tiles into the players POV by passing it through replicated storage, this works, the tile data is on a module script inside Replicated storage too, only accesed by client, coloring of tiles work, but the tile’s data isnt added to the tile data table (or what seems like it)
EXAMPLE OF WHAT A TILE SHOULD LOOK LIKE!
0: the darkest color in the pallet
1: middle color on the pallet
2: lightest color on the pallet
3: background color (one color only)
pallets work fine! Just rendering the tiles is wrong (the colors load just the black and white
[1] = {
2,1,0,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,0,3,3,
3,3,1,3,3,3,3,3,
3,3,2,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,0,3,3,3,3,3,0,
3,3,3,3,0,3,3,3,
}
HERES WHAT MODULE CONTAINING THE TILE DATA LOOKS LIKE
local charRom = {}
local bgTileTable = {
--[[
[999] = { -- blank tile
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
},
]]
}
local spriteTable = {
}
function charRom.addTileData(info) -- what i dont understand, because its printing but nothing gets added?
print(info)
table.insert(bgTileTable,info)
end
function charRom.getSpecificBgTileByIndx(indx)
return bgTileTable[indx]
end
function charRom.getBgRomData()
return bgTileTable
end
function charRom.getSpecificSpriteData()
-- to be worked on!
end
function charRom.getSpriteRomData()
-- to be worked on!
end
return charRom
*** HERE IS THE TILE PIXELART EDITOR LOOKS LIKE (drawing works and the info is correct) but doesnt seem to be added to the tile table ;/ ***
local selClr = 3
local tileDrawArea = script.Parent.tileDrawArea
local pxSize = 40
local pxX = 0
local pxY = 0
local RAM = require(game.ReplicatedStorage.RAM)
local charROM = require(game.ReplicatedStorage.charROM)
local colors = require(game.ReplicatedStorage.nesColors)
local grayScaleIndex = {
Color3.fromRGB(0, 0, 0), -- 1
Color3.fromRGB(68, 68, 68), -- 2
Color3.fromRGB(118, 118, 118), -- 3
Color3.fromRGB(255, 255, 255) -- 4 (background)
}
local pxIndex = 0
for i=1,8 do
for ii=1,8 do
pxIndex += 1
local pixelBtn = Instance.new("TextButton",tileDrawArea.tileStart)
pixelBtn.Text = ""
pixelBtn.Position = UDim2.new(0,pxX * pxSize,0,pxY * pxSize)
pixelBtn.Size = UDim2.new(0,pxSize,0,pxSize)
pixelBtn.BorderSizePixel = 0
pixelBtn.BackgroundColor3 = Color3.fromRGB(255,255,255)
pixelBtn.Name = tostring(pxIndex)
pxX += 1
pixelBtn:SetAttribute("palletIndx",3)
pixelBtn.MouseButton1Click:Connect(function()
script.paint:Play()
pixelBtn:SetAttribute("palletIndx",selClr)
pixelBtn.BackgroundColor3 = grayScaleIndex[selClr+1] -- finds right color on list
end)
end
pxX = 0
pxY += 1
end
pxIndex = 0
for i,v in pairs(grayScaleIndex) do
local pallOpt = script.palletOption:Clone()
pallOpt.main.clrBtn.BackgroundColor3 = v
pallOpt.main.palletClrLabel.Text = pallOpt.main.palletClrLabel.Text .. tostring(i - 1)
pallOpt.main.clrBtn.MouseButton1Click:Connect(function()
selClr = i - 1
end)
pallOpt.Parent = script.Parent.tileDrawArea.clrOptions
end
script.Parent.tileDrawToggle.MouseButton1Click:Connect(function()
script.Parent.tileDrawArea.Visible = not script.Parent.tileDrawArea.Visible
script.Parent.Parent.mainScreen.Enabled = not script.Parent.Parent.mainScreen.Enabled
end)
script.Parent.addTileBtn.MouseButton1Click:Connect(function()
local newTileData = {}
local tileSrtr = script.Parent.tileDrawArea.tileStart
for i=1,64 do
local v = tileSrtr:FindFirstChild(tostring(i))
if v:IsA("TextButton") then
if v:GetAttribute("palletIndx") then
table.insert(newTileData,v:GetAttribute("palletIndx"))
end
end
end
if #newTileData == 64 then
charROM.addTileData(newTileData)
else
warn("Failed to pack data into charROM!",newTileData)
end
end)
From what i could gather, the tile info goes to the function (because the print works) but it doesnt get added to the list?
all of the functions are called by the client btw!
Please, if you need any more info, tell me. Im soo confused cuz it used to work perfectly
( with a offset )