summaryrefslogtreecommitdiff
path: root/test-mvmt.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test-mvmt.sh')
-rwxr-xr-xtest-mvmt.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/test-mvmt.sh b/test-mvmt.sh
index 8ecef47..0f5ec67 100755
--- a/test-mvmt.sh
+++ b/test-mvmt.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-x1=128
-y1=128
+x1=234
+y1=234
xvel=1
xspd=$xvel
yvel=1
@@ -12,15 +12,15 @@ h=16
clear
actkbd -Ps | \
while read frame key held; do
- printf "\33[1;1H$x1 $y1 \b\b"
- #key1=$(echo "$key" | awk '{split($0, a, "+"); print a[1];}')
- #key2=$(echo "$key" | awk '{split($0, a, "+"); print a[2];}')
- [ "$key" = "KEY_NONE" ] && yspd=0 && xspd=0 && negx="" && negy=""
- [ "${key#*KEY_W}" != "$key" ] && negx="-" && xspd=$xvel && x1=$(expr $x1 - $xspd)
- [ "${key#*KEY_S}" != "$key" ] && negx="" && xspd=$xvel && x1=$(expr $x1 + $xspd)
- [ "${key#*KEY_A}" != "$key" ] && negy="-" && yspd=$yvel && y1=$(expr $y1 - $yspd)
- [ "${key#*KEY_D}" != "$key" ] && negy="" && yspd=$yvel && y1=$(expr $y1 + $yspd)
- xy=$(printf "1\n$w,$h\n$x1,$y1\n$negx$xspd,$negy$yspd\n$w,$h\n$x2,$y2" | ./clld | tail -n2 | tr -d ',' | sed '$d');
+ yspd=0 && xspd=0 && negx="" && negy="";
+ [ "${key#*KEY_W}" != "$key" -o "${key#*KEY_S}" != "$key" ] && yspd=$yvel
+ [ "${key#*KEY_A}" != "$key" -o "${key#*KEY_D}" != "$key" ] && xspd=$xvel
+ [ "${key#*KEY_W}" != "$key" ] && negy="-" && y1=$(expr $y1 - $yspd)
+ [ "${key#*KEY_S}" != "$key" ] && negy="" && y1=$(expr $y1 + $yspd)
+ [ "${key#*KEY_A}" != "$key" ] && negx="-" && x1=$(expr $x1 - $xspd)
+ [ "${key#*KEY_D}" != "$key" ] && negx="" && x1=$(expr $x1 + $xspd)
+ xy=$(printf "1\n$w,$h\n$x1,$y1\n$negx$xspd,$negy$yspd\n128,128\n$x2,$y2" | ./clld | tail -n2 | tr -d ',' | head -n1)
x1=$(echo "$xy" | awk '{print $1}')
y1=$(echo "$xy" | awk '{print $2}')
+ printf "\33[1;1H$x1 $y1 \33[2;1H$negx$xspd $negy$yspd \b\b"
done