please begone
This commit is contained in:
parent
4f6d0890e3
commit
7ca46a9a01
|
@ -1,89 +0,0 @@
|
||||||
From 1d8685c91e64daedfef9607ec122c3de05be36e5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: binarycat <binarycat64@protonmail.com>
|
|
||||||
Date: Sat, 26 Feb 2022 15:12:25 -0500
|
|
||||||
Subject: [PATCH] walljumps
|
|
||||||
|
|
||||||
---
|
|
||||||
code/debug.lua | 1 +
|
|
||||||
code/entities/player.lua | 12 ++++++++++++
|
|
||||||
code/entity.lua | 3 ++-
|
|
||||||
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/code/debug.lua b/code/debug.lua
|
|
||||||
index 5a9e094..68c61cf 100644
|
|
||||||
--- a/code/debug.lua
|
|
||||||
+++ b/code/debug.lua
|
|
||||||
@@ -22,6 +22,7 @@ function DebugUI()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- player isOnGroundCheck
|
|
||||||
+ --love.graphics.main_Player
|
|
||||||
love.graphics.setColor(1,0,0)
|
|
||||||
end
|
|
||||||
|
|
||||||
diff --git a/code/entities/player.lua b/code/entities/player.lua
|
|
||||||
index ea2d811..824cc25 100644
|
|
||||||
--- a/code/entities/player.lua
|
|
||||||
+++ b/code/entities/player.lua
|
|
||||||
@@ -14,6 +14,8 @@ function Player:New(x,y)
|
|
||||||
|
|
||||||
o.jumpImpulse = 3.5 -- gameworld pixels
|
|
||||||
|
|
||||||
+ self.wallJumpImpulse = { x = 2.5, y = 3.5 }
|
|
||||||
+
|
|
||||||
o.coyoteAmount = 5 -- int
|
|
||||||
o.coyoteValue = 5 -- frames
|
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ function Player:New(x,y)
|
|
||||||
o.canFall = true
|
|
||||||
o.canFriction = true
|
|
||||||
o.maskType = animation.moth_mask
|
|
||||||
+ o.wallHit = 0
|
|
||||||
|
|
||||||
o.anchorRespawn = {
|
|
||||||
x = o.pos.x,
|
|
||||||
@@ -93,6 +96,9 @@ function Player:Smart()
|
|
||||||
if self.coyoteValue > 0 then
|
|
||||||
self.vel.y = -self.jumpImpulse
|
|
||||||
self.coyoteValue = 0
|
|
||||||
+ elseif self.wallHit ~= 0 then
|
|
||||||
+ self.vel.y = -self.wallJumpImpulse.y
|
|
||||||
+ self.vel.x = -self.wallJumpImpulse.x * self.wallHit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -233,7 +239,9 @@ function Player:DoPhysics()
|
|
||||||
-- horizontal collision
|
|
||||||
if not self:isCollidingAt(self.pos.x + self.vel.x + self.move_x, self.pos.y, LoadedObjects.Collisions) then
|
|
||||||
self.pos.x = self.pos.x + self.vel.x + self.move_x
|
|
||||||
+ self.wallHit = 0
|
|
||||||
else
|
|
||||||
+ self.wallHit = math.sign(self.vel.x + self.move_x)
|
|
||||||
self.vel.x = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
@@ -313,3 +321,7 @@ function Player:Unhook()
|
|
||||||
self.isHooked = false
|
|
||||||
self.hookAnchor = nil
|
|
||||||
end
|
|
||||||
+
|
|
||||||
+function Player:Debug()
|
|
||||||
+ love.graphics.print("wallHit: "..self.wallHit)
|
|
||||||
+end
|
|
||||||
diff --git a/code/entity.lua b/code/entity.lua
|
|
||||||
index 9bb582f..b43df21 100644
|
|
||||||
--- a/code/entity.lua
|
|
||||||
+++ b/code/entity.lua
|
|
||||||
@@ -158,7 +158,8 @@ function Entity:getBoundingBox(animation,top,left,bottom,right)
|
|
||||||
self.boxCollision.to.y = animation.imgs[1]:getHeight()/2 + bottom
|
|
||||||
end
|
|
||||||
|
|
||||||
--- returns true if theres a collision at that point. also marks collisioned tile as collision true
|
|
||||||
+-- checks if the the reciever would collide with an object if it was positioned at the given point.
|
|
||||||
+-- also marks collisioned tile as collision true
|
|
||||||
function Entity:isCollidingAt(x,y,object)
|
|
||||||
for _, collision in pairs(object) do
|
|
||||||
if collision.disable then
|
|
||||||
--
|
|
||||||
2.35.1
|
|
||||||
|
|
Loading…
Reference in New Issue