From 9b91ff6876390ca1c380b7714f7802afe1f00735 Mon Sep 17 00:00:00 2001 From: Alessandro Norfo Date: Fri, 22 Sep 2017 17:06:08 +0200 Subject: [PATCH] added reset_turtle --- pyturtlecraft.s2e | 5 +++-- scratch_pyturtlecraft.py | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyturtlecraft.s2e b/pyturtlecraft.s2e index cff191f..3a7b7e2 100644 --- a/pyturtlecraft.s2e +++ b/pyturtlecraft.s2e @@ -1,7 +1,8 @@ -{ +{ "extensionName": "Scratch_Turtle Pycraft", "extensionPort": 3320, "blockSpecs": [ + [" ", "reset turtle", "reset_turtle"], ["r", "where", "where"], [" ", "read where is the player", "setwhere"], ["w", "pen down", "pendown"], @@ -18,4 +19,4 @@ "menus": { "blocktype":["glowstone", "wool", "wood", "ice", "gold"] } -} \ No newline at end of file +} diff --git a/scratch_pyturtlecraft.py b/scratch_pyturtlecraft.py index 87ca7a0..f3954c7 100644 --- a/scratch_pyturtlecraft.py +++ b/scratch_pyturtlecraft.py @@ -70,6 +70,12 @@ def addVariable(varName, varValue): global myturtle, jobs, variables variables[varName] = str(varValue) +@app.route('/reset_turtle') +def reset_turtle(): + global myturtle, jobs, variables + myturtle = initTurtle() + return "OK" + @app.route('/setwhere') def setwhere(): global myturtle, jobs, variables