Exemplo n.º 1
0
func (p *PU_Player) ContinueWalk() bool {
	if g_game.state != GAMESTATE_WORLD {
		return false
	}

	if p == g_game.self {
		if g_game.lastDirKey != 0 {
			isDown := sdl.KeyDown(g_game.lastDirKey)
			if isDown {
				switch g_game.lastDirKey {
				case sdl.KEY_UP:
					p.Walk(DIR_NORTH)

				case sdl.KEY_DOWN:
					p.Walk(DIR_SOUTH)

				case sdl.KEY_LEFT:
					p.Walk(DIR_WEST)

				case sdl.KEY_RIGHT:
					p.Walk(DIR_EAST)
				}
				return true
			}
		}
	}
	return false
}
Exemplo n.º 2
0
func KeyDown(_key int) bool {
	return sdl.KeyDown(_key)
}