extract math util into sub package
This commit is contained in:
parent
538c8c215f
commit
60d71ae1c0
4 changed files with 35 additions and 8 deletions
|
@ -1,8 +1,10 @@
|
|||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import "util"
|
||||
import "vendor:sdl3"
|
||||
|
||||
DEFAULT_VELOCITY: util.Velocity : util.Velocity{x = 0, y = 0}
|
||||
SPEED: f32 : 200
|
||||
|
||||
HandleInput :: proc(game: ^Game, event: sdl3.Event) {
|
||||
|
@ -15,6 +17,7 @@ MovePlayer :: proc(game: ^Game) {
|
|||
y += game.input_state[sdl3.Scancode.S] ? SPEED : 0
|
||||
x: f32 = game.input_state[sdl3.Scancode.A] ? -SPEED : 0
|
||||
x += game.input_state[sdl3.Scancode.D] ? SPEED : 0
|
||||
game.player.velocity = util.Velocity{x, y}
|
||||
|
||||
game.player.position.y += y * game.delta
|
||||
game.player.position.x += x * game.delta
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue