First commit
This commit is contained in:
parent
f2e227dd35
commit
a469153f3a
|
@ -2,6 +2,9 @@
|
|||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
img/*
|
||||
img
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
|
@ -39,5 +42,3 @@ luac.out
|
|||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
function love.conf(t)
|
||||
package.path = package.path..";./?.lua"
|
||||
GAME_WIDTH = 512
|
||||
GAME_HEIGHT = 288
|
||||
scale = 2 --scale multiplier
|
||||
t.version = "11.3"
|
||||
t.window.width = GAME_WIDTH * scale
|
||||
t.window.height = GAME_HEIGHT * scale
|
||||
t.modules.joystick = false
|
||||
t.modules.physics = false
|
||||
t.modules.touch = false
|
||||
t.modules.accelerometerjoystick = false
|
||||
t.identity = "up_editor"
|
||||
t.window.title = "UP editor"
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
function love.draw()
|
||||
if tiles [selected_tile].texture then
|
||||
love.graphics.draw(tiles[selected_tile].texture, 0, 0)
|
||||
end
|
||||
for i = 1, SCREEN_LEN, 1 do
|
||||
end
|
||||
end
|
|
@ -0,0 +1,46 @@
|
|||
function update_keyboard()
|
||||
--get keys inputs
|
||||
--debug key
|
||||
if love.keyboard.isDown("d") then debug.debug() end
|
||||
--mute
|
||||
local buffer = k_m
|
||||
k_m = love.keyboard.isDown("m")
|
||||
if k_m and not buffer then sfx = not sfx end
|
||||
--swap selected object
|
||||
local buffer = k_tab
|
||||
k_tab = love.keyboard.isScancodeDown("tab")
|
||||
if k_tab and not buffer then
|
||||
if love.keyboard.isDown("lshift") then
|
||||
selected_tile = selected_tile - 1
|
||||
if selected_tile == 0 then selected_tile = #tiles end
|
||||
else selected_tile = selected_tile + 1
|
||||
if selected_tile > #tiles then selected_tile = 1 end
|
||||
end
|
||||
end
|
||||
--exit
|
||||
if love.keyboard.isScancodeDown("escape") then
|
||||
love.event.quit()
|
||||
end
|
||||
--saving/export
|
||||
local buffer = k_s
|
||||
k_s = love.keyboard.isDown("s")
|
||||
if k_s and not buffer then
|
||||
end
|
||||
local buffer = k_o
|
||||
k_o = love.keyboard.isDown("o")
|
||||
if k_o and not buffer then
|
||||
end
|
||||
--scaling
|
||||
local buffer = k_k
|
||||
k_k = love.keyboard.isDown("k")
|
||||
if k_k and not buffer and scale > 1 then
|
||||
scale = scale - 1
|
||||
love.window.setMode(GAME_WIDTH * scale, GAME_HEIGHT * scale, flags)
|
||||
end
|
||||
local buffer = k_l
|
||||
k_l = love.keyboard.isDown("l")
|
||||
if k_l and not buffer and scale < 8 then
|
||||
scale = scale + 1
|
||||
love.window.setMode(GAME_WIDTH * scale, GAME_HEIGHT * scale, flags)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
--scaling settings
|
||||
love.graphics.setDefaultFilter("nearest", "nearest")
|
||||
|
||||
selected_screen = "000000000000000000000000000000000000000000000000000000......................0000......................0000......................0000......................0000......................0000......................0000......................0000......................0000......................0000......................0000......................000000000000000000000000000000000000000000000000000000"
|
||||
SCREEN_LEN = 390
|
||||
path = "../platformer/"
|
|
@ -0,0 +1,8 @@
|
|||
function love.load()
|
||||
require("load")
|
||||
require("update")
|
||||
require("draw")
|
||||
require("mouse")
|
||||
require("keyboard")
|
||||
require("tiles")
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
function update_mouse()
|
||||
mouse_x, mouse_y = love.mouse.getX(), love.mouse.getY() --mouse position
|
||||
mouse_x = math.floor(mouse_x / scale)
|
||||
mouse_y = math.floor(mouse_y / scale)
|
||||
clip_mouse_x = mouse_x - mouse_x % grid_spacing
|
||||
clip_mouse_y = mouse_y - mouse_y % grid_spacing
|
||||
--edition mode
|
||||
mouse_mode = 0
|
||||
if (clip_mouse_x >= bounds.min_x) and (clip_mouse_x <= bounds.max_x) and
|
||||
(clip_mouse_y >= bounds.min_y) and (clip_mouse_y <= bounds.max_y) then
|
||||
if love.mouse.isDown(1) then
|
||||
mouse_mode = 1
|
||||
elseif love.mouse.isDown(2) then
|
||||
mouse_mode = -1
|
||||
end
|
||||
end
|
||||
if mouse_mode == 0 then buffer_x, buffer_y = 0, 0 end
|
||||
--add to layer if
|
||||
if mouse_mode == 1 and (clip_mouse_x ~= buffer_x or clip_mouse_y ~= buffer_y) then
|
||||
add_to_layer(layer_selected)
|
||||
if sfx then s_place:stop() s_place:play() end
|
||||
buffer_x = clip_mouse_x
|
||||
buffer_y = clip_mouse_y
|
||||
end
|
||||
--delete of layer if
|
||||
if mouse_mode == -1 and (clip_mouse_x ~= buffer_x or clip_mouse_y ~= buffer_y) then
|
||||
rem_of_layer(layer_selected)
|
||||
buffer_x = clip_mouse_x
|
||||
buffer_y = clip_mouse_y
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
local img_path = "img/"
|
||||
|
||||
tiles = {
|
||||
{id = '0', texture = love.graphics.newImage(img_path.."ground.png")},
|
||||
{id = '^', texture = love.graphics.newImage(img_path.."elevator1.png")},
|
||||
{id = '.', texture = nil},
|
||||
}
|
||||
|
||||
selected_tile = 1
|
|
@ -0,0 +1,3 @@
|
|||
function love.update(dt)
|
||||
update_keyboard()
|
||||
end
|
Loading…
Reference in New Issue