ok, here is the breakdown of the pong scene (i’ll optimize/refactor it and add it as a grid teletype study when i get a chance). the video: https://www.instagram.com/p/BZPxog4grk4/
as a quick recap, you have a dot that moves horizontally or vertically on the grid. pressing anywhere creates a block. when the dot hits a block it changes the direction randomly and sends a trigger. CV 1 is based on the horizontal position and can be used for pitch, CV 2 is based on the vertical position and can be used for modulation. CV 3&4 are derived from horizontal and vertical speed.
#I
A 8; B 4; C 1; D 0
G.BTX 1 1 1 1 1 1 0 0 16 8
A is the horizontal position, B is the vertical position. C and D determine horizontal and vertical speed (basically, this is the amount that gets added to A and B on each step).
G.BTX id x y w h latch level script columns rows generates 16 rows and 8 columns of 1x1 latching buttons starting with button 1, so we cover 128 grid completely. level here is the brightness level for buttons that are not pressed, we just want it to be unlit, so 0. for this scene we don’t need to do anything whenever a button is pressed (we’ll just need to check the current state of a button at A,B coordinates), so we set script to 0 (you can assign scripts to buttons so whenever a button is pressed the script assigned to it gets executed).
#8
PN 2 0 PN 2 1
PN 3 0 PN 3 1
PN 2 1 A; PN 3 1 B
A + 1 % + A + C 15 16
B + 1 % + B + D 7 8
SCRIPT 1
#M
SCRIPT 8
G.CLR; G.LED A B 13
G.LED PN 2 1 PN 3 1 9
G.LED PN 2 0 PN 3 0 5
M SCALE 0 V 10 V 1 50 PRM
these 2 scripts move the dot around and draw it. it looks more complicated than it actually is - on each metro tick we basically clear the grid (G.CLR) and then draw the dot (G.LED A B 13). 13 is the brightness level. the rest is just using patterns 2 and 3 to store the previous 2 coordinates so we can draw a nice looking trace (2 more dots with lesser brightness). finally, we update A and B by adding C and D and wrapping the values. (oh, and we update M speed based on the knob value).
#1
Z + A * - B 1 16
IF G.BTN.V Z: SCRIPT 2
IF G.BTN.V Z: SCRIPT 3
#2
TR.P 1
CV 1 N A
CV 2 V B
CV 3 V + 2 C
CV 4 V + 2 D
#3
IF TOSS: X 1
ELSE: X -1
IF TOSS: C 0; D X
ELSE: D 0; C X
finally, this is the block collision logic. first, we calculate which button corresponds to A,B coordinates and save it to Z. G.BTN.V Z then gives us the state of the button, 1 if it’s pressed and 0 if it’s not pressed. if it’s pressed we generate a trigger and update CV outputs (script 2) and then generate a new random direction (script 3). that’s it!
plenty of room left for further experimentation, say, you could also set metro speed based on position (something like M ADD 50 MUL A 10), or use all 4 triggers and choose which one to trigger based on direction.