summaryrefslogtreecommitdiff
path: root/test-mvmt.sh
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2019-10-01 18:03:37 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2019-10-01 18:03:37 -0400
commit2637626b7b1a9010d04ae547ab4b03b7541bfb81 (patch)
treedecc9df1207b2f721b84617c0e72fec1c4f7ad83 /test-mvmt.sh
parented304ec3db325f6e500fd8454f383f0d6f2ab167 (diff)
Added Axis Aligned Bounding Box collision.
Diffstat (limited to 'test-mvmt.sh')
-rwxr-xr-xtest-mvmt.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/test-mvmt.sh b/test-mvmt.sh
new file mode 100755
index 0000000..4f60333
--- /dev/null
+++ b/test-mvmt.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+x1=128
+y1=128
+x2=256
+y2=256
+w=16
+h=16
+actkbd -Ps | \
+while read frame key held; do
+ echo "$x1 $y1"
+ #key1=$(echo "$key" | awk '{split($0, a, "+"); print a[1];}')
+ #key2=$(echo "$key" | awk '{split($0, a, "+"); print a[2];}')
+ [ "$key" = "KEY_W" ] && x1=$(expr $x1 - 1)
+ [ "$key" = "KEY_S" ] && x1=$(expr $x1 + 1)
+ [ "$key" = "KEY_A" ] && y1=$(expr $y1 - 1)
+ [ "$key" = "KEY_D" ] && y1=$(expr $y1 + 1)
+ xy=$(printf "1\n$w,$h\n$x1,$y1\n$w,$h\n$x2,$y2" | ./clld | tail -n1 | tr -d ',');
+ x1=$(echo "$xy" | awk '{print $1}');
+ y1=$(echo "$xy" | awk '{print $2}');
+done