new fps counter

This commit is contained in:
binarycat
2022-02-26 22:45:11 -05:00
committed by lustlion
parent fcac1abef1
commit e3a5ab0c42
5 changed files with 87 additions and 17 deletions

View File

@@ -220,7 +220,8 @@ function Player:DoPhysics()
if self.isHooked then
self.move_x = 0
local hook = Vector(self.pos.x, self.pos.y, self.hookAnchor.x, self.hookAnchor.y)
if GetVectorValue(hook) > self.hookDistance then
local dist = math.min(GetVectorValue(hook), self.hookDistance)
local hook_angle = GetAngleFromVector(hook[1],hook[2])-math.rad(180)
if Keybind:CheckDown(Keybind.move.right) then
@@ -229,6 +230,7 @@ function Player:DoPhysics()
if Keybind:CheckDown(Keybind.move.left) then
hook_angle = hook_angle + self.hookSwingSpeed
end
local particle_data = {
@@ -242,13 +244,12 @@ function Player:DoPhysics()
}
Particle:New(self.pos.x,self.pos.y,particle_data)
local pos_x = self.hookAnchor.x + self.hookDistance * math.cos(hook_angle)
local pos_y = self.hookAnchor.y + self.hookDistance * math.sin(hook_angle)
local pos_x = self.hookAnchor.x + dist * math.cos(hook_angle)
local pos_y = self.hookAnchor.y + dist * math.sin(hook_angle)
self.vel.x = self.vel.x + pos_x - self.pos.x
self.vel.y = self.vel.y + pos_y - self.pos.y
self.pos.x = pos_x
self.pos.y = pos_y
end
end