Skip to content

Commit

Permalink
aligned mouse and sprite coordinate planes
Browse files Browse the repository at this point in the history
  • Loading branch information
Retrisma committed Oct 7, 2023
1 parent 1f01b74 commit 39fedfc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function updatemouse()
--mouse.x = mouse.x - camera.fx * window.scale * -1
--mouse.y = mouse.y - camera.fy * window.scale * -1

mouse.x = mouse.x + camera.fx
mouse.x = mouse.y + camera.fy
mouse.x = (mouse.x / window.scale) + camera.fx
mouse.y = (mouse.y / window.scale) + camera.fy

mouse.p = false

Expand Down
4 changes: 2 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function love.update(dt)
debug.my = mouse.y
debug.px = player.x
debug.py = player.y
debug.cx = camera.x
debug.cy = camera.y
debug.cx = camera.fx
debug.cy = camera.fy

--update all sprites
for _,v in pairs(p) do
Expand Down
2 changes: 1 addition & 1 deletion sprite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function AnimatedSprite:drawselfanim()
love.graphics.draw(
self.anim.image, self.anim.quads[self.frame],
self.x + xoff, self.y, self.r,
(self.flipped and -1 or (not self.flipped and 1))
(self.flipped and -1 or (not self.flipped and 1)), 1
)
end
end
Expand Down

0 comments on commit 39fedfc

Please sign in to comment.