Add proper forward movement.
This commit is contained in:
parent
94f88d9010
commit
c7bb73158e
6
main.go
6
main.go
@ -85,14 +85,12 @@ func run() {
|
||||
mat := pixel.IM
|
||||
mat = mat.Rotated(pixel.ZV, angle)
|
||||
mat = mat.Scaled(pixel.ZV, 0.25)
|
||||
//mat = mat.Moved(win.Bounds().Center())
|
||||
mat = mat.Moved(myVec)
|
||||
|
||||
player.Draw(win, mat)
|
||||
|
||||
if win.Pressed(pixelgl.KeyLeft) {
|
||||
|
||||
//angle += 3 * dt
|
||||
angle += 3 * dt
|
||||
}
|
||||
if win.Pressed(pixelgl.KeyRight) {
|
||||
@ -100,8 +98,8 @@ func run() {
|
||||
|
||||
}
|
||||
if win.Pressed(pixelgl.KeyUp) {
|
||||
playerY += 3 * dt
|
||||
|
||||
playerX += math.Cos(angle-(270*math.Pi)/180) * 300 * dt
|
||||
playerY += math.Sin(angle-(270*math.Pi)/180) * 300 * dt
|
||||
}
|
||||
if win.Pressed(pixelgl.KeyDown) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user