aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2020-09-12 10:20:52 +0200
committerJoop Kiefte <ikojba@gmail.com>2020-09-12 10:20:52 +0200
commitbd6821b1d21ff6ddf0630a92f832a8d5acde1a70 (patch)
tree1efaf0fb4c155ad20e49eb1112a13282641b681f
parent129b44e56f546a4a80f4a70aeadcc89c77f9eee4 (diff)
improve harddrop speedv0.1.2
-rw-r--r--main.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/main.go b/main.go
index f6f4214..c212e5b 100644
--- a/main.go
+++ b/main.go
@@ -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] {