Skip to content

Commit 5dbd661

Browse files
committed
Support key any
1 parent 80909a4 commit 5dbd661

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scratch.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,12 @@ def execute(block, s, keys=[]):
196196
if key == "any": # when key [any v] pressed
197197
print("DEBUG: Handling key", key, file=sys.stderr)
198198
if keys:
199+
print("DEBUG: Handling key", key, file=sys.stderr)
200+
for b in block.script:
201+
s.target.blocks[b].blockRan = False
199202
nb = block # s.target.blocks[block.next]
200203
nb.blockRan = False
204+
block.script.add(nb.blockID)
201205
while nb.next and nb.next != block.blockID:
202206
nb.blockRan = False
203207
nb.timeDelay = 0
@@ -206,10 +210,8 @@ def execute(block, s, keys=[]):
206210
block.script.add(nb.blockID)
207211
if not nb.next:
208212
nb.next = block.blockID
209-
# TODO
210213
nb.blockRan = False
211214
nextBlock = s.target.blocks[block.next]
212-
block.blockRan = False
213215
return nextBlock
214216

215217
elif KEY_MAPPING[key] in keys and block.next: # when key [. . . v] pressed
@@ -227,7 +229,6 @@ def execute(block, s, keys=[]):
227229
block.script.add(nb.blockID)
228230
if not nb.next:
229231
nb.next = block.blockID
230-
# TODO: Check if inEventLoop is true and event is last in loop
231232
nb.blockRan = False
232233
nextBlock = s.target.blocks[block.next]
233234
return nextBlock

0 commit comments

Comments
 (0)