Add proper forward movement.

This commit is contained in:
Logen Kain 2018-01-17 14:45:49 -07:00
parent 94f88d9010
commit c7bb73158e

View File

@ -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) {