-Treballant en l'edicio de items, pero els GIFs están donant pel cul

This commit is contained in:
2025-11-13 17:44:56 +01:00
parent cf103dd02c
commit 67192623fe
8 changed files with 29 additions and 15 deletions

View File

@@ -74,10 +74,11 @@ editor = {
else
if mouse.press(mouse.LEFT) then
if editor.item_selected then
surf.target(rooms.surf_items)
surf.pixel(tx,ty,editor.item_selected)
map.surf(rooms.surf_items)
--print(editor.item_selected)
map.tile(tx,ty,editor.item_selected)
editor.modified = true
surf.target(0)
--surf.target(0)
end
end
if mouse.press(mouse.RIGHT) then

View File

@@ -31,6 +31,7 @@ game = {
game.chg_step = 8
sprites.pause_ia = true
-- [TODO] Crear els sprites per als items de l'habitació a la que entrem
sprites.add_from_room()
app.push(game.update_change_room)
end,

View File

@@ -8,8 +8,9 @@ function reload_textures()
if surf_sprites then surf.free(surf_sprites) end
surf_sprites = surf.load("sprites.gif")
if surf_tiles then surf.free(surf_tiles) end
surf_tiles = surf.load("tiles.gif")
surf_tiles = surf.load("test.gif")
surf.save(surf_tiles, "data/test2.gif",pal.load("test.gif"))
sys.quit()
pal.set(pal.load("tiles.gif"))
end
@@ -17,12 +18,13 @@ function mini.init()
reload_textures()
pal.trans(0)
rooms.init()
shader.init("lynx.glsl")
editor.enable()
--rooms.init()
--shader.init("lynx.glsl")
--editor.enable()
end
function mini.update()
app.update()
sys.quit()
end

View File

@@ -6,6 +6,7 @@ LAYER_ITEMS = 4
LAYER_SPRITES = 8
LAYER_SHADOWS = 16
LAYER_ALL = 31
ROOM_FILE_EXT = ".gif"
rooms = {
surf_background = nil,
@@ -22,15 +23,15 @@ rooms = {
init = function()
rooms.pos.x, rooms.pos.y = 0,4*12
if rooms.surf_background ~= nil then surf.free(rooms.surf_background) end
rooms.surf_background = surf.load("rooms_background.bin")
rooms.surf_background = surf.load("rooms_background"..ROOM_FILE_EXT)
--rooms.surf_background = surf.new(20*8,12*8)
if rooms.surf_foreground ~= nil then surf.free(rooms.surf_foreground) end
rooms.surf_foreground = surf.load("rooms_foreground.bin")
rooms.surf_foreground = surf.load("rooms_foreground"..ROOM_FILE_EXT)
--rooms.surf_foreground = surf.new(20*8,12*8)
if rooms.surf_items ~= nil then surf.free(rooms.surf_items) end
rooms.surf_items = surf.load("rooms_items.bin")
rooms.surf_items = surf.load("rooms_items"..ROOM_FILE_EXT)
--rooms.surf_items = surf.new(20*8,12*8)
rooms.surf_original_items = surf.new(20*8,12*8)
@@ -55,9 +56,10 @@ rooms = {
end,
save = function()
surf.save(rooms.surf_background, "data/rooms_background.bin")
surf.save(rooms.surf_foreground, "data/rooms_foreground.bin")
surf.save(rooms.surf_items, "data/rooms_items.bin")
local p = pal.load("tiles.gif")
surf.save(rooms.surf_background, "data/rooms_background"..ROOM_FILE_EXT, p)
surf.save(rooms.surf_foreground, "data/rooms_foreground"..ROOM_FILE_EXT, p)
surf.save(rooms.surf_items, "data/rooms_items"..ROOM_FILE_EXT, p)
editor.modified = false
end,

BIN
data/rooms_background.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
data/rooms_foreground.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

BIN
data/rooms_items.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View File

@@ -26,7 +26,15 @@ sprites = {
end,
add_from_room = function()
map.surf(rooms.surf_items)
for y = rooms.pos.y, rooms.pos.y+19 do
for x = rooms.pos.x, rooms.pos.x+11 do
--if surf.pixel(x,y) ~= 0 then
io.write(map.tile(x,y)..",")
--end
end
io.write("\n")
end
end,
init = function()