diff options
author | Joop Kiefte <ikojba@gmail.com> | 2020-09-12 10:20:52 +0200 |
---|---|---|
committer | Joop Kiefte <ikojba@gmail.com> | 2020-09-12 10:20:52 +0200 |
commit | bd6821b1d21ff6ddf0630a92f832a8d5acde1a70 (patch) | |
tree | 1efaf0fb4c155ad20e49eb1112a13282641b681f | |
parent | 129b44e56f546a4a80f4a70aeadcc89c77f9eee4 (diff) |
improve harddrop speedv0.1.2
-rw-r--r-- | main.go | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -27,16 +27,19 @@ func main() { var floor, topout, harddrop bool var x, y int var rot tris.Rotation + var key []byte fmt.Print("\033[2J") // Clear screen b := tris.NewBag() b, p := b.Pick() t := time.Tick(time.Second) + key = GetKey() for { x, y, rot = p.X, p.Y, p.Rot - fmt.Print("\033[0;0H") // Position to 0,0 - fmt.Println(f.Add(p).String()) - key := GetKey() - if harddrop { key[0] = ' ' } + if !harddrop { + fmt.Print("\033[0;0H") // Position to 0,0 + fmt.Println(f.Add(p).String()) + key = GetKey() + } switch key[0] { case 27: // Escape, read the arrow key pressed switch key[2] { |