-- Define player properties local player = { x = 0, y = 0, velocityY = 0, isJumping = false } -- Gravity affecting the player local gravity = 0.5 -- Jump strength local jumpStrength = -10 -- Function to handle player jumping function jump() if not player.isJumping then player.velocityY = jumpStrength player.isJumping = true end end -- Function to update player position function updatePlayer() player.y = player.y + player.velocityY player.velocityY = player.velocityY + gravity -- Check if the player has landed if player.y > 0 then player.y = 0 player.isJumping = false end end -- Example usage jump() -- Trigger a jump updatePlayer() -- Update player position -- Print player position (for testing) print("Player Y position: " .. player.y)