Skip to content

Commit

Permalink
Add "point in direction" (absolute rotation block)
Browse files Browse the repository at this point in the history
  • Loading branch information
Secret-chest committed Jun 2, 2023
1 parent 4bfb6ef commit afda389
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"targets":[{"isStage":true,"name":"Stage","variables":{},"lists":{},"broadcasts":{},"blocks":{},"comments":{},"currentCostume":0,"costumes":[{"name":"xy-grid","bitmapResolution":1,"dataFormat":"svg","assetId":"4851f7b71585efa5d42cb3a0b2d5fadf","rotationCenterX":239.99996948242188,"rotationCenterY":180.00003051757812}],"sounds":[],"volume":100,"layerOrder":0,"tempo":60,"videoTransparency":50,"videoState":"on","textToSpeechLanguage":"ro"},{"isStage":false,"name":"Cat 2","variables":{},"lists":{},"broadcasts":{},"blocks":{"?^q)qSDL?G9M_{|/iKKo":{"opcode":"event_whenflagclicked","next":"{$QhU(~Y{qa/r`=G{mGX","parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":300,"y":340},"{$QhU(~Y{qa/r`=G{mGX":{"opcode":"control_repeat","next":null,"parent":"?^q)qSDL?G9M_{|/iKKo","inputs":{"TIMES":[1,[6,"12"]],"SUBSTACK":[2,"hqsMZs4WIfY8fR:Z$[V0"]},"fields":{},"shadow":false,"topLevel":false},"hqsMZs4WIfY8fR:Z$[V0":{"opcode":"motion_turnright","next":null,"parent":"{$QhU(~Y{qa/r`=G{mGX","inputs":{"DEGREES":[1,[4,"15"]]},"fields":{},"shadow":false,"topLevel":false}},"comments":{},"currentCostume":0,"costumes":[{"name":"cat 2","bitmapResolution":1,"dataFormat":"svg","assetId":"b19faf9c49fb425c52756c2b229f08cb","md5ext":"b19faf9c49fb425c52756c2b229f08cb.svg","rotationCenterX":128.79883,"rotationCenterY":36.221843067841604}],"sounds":[{"name":"meow2","assetId":"cf51a0c4088942d95bcc20af13202710","dataFormat":"wav","format":"","rate":44100,"sampleCount":26048,"md5ext":"cf51a0c4088942d95bcc20af13202710.wav"}],"volume":100,"layerOrder":1,"visible":true,"x":0,"y":0,"size":100,"direction":90,"draggable":false,"rotationStyle":"all around"}],"monitors":[],"extensions":[],"meta":{"semver":"3.0.0","vm":"1.5.48","agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"}}
{"targets":[{"isStage":true,"name":"Stage","variables":{},"lists":{},"broadcasts":{},"blocks":{},"comments":{},"currentCostume":0,"costumes":[{"name":"xy-grid","bitmapResolution":1,"dataFormat":"svg","assetId":"4851f7b71585efa5d42cb3a0b2d5fadf","md5ext":"4851f7b71585efa5d42cb3a0b2d5fadf.svg","rotationCenterX":239.99996948242188,"rotationCenterY":180.00003051757812}],"sounds":[],"volume":100,"layerOrder":0,"tempo":60,"videoTransparency":50,"videoState":"on","textToSpeechLanguage":"ro"},{"isStage":false,"name":"Cat 2","variables":{},"lists":{},"broadcasts":{},"blocks":{"?^q)qSDL?G9M_{|/iKKo":{"opcode":"event_whenflagclicked","next":"}l[bKZnw-AEF;s1PwWnH","parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":300,"y":340},"}l[bKZnw-AEF;s1PwWnH":{"opcode":"control_forever","next":null,"parent":"?^q)qSDL?G9M_{|/iKKo","inputs":{"SUBSTACK":[2,"*p+AjP1@8x!|)0=-WRd0"]},"fields":{},"shadow":false,"topLevel":false},"*p+AjP1@8x!|)0=-WRd0":{"opcode":"motion_pointindirection","next":"GTgrP{t^I,0POk;iBL2|","parent":"}l[bKZnw-AEF;s1PwWnH","inputs":{"DIRECTION":[3,"_:Fh9,Ie4..HS/zo)#Tf",[8,"90"]]},"fields":{},"shadow":false,"topLevel":false},"_:Fh9,Ie4..HS/zo)#Tf":{"opcode":"operator_random","next":null,"parent":"*p+AjP1@8x!|)0=-WRd0","inputs":{"FROM":[1,[4,"-180"]],"TO":[1,[4,"180"]]},"fields":{},"shadow":false,"topLevel":false},"GTgrP{t^I,0POk;iBL2|":{"opcode":"control_wait","next":null,"parent":"*p+AjP1@8x!|)0=-WRd0","inputs":{"DURATION":[1,[5,"0.5"]]},"fields":{},"shadow":false,"topLevel":false}},"comments":{},"currentCostume":0,"costumes":[{"name":"cat 2","bitmapResolution":1,"dataFormat":"svg","assetId":"b19faf9c49fb425c52756c2b229f08cb","md5ext":"b19faf9c49fb425c52756c2b229f08cb.svg","rotationCenterX":128.79883,"rotationCenterY":36.221843067841604}],"sounds":[{"name":"meow2","assetId":"cf51a0c4088942d95bcc20af13202710","dataFormat":"wav","format":"","rate":44100,"sampleCount":26048,"md5ext":"cf51a0c4088942d95bcc20af13202710.wav"}],"volume":100,"layerOrder":1,"visible":true,"x":0,"y":0,"size":100,"direction":-150,"draggable":false,"rotationStyle":"all around"}],"monitors":[],"extensions":[],"meta":{"semver":"3.0.0","vm":"1.5.68","agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"}}
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Project file name
# If in test mode, set the Scratch project file to load.
projectFileName: str = "projects/Rotation2-medium.sb3"
projectFileName: str = "projects/AbsoluteRotation.sb3"

# Download cache size
# Number of recent downloaded projects stored. 0 means infinity.
Expand Down
Binary file added projects/AbsoluteRotation.sb3
Binary file not shown.
3 changes: 3 additions & 0 deletions scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def execute(block, s, events=eventContainer.EventContainer()):
elif opcode == "motion_turnright": # turn cw () degrees
s.setRotDelta(float(block.getInputValue("degrees", eventContainer=events)))

elif opcode == "motion_pointindirection": # point in direction ()
s.setRot(float(block.getInputValue("direction", eventContainer=events)))

elif opcode == "control_wait": # wait () seconds
block.screenRefresh = True
if not block.waiting:
Expand Down

0 comments on commit afda389

Please sign in to comment.