Working on platformer

This commit is contained in:
sam-astro 2022-05-24 21:40:58 -04:00
parent 725ec88fd5
commit 2cce226575

View File

@ -41,7 +41,7 @@ func Start()
global Sprite g_groundSprite = ZS.Graphics.Sprite("./square.png", groundPos, groundScale, 0) global Sprite g_groundSprite = ZS.Graphics.Sprite("./square.png", groundPos, groundScale, 0)
Vec2 instructionsPos = NVec2(centerOfScreen.x, centerOfScreen.y) Vec2 instructionsPos = NVec2(centerOfScreen.x, centerOfScreen.y)
global Text g_instructionsText = ZS.Graphics.Text("Use Arrow Keys or WASD to Move, and Spacebar to Jump", "./arial.ttf", instructionsPos, 20, 0, 255, 255, 255) global Text g_instructionsText = ZS.Graphics.Text("Use Arrow Keys or WASD to Move and Spacebar to Jump", "./arial.ttf", instructionsPos, 20, 0, 255, 255, 255)
global Vec2 g_playerTargetPosition = playerPos global Vec2 g_playerTargetPosition = playerPos
@ -92,7 +92,7 @@ func Update(deltaTime) {
float newX = g_playerTargetPosition.x float newX = g_playerTargetPosition.x
float stopSpeed = deltaTime * 7 float stopSpeed = deltaTime * 7
float lerpedX = Lerp(oldX, newX, stopSpeed) float lerpedX = Lerp(oldX, newX, stopSpeed)
g_playerSprite.position = NVec2(lerpedX, newY) g_playerSprite.position = NVec2(lerpedX, g_playerTargetPosition.y)
// Finally draws all of the sprites // Finally draws all of the sprites