diff --git a/data/scripts/entities/player.lua b/data/scripts/entities/player.lua index 2e92bda..177e503 100644 --- a/data/scripts/entities/player.lua +++ b/data/scripts/entities/player.lua @@ -65,27 +65,14 @@ end function Player:Smart() - -- light - self.light.pos.x = self.pos.x-self.target_offset.x - self.light.pos.y = self.pos.y-self.target_offset.y + self:LightAdjust(-self.target_offset.x,-self.target_offset.y) if self.dashTimer <= 0 then - if self.isOnGround then - self.vel.x = self.vel.x * (1-self.groundFriction) - else - self.vel.x = self.vel.x * (1-self.airFriction) - end - - if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end - if Keybind:CheckDown(Keybind.move.left) then self.move_x = -self.moveSpeed elseif Keybind:CheckDown(Keybind.move.right) then self.move_x = self.moveSpeed - else - self.move_x = 0 end - self.vel.x = self.vel.x if Keybind:CheckDown(Keybind.move.jump) then if self.coyoteValue > 0 then @@ -128,6 +115,14 @@ function Player:Smart() end function Player:DoPhysics() + if self.dashTimer <= 0 then + if self.isOnGround then + self.vel.x = self.vel.x * (1-self.groundFriction) + else + self.vel.x = self.vel.x * (1-self.airFriction) + end + if math.abs(self.vel.x) < self.zeroSpeed then self.vel.x = 0 end + end -- reset state self.isOnGround = false -- adjust timers @@ -202,4 +197,5 @@ function Player:HandleAnimation() if self.dashCount > 0 then self:Draw(self.mask) end + self.move_x = 0 end diff --git a/data/scripts/entity.lua b/data/scripts/entity.lua index abc171b..9d68d9a 100644 --- a/data/scripts/entity.lua +++ b/data/scripts/entity.lua @@ -49,8 +49,10 @@ function Entity:CollisionMove() end end -function Entity:LightAdjust() +function Entity:LightAdjust(x,y) if self.light ~= nil then + local x = x or 0 + local y = y or 0 self.light.pos.x = self.pos.x self.light.pos.y = self.pos.y end diff --git a/data/scripts/game.lua b/data/scripts/game.lua index 5c60149..0b2aadd 100644 --- a/data/scripts/game.lua +++ b/data/scripts/game.lua @@ -2,17 +2,23 @@ function GameStep() if menu_type == "no" then for _, particle in pairs(LoadedParticles) do particle:Smart() - particle:DoPhysics() end for _, enty in pairs(LoadedEntities) do enty:Smart() - enty:DoPhysics() end - AnimateTiles() - Camera:positionCenterAt(main_Player.pos.x, main_Player.pos.y) - --camera:positionAt(main_Player.pos.x, main_Player.pos.y,game.width,game.height) end + for _, particle in pairs(LoadedParticles) do + particle:DoPhysics() + end + for _, enty in pairs(LoadedEntities) do + enty:DoPhysics() + end + + AnimateTiles() + Camera:positionCenterAt(main_Player.pos.x, main_Player.pos.y) + --camera:positionAt(main_Player.pos.x, main_Player.pos.y,game.width,game.height) + if Keybind:HasPressed(Keybind.debug.debug) then if debug then debug = false diff --git a/main.lua b/main.lua index b979e84..81811c9 100644 --- a/main.lua +++ b/main.lua @@ -43,7 +43,7 @@ function love.load() LoadedParticles = {} LevelLoadTiles() - language = "HEON" + language = "ENG" LocaleLoad(language) main_Player = Player:New(75,50)