summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorNaveen Michaud-Agrawal <naveen.michaudagrawal@gmail.com>2023-07-12 23:30:07 +0000
committerNaveen Michaud-Agrawal <naveen.michaudagrawal@gmail.com>2023-07-12 23:30:07 +0000
commit991130bdd2590782d8b3884449fc92b5de4bfb5f (patch)
treec50244b9da9628ff2bd6ed41c2f8e3d388f63490 /virtual-programs
parentRun the step constantly instead of every 32ms (diff)
downloadfolk-991130bdd2590782d8b3884449fc92b5de4bfb5f.tar.gz
folk-991130bdd2590782d8b3884449fc92b5de4bfb5f.zip
Allow the program to scale the whisker
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/points-at.folk21
1 files changed, 15 insertions, 6 deletions
diff --git a/virtual-programs/points-at.folk b/virtual-programs/points-at.folk
index 773d42b3..fa4901a9 100644
--- a/virtual-programs/points-at.folk
+++ b/virtual-programs/points-at.folk
@@ -1,19 +1,27 @@
+When when /rect/ points /direction/ with length /l/ at /someone/ /lambda/ with environment /e/ {
+ Wish $rect points $direction with length $l
+}
+
When when /rect/ points /direction/ at /someone/ /lambda/ with environment /e/ {
- Wish $rect points $direction
+ Wish $rect points $direction with length 1
}
-When /someone/ wishes /rect/ points /direction/ & /rect/ has region /region/ {
+When /someone/ wishes /rect/ points /direction/ with length /l/ & /rect/ has region /region/ {
+
+ set scale [expr {$l * 100}]%
+ set shift 90%
+
if {$direction eq "up"} {
- set whiskerRegion [region move [region scale $region width 0.01px] up 51%]
+ set whiskerRegion [region move [region scale [region scale $region width 0.01px] height $scale] up $shift]
set color blue
} elseif {$direction eq "left"} {
- set whiskerRegion [region move [region scale $region height 0.01px] left 51%]
+ set whiskerRegion [region move [region scale [region scale $region height 0.01px] width $scale] left $shift]
set color red
} elseif {$direction eq "right"} {
- set whiskerRegion [region move [region scale $region height 0.01px] right 51%]
+ set whiskerRegion [region move [region scale [region scale $region height 0.01px] width $scale] right $shift]
set color green
} elseif {$direction eq "down"} {
- set whiskerRegion [region move [region scale $region width 0.01px] down 51%]
+ set whiskerRegion [region move [region scale [region scale $region width 0.01px] height $scale] down $shift]
set color white
}
set whisker [list $rect whisker $direction]
@@ -24,6 +32,7 @@ When /someone/ wishes /rect/ points /direction/ & /rect/ has region /region/ {
if {$target != $rect && $target != $whisker && \
[region intersects $whiskerRegion $r2]} {
Claim $rect points $direction at $target
+ Claim $rect points $direction with length $l at $target
}
}
}