[WIP] Més tiles

[WIP] Fase 2
[NEW] En l'editor, es pot moure per la fase amb SPACE+ratolí
[WIP] mòdul GAME
[WIP] mòdul BATMAN
[NEW] F4 recarrega les textures
This commit is contained in:
2025-11-06 17:29:44 +01:00
parent fc99ad06a4
commit cc2f1803a4
8 changed files with 128 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
editor = {
num = 1,
map_surf = {nil,nil},
@@ -5,6 +6,8 @@ editor = {
current_tile = 1,
ox = 0,
oy = 0,
mx = 0,
my = 0,
init = function(level_name)
game_update = editor.update
@@ -63,13 +66,19 @@ editor = {
view.origin(editor.ox,editor.oy)
surf.cls(66)
pal.trans(0)
surf.source(tiles)
map.surf(editor.map_surf[1])
map.draw()
--batman.draw()
surf.source(tiles)
map.surf(editor.map_surf[2])
map.draw()
map.surf(editor.map_surf[editor.current_layer])
local mx,my = mouse.pos()
local tx = (mx//8)*8
local ty = (my//8)*8
@@ -106,6 +115,20 @@ editor = {
end
view.origin(0,0)
draw.text(tostring(mx//8)..","..tostring(my//8),50,0,22)
mx,my = mouse.pos()
if key.down(key.SPACE) then
if editor.mx == -1 then
editor.mx,editor.my = mx,my
end
editor.ox = editor.ox + 8*(mx-editor.mx)
editor.oy = editor.oy + 8*(my-editor.my)
editor.mx,editor.my = mx,my
else
editor.mx = -1
end
text(tostring(editor.current_layer),0,0,22,42)
end,