Fixed bug thing?

This commit is contained in:
lustlion 2022-01-18 20:24:49 +01:00
parent 9307369199
commit d6de26180b
5 changed files with 120 additions and 42 deletions

View File

@ -2,7 +2,7 @@ Arrow = Entity:New(x,y)
function Arrow:New(x,y,rotation,speed) function Arrow:New(x,y,rotation,speed)
local o = Entity:New(x,y) local o = Entity:New(x,y)
arrow = arrow + 1
o.pos = {x = x, y = y} o.pos = {x = x, y = y}
o.speed = speed or 0 o.speed = speed or 0
o.sprite_rotation = rotation or 0 o.sprite_rotation = rotation or 0
@ -32,6 +32,7 @@ function Arrow:HandleAnimation()
end end
function Arrow:DoPhysics() function Arrow:DoPhysics()
if not self.stuck then
-- horizontal collisions -- horizontal collisions
if not isThereAnyCollisionAt( if not isThereAnyCollisionAt(
self.pos.x + self.vel.x, self.pos.x + self.vel.x,
@ -73,4 +74,5 @@ function Arrow:DoPhysics()
self.vel.y = 0 self.vel.y = 0
self.illuminated = false self.illuminated = false
end end
end
end end

View File

@ -69,9 +69,9 @@ function Kupo:Smart()
self.bow_rotation = angle self.bow_rotation = angle
end end
-- holding tight dispersion -- also affets arrows -- holding tight dispersion -- also affects arrows
if self.bow_rotation == angle then if self.bow_rotation == angle then
self.bow_rotation = self.bow_rotation + math.rad(math.random(math.abs(self.bow_frame-self.bow_aim_frames-self.bow_frames)/2)) self.bow_rotation = self.bow_rotation + math.rad(math.random(math.abs(math.floor(self.bow_frame-self.bow_aim_frames-self.bow_frames)/2)))
end end
-- AIMING AI -- AIMING AI

View File

@ -1,5 +1,12 @@
function stepEditor() function stepEditor()
palette = palette or false
AnimateTiles() AnimateTiles()
if love.keyboard.isDown("tab") and not pressed then
if palette then palette = false else palette = true end
local pressed = true
else
pressed = false
end
end end
function stepGame() function stepGame()
@ -28,6 +35,9 @@ function drawEditor()
end end
gameworldDraw() gameworldDraw()
if palette then
paletteDraw()
end
end end
function drawGame() function drawGame()
@ -91,3 +101,66 @@ function gameworldLighting()
love.graphics.scale(1,1) love.graphics.scale(1,1)
DrawDarkness() DrawDarkness()
end end
function paletteDraw()
local width = LevelData.tileset:getPixelWidth()/tileProperties.width
local height = LevelData.tileset:getPixelHeight()/tileProperties.height
local position_x = 1
local position_y = 1
for i = 1, #TileIndex-width-1 do
love.graphics.draw(
LevelData.tileset,
TileIndex[i],
position_x * tileProperties.width*2,
(--[[p_scroll +]]position_y) * tileProperties.height*2,
0,
2,
2
)
position_x = position_x + 1
if position_x > width then
position_x = position_x - width
position_y = position_y + 1
end
end
love.graphics.rectangle(
"line",
tileProperties.width*2,
(--[[p_scroll +]] 1) * tileProperties.height*2,
2*LevelData.tileset:getPixelWidth(),
2*LevelData.tileset:getPixelHeight()
)
end
--[[
function DrawSelectingPaletteTile()
if selecting_tile ~= nil then
local width = TileProperties.tileset:getPixelWidth()/TileProperties.width
local height = TileProperties.tileset:getPixelHeight()/TileProperties.height
local positionx = 1
local positiony = 1
for i = 1, #Tile-12 do
if i == selecting_tile then
love.graphics.rectangle(
"line",
positionx * TileProperties.width*2,
(p_scroll + positiony) * TileProperties.height*2,
TileProperties.width*2-1,
TileProperties.height*2-1
)
end
positionx = positionx + 1
if positionx > width then
positionx = positionx - width
positiony = positiony + 1
end
end
end
end]]

View File

@ -19,6 +19,7 @@ function CreateLight(x,y,range,lum,flicker)
o.flicker_speed = flicker_speed or 60/12 o.flicker_speed = flicker_speed or 60/12
o.flicker_time = 0 o.flicker_time = 0
table.insert(Lights,o) table.insert(Lights,o)
return o return o
end end

View File

@ -1,4 +1,5 @@
function love.load() function love.load()
arrow = 0
do_pause = false do_pause = false
@ -48,7 +49,7 @@ function love.load()
table.insert(LoadedEntities,Decoration:New(200,89,animation.decoration.candelabra,80)) table.insert(LoadedEntities,Decoration:New(200,89,animation.decoration.candelabra,80))
table.insert(LoadedEntities,Fairy:New(200,88)) table.insert(LoadedEntities,Fairy:New(200,88))
gravity = 0.05 gravity = 0.2
end end
function love.update(dt) function love.update(dt)
@ -75,7 +76,7 @@ end
function love.wheelmoved(_, y) function love.wheelmoved(_, y)
if editor_mode then if editor_mode then
if palette then if palette then
p_scroll = p_scroll + y p_scroll = p_scroll + y or 0
else else
local oscale = game.scale local oscale = game.scale
game.scale = math.max(0.1,game.scale + y/16) game.scale = math.max(0.1,game.scale + y/16)
@ -139,4 +140,5 @@ function love.draw()
else else
drawGame() drawGame()
end end
love.graphics.print(arrow,10,40)
end end