cant fix this bug but revamped the debug selected entity screen!

This commit is contained in:
UndeadMaelys 2021-03-22 20:01:53 +01:00
parent a2d71f00cd
commit 051e1a941f
2 changed files with 36 additions and 10 deletions

View File

@ -27,6 +27,10 @@ function love.load()
g3d.camera.zoom = 10 g3d.camera.zoom = 10
speed = 0 speed = 0
-- debug
scroll = 0
debug = false
-- player -- player
player = { player = {
id = 1 id = 1
@ -94,10 +98,14 @@ function love.update(dt)
end end
function love.wheelmoved(_, y) function love.wheelmoved(_, y)
if debug then
scroll = scroll+15*y
else
-- get scroll to do zoom, and call camera update -- get scroll to do zoom, and call camera update
g3d.camera.zoom = math.min(math.max(3,g3d.camera.zoom-y/1.5),30) g3d.camera.zoom = math.min(math.max(3,g3d.camera.zoom-y/1.5),30)
is_scrolling = true is_scrolling = true
end end
end
function love.keypressed(key) function love.keypressed(key)
-- pause the game -- pause the game
@ -181,8 +189,13 @@ function draw_debug()
uc = uc + 1 uc = uc + 1
if entity.model ~= nil then if entity.model ~= nil then
if entity.is_animated and entity.is_selected == true then if entity.is_animated and entity.is_selected == true then
love.graphics.print("["..entity.name.."] frame: "..entity.anim_frame.."/"..entity.anim_frames..", rm: \""..entity.rotate_mode.."\"",20,-20+40*uc) love.graphics.setColor(0,0,0,0.3)
love.graphics.print("["..entity.name.."] animation: "..entity.anim_path,20,40*uc) love.graphics.rectangle("fill",15,-85+80*uc+scroll,game_width-30,70)
love.graphics.setColor(1,1,1)
love.graphics.print("["..u.name..", model: "..entity.name.." (id: "..entity.num..")] (level id: "..entity.tnum..")",20,-80+80*uc+scroll)
love.graphics.print("frame: "..entity.anim_frame.."/"..entity.anim_frames..", rm: \""..entity.rotate_mode.."\"",40,-60+80*uc+scroll)
love.graphics.print("animation: "..entity.anim_path,40,-40+80*uc+scroll)
end end
end end
end end end end

View File

@ -4,7 +4,7 @@ levels.main_menu = {
entities = {}, entities = {},
units = {} units = {}
} }
total_model_count = 0
local entities = levels.main_menu.entities local entities = levels.main_menu.entities
local units = levels.main_menu.units local units = levels.main_menu.units
@ -24,12 +24,21 @@ end end
math.randomseed(3) math.randomseed(3)
-- bunch of implings (40) -- bunch of implings (40)
local nu = Unit:newUnit("Ariel Army",player.id,portrait._ariel,statTable.implings) local nu = Unit:newUnit("Succubi Army",player.id,portrait._ariel,statTable.implings)
local xx, yy, zz = 3, 0, 0 local xx, yy, zz = 3, 0, 0
local model_count = 0
for i = 1, 8, 1 do for j = 1, 5, 1 do for i = 1, 8, 1 do for j = 1, 5, 1 do
local imp = Object:new2DAnimated("implings",portrait._ariel,xx+0.5*(i+1),yy+0,zz+0.5*(j+1),16,16) model_count = model_count + 1
total_model_count = total_model_count + 1
-- create and define
local imp = Object:new2DAnimated("ariel",portrait._ariel,xx+0.5*(i+1),yy+0,zz+0.5*(j+1),16,16)
imp.num = model_count
imp.tnum = total_model_count
load_animation(imp,animation._ariel.idle,4,8) load_animation(imp,animation._ariel.idle,4,8)
-- add to unit
addToUnit(nu,imp) addToUnit(nu,imp)
end end end end
table.insert(units,nu) table.insert(units,nu)
@ -74,11 +83,15 @@ for i = 1, 3, 1 do for j = 1, 2, 1 do
end end end end
table.insert(units,nu)]] table.insert(units,nu)]]
local nu = Unit:newUnit("Azifer",player.id,portrait._yari,statTable.implings) -- create class
-- hero archdemon (1) local nu = Unit:newUnit("Hero Azifer",player.id,portrait._yari,statTable.implings)
local xx, yy, zz = 0, 0, 3
local azifer = Object:new2DAnimated("azifer",portrait._yari,xx,yy,zz,16,16) local xx, yy, zz = 0, 0, 3
-- create and define
local azifer = Object:new2DAnimated("Azifer",portrait._yari,xx,yy,zz,16,16)
azifer.num = 1
total_model_count = total_model_count + 1
azifer.tnum = total_model_count
load_animation(azifer,animation._yari.idle,4,8) load_animation(azifer,animation._yari.idle,4,8)
addToUnit(nu,azifer) addToUnit(nu,azifer)