mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2026-02-04 15:12:11 +00:00
Working on platformer
This commit is contained in:
parent
725ec88fd5
commit
2cce226575
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user