From 8254af1179db18e2a71c34ab9b7090cda16f0f07 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Sun, 13 Nov 2022 14:17:29 -0600 Subject: Added crouch key * This allows players to move 2D to test collision --- Scripts/init.lua | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Scripts') diff --git a/Scripts/init.lua b/Scripts/init.lua index 60f21c6..4f2c93a 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -4,32 +4,36 @@ player = { Player = 0, EventListeners = { MoveLeftPressed = function(self) - --self.Velocity.x = self.Velocity.x - 3.0 - self.Velocity.y = self.Velocity.y - 1.0 + self.Velocity.x = self.Velocity.x - 3.0 self.Render.flipx = true; end, MoveLeftReleased = function(self) -- TODO can't put text at world coordinates right now --game.puts("default", self.Position.x, self.Position.y+100, "Hey. Hag?") - --self.Velocity.x = self.Velocity.x + 3.0 - self.Velocity.y = self.Velocity.y + 1.0 + self.Velocity.x = self.Velocity.x + 3.0 end, MoveRightPressed = function(self) - --self.Velocity.x = self.Velocity.x + 3.0 - self.Velocity.y = self.Velocity.y + 1.0 + self.Velocity.x = self.Velocity.x + 3.0 self.Render.flipx = false; end, MoveRightReleased = function(self) - --self.Velocity.x = self.Velocity.x - 3.0 - self.Velocity.y = self.Velocity.y - 1.0 + self.Velocity.x = self.Velocity.x - 3.0 end, JumpKeyPressed = function(self) - if self.Physics.standing == true then - game.play(self.Position, self.Audio) - self.Velocity.y = self.Velocity.y + 9 - end + -- if self.Physics.standing == true then + -- game.play(self.Position, self.Audio) + -- self.Velocity.y = self.Velocity.y + 9 + -- end + self.Velocity.y = self.Velocity.y + 3.0 end, JumpKeyReleased = function(self) + self.Velocity.y = self.Velocity.y - 3.0 + end, + CrouchKeyPressed = function(self) + self.Velocity.y = self.Velocity.y - 3.0 + end, + CrouchKeyReleased = function(self) + self.Velocity.y = self.Velocity.y + 3.0 end }, Position = { -- cgit v1.2.3