# Porting Touch Develop games

**URL:** https://forum.makecode.com/t/porting-touch-develop-games/3686
**Category:** Arcade
**Created:** [September 29, 2020, 8:12pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686 "2020-09-29T20:12:07Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 29, 2020, 8:12pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/1 "2020-09-29T20:12:07Z")

</div>

I am wondering if it is possible to port a game developed in Touch Develop to MakeCode Arcade? I have the JSON files of a project I made, called ‘Spacey Invaders Reloaded’. Does anyone know of a lexical parser to converts the JSON content into Static TypeScript?

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [September 30, 2020, 12:46am UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/2 "2020-09-30T00:46:24Z")

</div>

Interesting idea, @cosmoscowboy! MakeCode Arcade is the spiritual successor to Touch Develop, but it’s a very different platform.

If you’re willing to share your JSON, I’d be happy to take a look. I don’t think I have any of my old Touch Develop code anymore.

Any initial thoughts, @peli ?

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 6:31am UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/3 "2020-09-30T06:31:26Z")

</div>

Hi @AlexK,

Thank you for your reply. I have this file which contains functions for calculating Bezier curves. I can strip out the code that was in the format of Touch Develop, and manually write that as TypeScript; that is not a problem. I just though maybe, since Touch Develop code was translated to TypeScript, and that to Javascript, that there is a library somewhere that enables that process.

{  
“scripts”: [  
{  
“header”: {  
“cloudId”: “[touchdevelop.com](http://touchdevelop.com)”,  
“scriptId”: “hnvib”,  
“userId”: “cqeba”,  
“status”: “published”,  
“lastUse”: 1526676178,  
“editor”: “touchdevelop”,  
“name”: “Bezier curves”,  
“comment”: “Formulas for calculating a linear, quadratic and cubic bezier curves were taken from:\n\nhttp://caffeineowl.com/graphics/2d/vectorial/bezierintro.html\n\nhttp://en.wikipedia.org/wiki/Bézier\_curve”  
},  
“source”: “meta version “v2.2,js,ctx,refs,localcloud,unicodemodel,allasync”;\nmeta name “Bezier curves”;\nmeta icon “Share”;\nmeta color “#ffff0038”;\nmeta rootId “xu5kuZwm7kGpcsE4f4u05jDK”;\nmeta isLibrary “yes”;\nmeta allowExport “yes”;\nmeta hasIds “yes”;\nmeta platform “current”;\nmeta parentIds “”;\n// Formulas for calculating a linear, quadratic and cubic bezier curves were taken from:\n// \n// [http://caffeineowl.com/graphics/2d/vectorial/bezierintro.html\n//](http://caffeineowl.com/graphics/2d/vectorial/bezierintro.html%5Cn//) \n// [http://en.wikipedia.org/wiki/Bézier\_curve\n#OU78BBXCakSog0cs\naction](http://en.wikipedia.org/wiki/B%C3%A9zier_curve%5Cn#OU78BBXCakSog0cs%5Cnaction) main() {\n #M5PmWnaV1xVsDZc5 $board := media→create\_landscape\_board(800, 480);\n #LXJmho39gfcIFoHk $world := media→create\_picture($board→width, $board→height);\n #N9FE1nZi9BCXCvhJ $board→set\_background\_picture($world);\n #xZqnFOalBAXGxhTq $heading\_quadratic := $board→create\_text(100, 20, 30, “Quadratic bézier curve”);\n #V4b15pnMPn2C3GkT $heading\_quadratic→set\_color(colors→black);\n #Y1AJeCftQeY5Gco3 $heading\_quadratic→set\_pos($board→width \* .15, $board→height \* .1);\n #skE87SD4hbacAG23 $heading\_cubic := $board→create\_text(100, 20, 30, “Cubic bézier curve”);\n #EWM2twfjzMR9OIj7 $heading\_cubic→set\_color(colors→blue);\n #CUaItpvU7hiPqC7G $heading\_cubic→set\_pos($heading\_quadratic→x, $heading\_quadratic→y + 50);\n #EY6KuXTB6A5VOOOO $heading\_linear := $board→create\_text(100, 20, 30, “Linear bézier curve”);\n #OpQW2IrBAgbwld43 $heading\_linear→set\_color(colors→orange);\n #EXXlLvjQZUw6pps1 $heading\_linear→set\_pos($heading\_cubic→x, $heading\_cubic→y + 50);\n #pSQtFEHjVq4S6wsF $starting\_position\_, $ending\_position\_, $control\_point\_1, $control\_point\_2 := code→get\_points($board);\n #uNjc6BVBfUPjho6k $coordinates2 := records→curve\_coordinates→create;\n #XexAgcX1PxdDx8oq $coordinates2→starting\_position := $starting\_position\_;\n #WLEoNZM0WNfxd4xW $coordinates2→ending\_position := $ending\_position\_;\n #vgYW17H3ihGbdIL7 $coordinates2→control\_point\_1 := $control\_point\_1;\n #mxOeHZrXgT2XNk4G $coordinates2→control\_point\_2 := $control\_point\_2;\n #F8B6UbbV2G2ye3xp code→set\_positions\_($coordinates2, $board);\n #EsADsDXYphVkY6qA $quadratic\_sprite, $cubic\_sprite, $linear\_sprite := code→create\_curve\_sprites($board, $starting\_position\_);\n #bSf6VA3wpyq1CGdb $linear\_curve := code→create\_linear\_curve($coordinates2→starting\_position, $coordinates2→ending\_position);\n #k68FnATYoq40OuNO $quadratic\_curve := code→create\_quadratic\_curve($coordinates2→starting\_position, $coordinates2→ending\_position, $coordinates2→control\_point\_1);\n #xU1R0uQCZ1hEfS15 $cubic\_curve := code→create\_cubic\_curve($coordinates2→starting\_position, $coordinates2→ending\_position, $coordinates2→control\_point\_1, $coordinates2→control\_point\_2);\n #xl3EBmkJAGabZJ9i $total := 1000;\n #iE2MeBI4ypdi9WxO for 0 ≤ i \< $total do {\n #yafiaKcxvDdB1YVz $percentage := code→get\_percentage($i, $total - 50);\n #qgd3sh7bL0ymaR9Q $linear\_curve→t := $percentage;\n #omZI3L5vs5LUBhBo $quadratic\_curve→t := code→get\_percentage($i, $total);\n #xB09SKk4t12Dsueb $cubic\_curve→t := $percentage;\n #sa4zWWq5qUDtqaoF $x := $linear\_sprite→x;\n #zvESjCm4Asuy9djX $y := $linear\_sprite→y;\n #tUosgwJ5Z36Rh8oo $position := code→get\_position($linear\_curve);\n #vpceeGa672Sq3J18 $linear\_sprite→set\_pos($position→x, $position→y);\n #B4xduxs4QSppmEdB $world→draw\_line($x, $y, $linear\_sprite→x, $linear\_sprite→y, $linear\_sprite→color, 3);\n #sFll6QZIKJS24zdV $x := $quadratic\_sprite→x;\n #KOVb42z1MilCvxxU $y := $quadratic\_sprite→y;\n #x22Kyr66jSIQRx0v $position := code→get\_position($quadratic\_curve);\n #cetl2cKiwvtgfuX2 $quadratic\_sprite→set\_pos($position→x, $position→y);\n #wASoeMqDMrCmaDeZ $world→draw\_line($x, $y, $quadratic\_sprite→x, $quadratic\_sprite→y, $quadratic\_sprite→color, 3);\n #dQBqLXg4Qse8qjJr $linear\_curve→t := code→get\_percentage($i, $total);\n #YNpfOe4nCc9uVeQk $x := $cubic\_sprite→x;\n #US0LGLbfPgiuvXD0 $y := $cubic\_sprite→y;\n #GYKMkR3HB3iBa3Vd $position := code→get\_position($cubic\_curve);\n #xqH0gZldC2eE2bu8 $cubic\_sprite→set\_pos($position→x, $position→y);\n #vY13h6HS0m0jxcZ4 $world→draw\_line($x, $y, $cubic\_sprite→x, $cubic\_sprite→y, $cubic\_sprite→color, 3);\n }\n #ZDPlP7rKKIEiJ355 $board→post\_to\_wall;\n #hhGJ3W0DgFG4d2KE time→run\_after(3, $perform);\n #P7omeDlKOeqE6kW0 where perform() {\n #xJ7YfBkVmOe2fnit $duration := wall→ask\_number(“Duration (seconds)?”);\n #xzKEc484zXw4Cn2O time→run\_after(1, $perform2);\n #xLt82guSs45RbQOw where perform2() {\n #xI1KmvwmRPZLNw64 data→start\_time := time→now;\n #xyJOeKYDgYPEJn7T data→end\_time := data→start\_time→add\_seconds($duration);\n #AsPgpu4u0d73tSdn $board→add\_on\_every\_frame($perform);\n #Yv3AGknK13H5Bc2y where perform() {\n #qkUsK18CvrOV40oV $x := $quadratic\_sprite→x;\n #xNDo8SBQVWrg98sF $y := $quadratic\_sprite→y;\n #zCBQ46tif6xyvhMt $percentage\_ := time→now→subtract(data→start\_time) / $duration;\n #x7J1hLrMClc5l6yc $linear\_curve→t := $percentage\_;\n #WSt2hWCY2mTl8Fgx $quadratic\_curve→t := $percentage\_;\n #nOrjWFxYIZciLsLy $cubic\_curve→t := $percentage\_;\n #SQquaehayr7qqP2y $position2 := code→get\_position($quadratic\_curve);\n #zyZzSeXLyQgvylKx $quadratic\_sprite→set\_pos($position2→x, $position2→y);\n #uEGuvB2edWYXXoN7 $world→draw\_line($x, $y, $quadratic\_sprite→x, $quadratic\_sprite→y, $quadratic\_sprite→color, 3);\n #RVVf6i4x7KWxfVsK $x := $cubic\_sprite→x;\n #ouSLE4sSYFtnASD6 $y := $cubic\_sprite→y;\n #JCEssJBFtM0R5NSa $position2 := code→get\_position($cubic\_curve);\n #ItTm8X26z1HADTr1 $cubic\_sprite→set\_pos($position2→x, $position2→y);\n #xLrNwnMwqT5TfhBL $world→draw\_line($x, $y, $cubic\_sprite→x, $cubic\_sprite→y, $cubic\_sprite→color, 3);\n #x3ZNk4yLS2JLuski $x := $linear\_sprite→x;\n #xf7y4znK2ZBsw3Mg $y := $linear\_sprite→y;\n #lInN15yoOxv5viDg $position2 := code→get\_position($linear\_curve);\n #iftETmffn52UWyN6 $linear\_sprite→set\_pos($position2→x, $position2→y);\n #lI4APdinnflXxmGF $world→draw\_line($x, $y, $linear\_sprite→x, $linear\_sprite→y, $linear\_sprite→color, 3);\n #Ws4ba5yoCmX0P0Wa if time→now→greater(data→end\_time) then {\n #xBpe4RoTHp4Fx8iV data→start\_time := time→now;\n #Q7MUzrbgeQNlSl5a data→end\_time := data→start\_time→add\_seconds($duration);\n }\n #q69Zp4iQXu43voZA $board→update\_on\_wall;\n }\n }\n }\n meta private;\n meta test;\n}\n#TvhtlUTziZG2XzGy\naction get\_points(#djMu4Peizo0nHHEv board: Board) returns(#KKQWn4ROgmjBF9it starting\_position\_: Vector3, #xrKbh12rbYv5A2Ch ending\_position\_: Vector3, #G0YlcOFnRfVoXc5Y control\_point\_1: Vector3, #x7PbVW4PjAOubF43 control\_point\_2: Vector3) {\n #xYaJs7C56D6rtBxj $starting\_position\_ := math→create\_vector3(50, $board→height \* .5, 0);\n #xAuacprD3DpFa03X $ending\_position\_ := math→create\_vector3($board→width - 50, $board→height \* .5, 0);\n #CU68LO3cE8XHj4gG $control\_point\_1 := math→create\_vector3($board→width \* .5, $board→height - 50, 0);\n #oYor5hbNh6Rwu4Zg $control\_point\_2 := math→create\_vector3($board→width \* .5, 50, 0);\n meta private;\n meta sync;\n}\n#fgfTCjyl12G8KS1y\naction set\_positions\_(#y2Zt4WPRpeDsUxuP curve\_coordinates: \* curve\_coordinates, #sY76zkhs3Orbio4x board: Board) {\n #KHCXtfqSUmsV3ZLp // Marks the positions on the board with an eclipse (used for debugging)\n #G8PFTgvI2lzz3g3Y $starting\_position\_sprite := $board→create\_ellipse(40, 40);\n #ddSE2BVcFWLXy0hp $starting\_position\_sprite→set\_pos($curve\_coordinates→starting\_position→x, $curve\_coordinates→starting\_position→y);\n #mC2sTYsCTgY1OZiU $starting\_position\_sprite→set\_color(colors→red);\n #AW4hRSSjgIrT2nKE $ending\_position\_sprite := $board→create\_ellipse(40, 40);\n #NcN9OVhXouDGRdq3 $ending\_position\_sprite→set\_pos($curve\_coordinates→ending\_position→x, $curve\_coordinates→ending\_position→y);\n #xOM55ElnT2ny5ux6 $ending\_position\_sprite→set\_color(colors→green);\n #VHaBwA42B8FdDhCg if `not` $curve\_coordinates→control\_point\_1→is\_invalid then {\n #xw3TOoSiLD5Qx8Bj $control\_point\_sprite\_1 := $board→create\_ellipse(40, 40);\n #xzkacCMrBsAwbngC $control\_point\_sprite\_1→set\_pos($curve\_coordinates→control\_point\_1→x, $curve\_coordinates→control\_point\_1→y);\n #xyOx2QbdboOlIVn2 $control\_point\_sprite\_1→set\_color(colors→orange);\n }\n #xplcMlT5dC8dpFWo if `not` $curve\_coordinates→control\_point\_2→is\_invalid then {\n #xxb98JTJBn9UE5cH $control\_point\_sprite\_2 := $board→create\_ellipse(40, 40);\n #AATj14zOOsrfx2DO $control\_point\_sprite\_2→set\_pos($curve\_coordinates→control\_point\_2→x, $curve\_coordinates→control\_point\_2→y);\n #K42QQvsVF4HLhjzn $control\_point\_sprite\_2→set\_color(colors→gray);\n }\n meta private;\n meta sync;\n}\n#PL78y1hQLMFKi4e4\naction create\_curve\_sprites(#zCyxsx6SJ3kFY1or board: Board, #E9poXuwa3S6lBu5Y starting\_position\_: Vector3) returns(#x7EH9nWhY961tvD2 quadratic\_sprite: Sprite, #sGKM1b3666TJMr82 cubic\_sprite: Sprite, #pfouu53sThXfOaa4 linear\_sprite: Sprite) {\n #sYaqdB2iht3oG4nG $quadratic\_sprite := $board→create\_rectangle(20, 20);\n #kQB3N9n4BXYzF6rx $quadratic\_sprite→set\_color(colors→black);\n #XS62MASfSwSSxzGj $quadratic\_sprite→set\_pos($starting\_position\_→x, $starting\_position\_→y);\n #wOHFoaTkMaG270hn $cubic\_sprite := $board→create\_rectangle(20, 20);\n #kj22exFE2HU74YiN $cubic\_sprite→width := $quadratic\_sprite→width / 2;\n #xjWTYy3bD4QPg09P $cubic\_sprite→height := $quadratic\_sprite→height / 2;\n #QK7xptRF2sqyIWZ1 $cubic\_sprite→set\_color(colors→blue);\n #i4Gl94pZNCuFJbP4 $cubic\_sprite→set\_pos($starting\_position\_→x, $starting\_position\_→y);\n #xrCfuCEelMDeQG43 $linear\_sprite := $board→create\_ellipse(20, 20);\n #xSuHXKTZ7T3C1MhQ $linear\_sprite→set\_pos($starting\_position\_→x, $starting\_position\_→y);\n #LDcW0UHgUZ2YnmBp $linear\_sprite→set\_color(colors→orange);\n meta private;\n meta sync;\n}\n#BdGhpbmca\ntable curve\_coordinates {\n type = “Object”;\n persistent = false;\n fields {\n #Ghaprprj8SGpRn3U starting\_position : Vector3\n #xGKC1ws0WkjjxnNF ending\_position : Vector3\n #oLlK07FLkLIaTexv control\_point\_1 : Vector3\n #MoVW1FkYTxg1eZ7A control\_point\_2 : Vector3\n }\n}\n#qrZgcIJNUt5oFvpm\naction get\_linear\_position(#VdEhaVdwLaKZ26Lr curve: \* curve) returns(#x559wFU0yAqUNo0t position: Vector3) {\n #xUBDbxo2JJazoY8G // Gets the position (x,y) on a linear bézier curve based on the time elapsed and duration (t = 0 \> t \< 1)\n #jmVUwsGUyLG3xPEH // T = [0,1] (percentage of curve)\n #boUY6nsYHVSaTBko $curve→t := code→get\_t\_normalized($curve→t);\n #gU143MDtuLVv4A5d // (1-t)p0 + tp1\n #x7yWh1tr7RFweJeE $x := ((1 - $curve→t) \* $curve→curve\_coordinates→starting\_position→x) + ($curve→t \* $curve→curve\_coordinates→ending\_position→x);\n #roLW00pDYj4j3sgK $y := ((1 - $curve→t) \* $curve→curve\_coordinates→starting\_position→y) + ($curve→t \* $curve→curve\_coordinates→ending\_position→y);\n #qAcGvDorAY1tZK9l $position := math→create\_vector3($x, $y, 0);\n meta private;\n meta sync;\n}\n#LpShD2CtzbNAlnPR\naction get\_quadratic\_position(#QyFst7XekNLW2rwQ curve: \* curve) returns(#X4JqmaQ4z0QD4OgY position: Vector3) {\n #CLQ8ix41kVzLotej // Gets the position (x,y) on a quadratic bézier curve based on the time elapsed and duration (t = 0 \> t \< 1)\n #c8QkBRmpOLb1l76e // T = [0,1] (percentage of curve)\n #xrIFhSxvpi3OnyNF $curve→t := code→get\_t\_normalized($curve→t);\n #ZgWbfXTmjRZ9Azqs // P = (1-t)2•P1 + 2•(1-t) •t•C + t2•P2\n #xTQdK5SV4B4se1cX $x := math→pow((1 - $curve→t), 2) \* $curve→curve\_coordinates→starting\_position→x + (2 \* (1 - $curve→t) \* $curve→t \* $curve→curve\_coordinates→control\_point\_1→x) + (math→pow($curve→t, 2) \* $curve→curve\_coordinates→ending\_position→x);\n #iDrGm8K2rZiyXrk1 $y := math→pow((1 - $curve→t), 2) \* $curve→curve\_coordinates→starting\_position→y + (2 \* (1 - $curve→t) \* $curve→t \* $curve→curve\_coordinates→control\_point\_1→y) + (math→pow($curve→t, 2) \* $curve→curve\_coordinates→ending\_position→y);\n #SMNk1lEOwBOz4JMn $position := math→create\_vector3($x, $y, 0);\n meta private;\n meta sync;\n}\n#nhfu28vQIJRdRJPD\naction get\_cubic\_position(#tZ9GVMgXEqNePWJb curve: \* curve) returns(#ila22l2mwCFg7Wo3 position: Vector3) {\n #hYEL21UryJrRusid // \n #dqMmeTaqegzCEaVY // Gets the position (x,y) on a cubic bézier curve based on the time elapsed and duration (t = 0 \> t \< 1)\n #xPBQBUIFVY1N9kf8 // T = [0,1] (percentage of curve)\n #v4zY5qb23EPsQAp2 $curve→t := code→get\_t\_normalized($curve→t);\n #rBGHDQoiOdmzJxH4 // P = (1-t)3•P1 + 3•(1-t)2•t•C1 + 3•(1-t)•t2•C2 + t3•P2\n #qhrZRThuNw4p0Ijk $x := (math→pow(1 - $curve→t, 3) \* $curve→curve\_coordinates→starting\_position→x) + (3 \* math→pow(1 - $curve→t, 2) \* $curve→t \* $curve→curve\_coordinates→control\_point\_1→x) + (3 \* (1 - $curve→t) \* math→pow($curve→t, 2) \* $curve→curve\_coordinates→control\_point\_2→x) + (math→pow($curve→t, 3) \* $curve→curve\_coordinates→ending\_position→x);\n #whtHsUYMcrgzkw2D $y := (math→pow(1 - $curve→t, 3) \* $curve→curve\_coordinates→starting\_position→y) + (3 \* math→pow(1 - $curve→t, 2) \* $curve→t \* $curve→curve\_coordinates→control\_point\_1→y) + (3 \* (1 - $curve→t) \* math→pow($curve→t, 2) \* $curve→curve\_coordinates→control\_point\_2→y) + (math→pow($curve→t, 3) \* $curve→curve\_coordinates→ending\_position→y);\n #xAUIk1mstjV2IhO1 $position := math→create\_vector3($x, $y, 0);\n meta private;\n meta sync;\n}\n#xuXpAJPgL2DxDxYZ\naction get\_t\_normalized(#Z47arMG72YPSGHss t: Number) returns(#yZZfE1vlnyU7ERdS t\_normalized: Number) {\n #cFAPQsXIDKZCOD9y $t\_normalized := $t;\n #j184mZTSy5Bm272H if $t\_normalized \> 1 then {\n #j1ZbbEt2eOn28zI1 $t\_normalized := 1;\n }\n else { #EAdR1p9xGBgELYzA if $t \< 0 then {\n #O64r52Mi9CyMfqpD $t := 0;\n }\n else { } } \n meta private;\n meta sync;\n}\n#vwry4nKnJq6R1cA5\naction get\_percentage(#ltQxGTqNXtW2FOJc iteration: Number, #tZ94FbfuJo2SBPw3 total: Number) returns(#xVhdwcW9oJXCRoee percentage: Number) {\n #g1hzvYy14iEKqdTA // percentage = iteration / total\n #x8joQ2tXhrM6pumn $percentage := $iteration / $total;\n meta private;\n meta sync;\n}\n#YaPjwGRW5n1wfB4S\naction starting\_position(#AsgYNBdtYgLy0nj8 curve\_coordinates: \* curve\_coordinates) returns(#hm2hX2o46M6p9z20 starting\_position: Vector3) {\n #hpfBVpQyhADvwMEH $starting\_position := math→create\_vector3($curve\_coordinates→starting\_position→x, $curve\_coordinates→starting\_position→y, 0);\n meta sync;\n}\n#HySlv4sJTQcbGm2B\naction ending\_position(#jLEAP2LxrHBDnMiB curve\_coordinates: \* curve\_coordinates) returns(#t4ZSzOO5NVXPXBe4 ending\_position: Vector3) {\n #nGLWnCIgwQxwFB82 $ending\_position := math→create\_vector3($curve\_coordinates→ending\_position→x, $curve\_coordinates→ending\_position→y, 0);\n meta sync;\n}\n#f8BiKmgQ4a1C7hYI\naction control\_point\_1(#eO4RtGIrcCS7e5Q4 curve\_coordinates: \* curve\_coordinates) returns(#mePeLc37tFTxephe control\_point\_1: Vector3) {\n #kXqNtXv64161iysj // Can return invalid -\> vector3\n #XAF9ojeAwXKqR2jM $control\_point\_1 := invalid→vector3;\n #xlkdeQ1UkdN8cSBU if `not` $curve\_coordinates→control\_point\_1→is\_invalid then {\n #rDe3u8DeOpnlOWAy $control\_point\_1 := math→create\_vector3($curve\_coordinates→control\_point\_1→x, $curve\_coordinates→control\_point\_1→y, 0);\n }\n meta sync;\n}\n#pODw76O8kXAsc1rU\naction control\_point\_2(#zNpLSKxz42YrzpBX curve\_coordinates: \* curve\_coordinates) returns(#xt4ZCA2r0mNND6l6 control\_point\_2: Vector3) {\n #amoDJ1eE3rgJypXb // Can return invalid -\> vector3\n #xQD5V8OI7MpsmXPR $control\_point\_2 := invalid→vector3;\n #FoPQ8tZ5pcK1z55C if `not` $curve\_coordinates→control\_point\_2→is\_invalid then {\n #h2CENz8Lf4CCfNXO $control\_point\_2 := math→create\_vector3($curve\_coordinates→control\_point\_2→x, $curve\_coordinates→control\_point\_2→y, 0);\n }\n meta sync;\n}\n#vdkGV2qZXW7LAG9l\naction set\_starting\_position(#yQTzM0ByW2XOpNOi curve\_coordinates: \* curve\_coordinates, #xCuwSTdArcU6gac6 starting\_position: Vector3) {\n #HvR20r33AbrDvS4v $curve\_coordinates→starting\_position := $starting\_position;\n meta sync;\n}\n#Hl0kN2P4vKwXtaQC\naction set\_ending\_position(#NfRc04X3uopqVcwI curve\_coordinates: \* curve\_coordinates, #j0tD1qQLoagc8bn6 ending\_position: Vector3) {\n #Oim2RIBjCNtk4VH7 $curve\_coordinates→ending\_position := $ending\_position;\n meta sync;\n}\n#xLMBkcPQKv6oyCZT\naction set\_control\_point\_1(#fbG4d3mVPNna056B curve\_coordinates: \* curve\_coordinates, #RlAHLwJssLVg0H6y control\_point\_1: Vector3) {\n #lE3eClqWUGCRuBm2 $curve\_coordinates→control\_point\_1 := $control\_point\_1;\n meta sync;\n}\n#xs5VSqG5ylf6hSiS\naction set\_control\_point\_2(#OEY4sB9VB7pEvkbt curve\_coordinates: \* curve\_coordinates, #JZWG1cVOEcpeOuDI control\_point\_2: Vector3) {\n #pYznP6smote5FfHE $curve\_coordinates→control\_point\_2 := $control\_point\_2;\n meta sync;\n}\n#fATNKUyERCEta2cQ\ntable curve {\n type = “Object”;\n persistent = false;\n fields {\n #ppUuSyAWkc2LBOkl curve\_type : \* curve\_type\n #SW9cNy5ZPJw3WsDC curve\_coordinates : \* curve\_coordinates\n #BknYaOvkqeHQwBgl t : Number\n }\n}\n#xk986ORLjlpbTDuF\ntable curve\_type {\n type = “Object”;\n persistent = false;\n fields {\n #W7vXqR6s7qF98Cs1 linear : Boolean\n #xtx4uiOHC5QwIOey quadratic : Boolean\n #xNRi3OXdgAOGUPOy cubic : Boolean\n }\n}\n#x7pQVfyVNAfv6MAh\naction coordinates(#VXs6zTgQT1UpFP2D curve: \* curve) returns(#Whx3Nl4cybDUNgPF curve\_coordinates: \* curve\_coordinates) {\n #MEx33U2Iin4ZlFWS $curve\_coordinates := $curve→curve\_coordinates;\n meta sync;\n}\n#b9jn7yvQIG6t6DfR\naction get\_curve\_type(#Hg72Sg3Eku7ZFV5t curve: \* curve) returns(#qmxx86ggPXneJ6ct curve\_type: \* curve\_type) {\n #khx0unplE14QdyNy $curve\_type := $curve→curve\_type;\n meta sync;\n}\n#FEcPoE2AI9MMGSdO\naction create\_linear\_curve(#xvLrqSHAkIH3lLx2 starting\_position: Vector3, #xlOHhc2mUEvb3zjC ending\_position: Vector3) returns(#xMOwiR3qnMDef7Xf linear\_curve: \* curve) {\n #VVIGxsbR2w5KC4gK if $starting\_position→is\_invalid then {\n #HUOrE4UlhgwFKBGs $starting\_position := math→create\_vector3(0, 0, 0);\n }\n #t4VxqQ1nbxaCBRhL if $ending\_position→is\_invalid then {\n #xAmvbjn7GxSkVX7z $ending\_position := $starting\_position;\n }\n #tNQwD3I244z5Gc7n $linear\_curve := records→curve→create;\n #oSLBPyayxoZBfaED $linear\_curve→curve\_coordinates := records→curve\_coordinates→create;\n #nwd2iNGy5jA8kZ0u $linear\_curve→curve\_type := records→curve\_type→create;\n #f2JoeR12muo2QiDD $linear\_curve→curve\_coordinates→starting\_position := $starting\_position;\n #cyk4aAX926M7y1ls $linear\_curve→curve\_coordinates→ending\_position := $ending\_position;\n #mU4X4pWVbTuqH6Tr $linear\_curve→curve\_type→linear := true;\n meta sync;\n}\n#ibCTjaingbo8wyvI\naction create\_quadratic\_curve(#mO6VCyMhRLvoD2VJ starting\_position: Vector3, #tBuwHIi2wctLx2hV ending\_position: Vector3, #C44j5pXlUfcj0hmG control\_point\_1: Vector3) returns(#rS1ZMM6IUpFOo9Ph quadratic\_curve: \* curve) {\n #o4rHorpH6fh0AIpz if $starting\_position→is\_invalid then {\n #IEMb4LgmLaBJhhqi $starting\_position := math→create\_vector3(0, 0, 0);\n }\n #Xrx7b0MFUgSzX4HX if $ending\_position→is\_invalid then {\n #YVnWYRR322v70VOa $ending\_position := $starting\_position;\n }\n #lyyXnHihOZ4TknSe if $control\_point\_1→is\_invalid then {\n #jpaADE3jQe39TVbY $control\_point\_1 := $ending\_position;\n }\n #wkh4VjTAjaoufeO2 $quadratic\_curve := records→curve→create;\n #QhyCPR4Zdh4NOY4N $quadratic\_curve→curve\_coordinates := records→curve\_coordinates→create;\n #gBIN0S28sWXUykZu $quadratic\_curve→curve\_type := records→curve\_type→create;\n #tvMxHHmSTM7PHa94 $quadratic\_curve→curve\_coordinates→starting\_position := $starting\_position;\n #X28Nsr3XOITnaBkv $quadratic\_curve→curve\_coordinates→ending\_position := $ending\_position;\n #DIdl2N8DcxYkv2Hg $quadratic\_curve→curve\_coordinates→control\_point\_1 := $control\_point\_1;\n #f5hmsWcp4S2eN19O $quadratic\_curve→curve\_type→quadratic := true;\n meta sync;\n}\n#t0C4DY22JLDdEscy\naction create\_cubic\_curve(#x6h6TaaPgHKDO7gq starting\_position: Vector3, #gDJ4gJkhHizaqFlX ending\_position: Vector3, #TmB5M8NjoJ2lBs6k control\_point\_1: Vector3, #U3IXXo25ooOmMVic control\_point\_2: Vector3) returns(#s3umkBL0FVZXRf8P cubic\_curve: \* curve) {\n #HaD455QFTu9Kmmh4 if $starting\_position→is\_invalid then {\n #o8ZFUsSrt2vtI5ih $starting\_position := math→create\_vector3(0, 0, 0);\n }\n #nyzhyZnLRkyTfOoW if $ending\_position→is\_invalid then {\n #Wq8bbWfOUMhV0vfT $ending\_position := $starting\_position;\n }\n #bJQFriL4pT29cC9S if $control\_point\_1→is\_invalid then {\n #yWYpTwBQD34GR2lw $control\_point\_1 := $ending\_position;\n }\n #xtBN4XnGyabP2V4i if $control\_point\_2→is\_invalid then {\n #qtbvV8FoH4YA42lq $control\_point\_2 := $control\_point\_1;\n }\n #k1j5hzCZVUqCnuNG $cubic\_curve := records→curve→create;\n #G7GZ7RYUq3kqi07I $cubic\_curve→curve\_coordinates := records→curve\_coordinates→create;\n #vUmEjsFYv6OcGSUo $cubic\_curve→curve\_type := records→curve\_type→create;\n #UG2y2tA81SITL4gf $cubic\_curve→curve\_coordinates→starting\_position := $starting\_position;\n #xn0GjvZkxU8kxaVI $cubic\_curve→curve\_coordinates→ending\_position := $ending\_position;\n #JemUCWZWu1SOwf3C $cubic\_curve→curve\_coordinates→control\_point\_1 := $control\_point\_1;\n #ECaVZA9btnoWuJBc $cubic\_curve→curve\_coordinates→control\_point\_2 := $control\_point\_2;\n #YrBn1KMZrX4TgA4W $cubic\_curve→curve\_type→cubic := true;\n meta sync;\n}\n#ZNA0dlqurm6004pA\naction t(#F59T6fonrwFyleDh curve: \* curve) returns(#USuMT2kcJHPTy44W t: Number) {\n #BNPB894IxhyW2HQ1 $t := $curve→t;\n meta sync;\n}\n#xQF020RkBGVVyk6v\naction set\_t(#ITrUtLENKqcpiKhS curve: \* curve, #Mz8zpSMjmtRhfsM4 t: Number) {\n #lx6BQ3uh6U0aVh2D $t\_normalized := code→get\_t\_normalized($t);\n #xErsRc442pI8MIjF $curve→t := $t\_normalized;\n meta sync;\n}\n#Iz7r3PDIXM9pk1P8\naction get\_position(#MpLGuVN2omjENOH3 curve: \* curve) returns(#H4A3XKIRQZ2cIyWt position: Vector3) {\n #IOmUE5YxcjOVquOs $position := math→create\_vector3(0, 0, 0);\n #CSD4EfBjFpHZKBUw if $curve→curve\_type→cubic then {\n #nAS7fjvrpgpk7Zfy $position := code→get\_cubic\_position($curve);\n }\n else { #rs9Heg28m8JASiSv if $curve→curve\_type→quadratic then {\n #mi8OsJj8gKmHb0IG $position := code→get\_quadratic\_position($curve);\n }\n else {\n #uo21j9pPEbxAz5I7 $position := code→get\_linear\_position($curve);\n }\n } \n meta sync;\n}\n#wpNIywjItgaEAdq6\nvar start\_time : DateTime {\n transient = true;\n}\n#x0rG3nPQf2YeS85f\nvar end\_time : DateTime {\n transient = true;\n}\n#lPEZEiWBOMYwuxLq\naction linear(#xy4JLw82GtHHd58X curve\_type: \* curve\_type) returns(#XB9UN4FlShhEoIe1 linear: Boolean) {\n #WUCE4ARYE4M1gBwI $linear := $curve\_type→linear;\n}\n#xUX85M3gzxDg4Wph\naction quadratic(#xKhbBw7tJMeehdtc curve\_type: \* curve\_type) returns(#IHwmsqecNh4S34kx quadratic: Boolean) {\n #xaJ4o1vcTayTqS3I $quadratic := $curve\_type→quadratic;\n}\n#hq5NH0n42OoOOXR6\naction cubic(#H5TlrqF6um1uFOcm curve\_type: \* curve\_type) returns(#KlcoCV4ZuYD303RB cubic: Boolean) {\n #IRH6QQFaltKJpWrz $cubic := $curve\_type→cubic;\n}\n”  
}  
]  
}

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [September 30, 2020, 1:50pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/4 "2020-09-30T13:50:52Z")

</div>

What fun code! I love it.

It’s also fun to see Touch Develop code again. It’s been a _very_ long time for me. I’ve forgotten how different the language is; it’s much more like Pascal.

I’d be interested to see if any of the code for the Touch Develop parser still exists. I don’t think this can be done with a simple line-by-line transpiler, since the Touch Develop environment is so different from the MakeCode Arcade environment.

I’m going to ponder on this and stare at your code a bit more to see how I’d approach this. In the meantime, perhaps we’ll hear from members of the Touch Develop team with their thoughts and perspective.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 3:45pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/5 "2020-09-30T15:45:26Z")

</div>

Thanks Alex,

I used the Bezier curves to move the enemies in a space invaders game. I would like to make this again, but also to make extensions so that others might be able to use the animations. TypeScript is new for me, as is Javascript, but with experience in C#, the transition shouldn’t be too hard. Any help in parsing this is appreciated, even if it is only formatting the Touch Develop code into something readable.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [September 30, 2020, 5:13pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/6 "2020-09-30T17:13:59Z")

</div>

Well, at the very least, I can help you with that last request!

> **Touch Develop code**
>
> ````json
> {
> “scripts”: [
> {
> “header”: {
> “cloudId”: “touchdevelop.com”,
> “scriptId”: “hnvib”,
> “userId”: “cqeba”,
> “status”: “published”,
> “lastUse”: 1526676178,
> “editor”: “touchdevelop”,
> “name”: “Bezier curves”,
> “comment”: “Formulas for calculating a linear, quadratic and cubic bezier curves were taken from:
> 
> http://caffeineowl.com/graphics/2d/vectorial/bezierintro.html
> 
> http://en.wikipedia.org/wiki/Bézier_curve”
> },
> “source”: “meta version “v2.2,js,ctx,refs,localcloud,unicodemodel,allasync”;
> meta name “Bezier curves”;
> meta icon “Share”;
> meta color “#ffff0038”;
> meta rootId “xu5kuZwm7kGpcsE4f4u05jDK”;
> meta isLibrary “yes”;
> meta allowExport “yes”;
> meta hasIds “yes”;
> meta platform “current”;
> meta parentIds “”;
> // Formulas for calculating a linear, quadratic and cubic bezier curves were taken from:
> // 
> // http://caffeineowl.com/graphics/2d/vectorial/bezierintro.html
> // 
> // http://en.wikipedia.org/wiki/Bézier_curve
> #OU78BBXCakSog0cs
> action main() {
> #M5PmWnaV1xVsDZc5 $board := media→create_landscape_board(800, 480);
> #LXJmho39gfcIFoHk $world := media→create_picture($board→width, $board→height);
> #N9FE1nZi9BCXCvhJ $board→set_background_picture($world);
> #xZqnFOalBAXGxhTq $heading_quadratic := $board→create_text(100, 20, 30, “Quadratic bézier curve”);
> #V4b15pnMPn2C3GkT $heading_quadratic→set_color(colors→black);
> #Y1AJeCftQeY5Gco3 $heading_quadratic→set_pos($board→width * .15, $board→height * .1);
> #skE87SD4hbacAG23 $heading_cubic := $board→create_text(100, 20, 30, “Cubic bézier curve”);
> #EWM2twfjzMR9OIj7 $heading_cubic→set_color(colors→blue);
> #CUaItpvU7hiPqC7G $heading_cubic→set_pos($heading_quadratic→x, $heading_quadratic→y + 50);
> #EY6KuXTB6A5VOOOO $heading_linear := $board→create_text(100, 20, 30, “Linear bézier curve”);
> #OpQW2IrBAgbwld43 $heading_linear→set_color(colors→orange);
> #EXXlLvjQZUw6pps1 $heading_linear→set_pos($heading_cubic→x, $heading_cubic→y + 50);
> #pSQtFEHjVq4S6wsF $starting_position_, $ending_position_, $control_point_1, $control_point_2 := code→get_points($board);
> #uNjc6BVBfUPjho6k $coordinates2 := records→curve_coordinates→create;
> #XexAgcX1PxdDx8oq $coordinates2→starting_position := $starting_position_;
> #WLEoNZM0WNfxd4xW $coordinates2→ending_position := $ending_position_;
> #vgYW17H3ihGbdIL7 $coordinates2→control_point_1 := $control_point_1;
> #mxOeHZrXgT2XNk4G $coordinates2→control_point_2 := $control_point_2;
> #F8B6UbbV2G2ye3xp code→set_positions_($coordinates2, $board);
> #EsADsDXYphVkY6qA $quadratic_sprite, $cubic_sprite, $linear_sprite := code→create_curve_sprites($board, $starting_position_);
> #bSf6VA3wpyq1CGdb $linear_curve := code→create_linear_curve($coordinates2→starting_position, $coordinates2→ending_position);
> #k68FnATYoq40OuNO $quadratic_curve := code→create_quadratic_curve($coordinates2→starting_position, $coordinates2→ending_position, $coordinates2→control_point_1);
> #xU1R0uQCZ1hEfS15 $cubic_curve := code→create_cubic_curve($coordinates2→starting_position, $coordinates2→ending_position, $coordinates2→control_point_1, $coordinates2→control_point_2);
> #xl3EBmkJAGabZJ9i $total := 1000;
> #iE2MeBI4ypdi9WxO for 0 ≤ i < $total do {
> #yafiaKcxvDdB1YVz $percentage := code→get_percentage($i, $total - 50);
> #qgd3sh7bL0ymaR9Q $linear_curve→t := $percentage;
> #omZI3L5vs5LUBhBo $quadratic_curve→t := code→get_percentage($i, $total);
> #xB09SKk4t12Dsueb $cubic_curve→t := $percentage;
> #sa4zWWq5qUDtqaoF $x := $linear_sprite→x;
> #zvESjCm4Asuy9djX $y := $linear_sprite→y;
> #tUosgwJ5Z36Rh8oo $position := code→get_position($linear_curve);
> #vpceeGa672Sq3J18 $linear_sprite→set_pos($position→x, $position→y);
> #B4xduxs4QSppmEdB $world→draw_line($x, $y, $linear_sprite→x, $linear_sprite→y, $linear_sprite→color, 3);
> #sFll6QZIKJS24zdV $x := $quadratic_sprite→x;
> #KOVb42z1MilCvxxU $y := $quadratic_sprite→y;
> #x22Kyr66jSIQRx0v $position := code→get_position($quadratic_curve);
> #cetl2cKiwvtgfuX2 $quadratic_sprite→set_pos($position→x, $position→y);
> #wASoeMqDMrCmaDeZ $world→draw_line($x, $y, $quadratic_sprite→x, $quadratic_sprite→y, $quadratic_sprite→color, 3);
> #dQBqLXg4Qse8qjJr $linear_curve→t := code→get_percentage($i, $total);
> #YNpfOe4nCc9uVeQk $x := $cubic_sprite→x;
> #US0LGLbfPgiuvXD0 $y := $cubic_sprite→y;
> #GYKMkR3HB3iBa3Vd $position := code→get_position($cubic_curve);
> #xqH0gZldC2eE2bu8 $cubic_sprite→set_pos($position→x, $position→y);
> #vY13h6HS0m0jxcZ4 $world→draw_line($x, $y, $cubic_sprite→x, $cubic_sprite→y, $cubic_sprite→color, 3);
> }
> #ZDPlP7rKKIEiJ355 $board→post_to_wall;
> #hhGJ3W0DgFG4d2KE time→run_after(3, $perform);
> #P7omeDlKOeqE6kW0 where perform() {
> #xJ7YfBkVmOe2fnit $duration := wall→ask_number(“Duration (seconds)?”);
> #xzKEc484zXw4Cn2O time→run_after(1, $perform2);
> #xLt82guSs45RbQOw where perform2() {
> #xI1KmvwmRPZLNw64 data→start_time := time→now;
> #xyJOeKYDgYPEJn7T data→end_time := data→start_time→add_seconds($duration);
> #AsPgpu4u0d73tSdn $board→add_on_every_frame($perform);
> #Yv3AGknK13H5Bc2y where perform() {
> #qkUsK18CvrOV40oV $x := $quadratic_sprite→x;
> #xNDo8SBQVWrg98sF $y := $quadratic_sprite→y;
> #zCBQ46tif6xyvhMt $percentage_ := time→now→subtract(data→start_time) / $duration;
> #x7J1hLrMClc5l6yc $linear_curve→t := $percentage_;
> #WSt2hWCY2mTl8Fgx $quadratic_curve→t := $percentage_;
> #nOrjWFxYIZciLsLy $cubic_curve→t := $percentage_;
> #SQquaehayr7qqP2y $position2 := code→get_position($quadratic_curve);
> #zyZzSeXLyQgvylKx $quadratic_sprite→set_pos($position2→x, $position2→y);
> #uEGuvB2edWYXXoN7 $world→draw_line($x, $y, $quadratic_sprite→x, $quadratic_sprite→y, $quadratic_sprite→color, 3);
> #RVVf6i4x7KWxfVsK $x := $cubic_sprite→x;
> #ouSLE4sSYFtnASD6 $y := $cubic_sprite→y;
> #JCEssJBFtM0R5NSa $position2 := code→get_position($cubic_curve);
> #ItTm8X26z1HADTr1 $cubic_sprite→set_pos($position2→x, $position2→y);
> #xLrNwnMwqT5TfhBL $world→draw_line($x, $y, $cubic_sprite→x, $cubic_sprite→y, $cubic_sprite→color, 3);
> #x3ZNk4yLS2JLuski $x := $linear_sprite→x;
> #xf7y4znK2ZBsw3Mg $y := $linear_sprite→y;
> #lInN15yoOxv5viDg $position2 := code→get_position($linear_curve);
> #iftETmffn52UWyN6 $linear_sprite→set_pos($position2→x, $position2→y);
> #lI4APdinnflXxmGF $world→draw_line($x, $y, $linear_sprite→x, $linear_sprite→y, $linear_sprite→color, 3);
> #Ws4ba5yoCmX0P0Wa if time→now→greater(data→end_time) then {
> #xBpe4RoTHp4Fx8iV data→start_time := time→now;
> #Q7MUzrbgeQNlSl5a data→end_time := data→start_time→add_seconds($duration);
> }
> #q69Zp4iQXu43voZA $board→update_on_wall;
> }
> }
> }
> meta private;
> meta test;
> }
> #TvhtlUTziZG2XzGy
> action get_points(#djMu4Peizo0nHHEv board: Board) returns(#KKQWn4ROgmjBF9it starting_position_: Vector3, #xrKbh12rbYv5A2Ch ending_position_: Vector3, #G0YlcOFnRfVoXc5Y control_point_1: Vector3, #x7PbVW4PjAOubF43 control_point_2: Vector3) {
> #xYaJs7C56D6rtBxj $starting_position_ := math→create_vector3(50, $board→height * .5, 0);
> #xAuacprD3DpFa03X $ending_position_ := math→create_vector3($board→width - 50, $board→height * .5, 0);
> #CU68LO3cE8XHj4gG $control_point_1 := math→create_vector3($board→width * .5, $board→height - 50, 0);
> #oYor5hbNh6Rwu4Zg $control_point_2 := math→create_vector3($board→width * .5, 50, 0);
> meta private;
> meta sync;
> }
> #fgfTCjyl12G8KS1y
> action set_positions_(#y2Zt4WPRpeDsUxuP curve_coordinates: * curve_coordinates, #sY76zkhs3Orbio4x board: Board) {
> #KHCXtfqSUmsV3ZLp // Marks the positions on the board with an eclipse (used for debugging)
> #G8PFTgvI2lzz3g3Y $starting_position_sprite := $board→create_ellipse(40, 40);
> #ddSE2BVcFWLXy0hp $starting_position_sprite→set_pos($curve_coordinates→starting_position→x, $curve_coordinates→starting_position→y);
> #mC2sTYsCTgY1OZiU $starting_position_sprite→set_color(colors→red);
> #AW4hRSSjgIrT2nKE $ending_position_sprite := $board→create_ellipse(40, 40);
> #NcN9OVhXouDGRdq3 $ending_position_sprite→set_pos($curve_coordinates→ending_position→x, $curve_coordinates→ending_position→y);
> #xOM55ElnT2ny5ux6 $ending_position_sprite→set_color(colors→green);
> #VHaBwA42B8FdDhCg if not $curve_coordinates→control_point_1→is_invalid then {
> #xw3TOoSiLD5Qx8Bj $control_point_sprite_1 := $board→create_ellipse(40, 40);
> #xzkacCMrBsAwbngC $control_point_sprite_1→set_pos($curve_coordinates→control_point_1→x, $curve_coordinates→control_point_1→y);
> #xyOx2QbdboOlIVn2 $control_point_sprite_1→set_color(colors→orange);
> }
> #xplcMlT5dC8dpFWo if not $curve_coordinates→control_point_2→is_invalid then {
> #xxb98JTJBn9UE5cH $control_point_sprite_2 := $board→create_ellipse(40, 40);
> #AATj14zOOsrfx2DO $control_point_sprite_2→set_pos($curve_coordinates→control_point_2→x, $curve_coordinates→control_point_2→y);
> #K42QQvsVF4HLhjzn $control_point_sprite_2→set_color(colors→gray);
> }
> meta private;
> meta sync;
> }
> #PL78y1hQLMFKi4e4
> action create_curve_sprites(#zCyxsx6SJ3kFY1or board: Board, #E9poXuwa3S6lBu5Y starting_position_: Vector3) returns(#x7EH9nWhY961tvD2 quadratic_sprite: Sprite, #sGKM1b3666TJMr82 cubic_sprite: Sprite, #pfouu53sThXfOaa4 linear_sprite: Sprite) {
> #sYaqdB2iht3oG4nG $quadratic_sprite := $board→create_rectangle(20, 20);
> #kQB3N9n4BXYzF6rx $quadratic_sprite→set_color(colors→black);
> #XS62MASfSwSSxzGj $quadratic_sprite→set_pos($starting_position_→x, $starting_position_→y);
> #wOHFoaTkMaG270hn $cubic_sprite := $board→create_rectangle(20, 20);
> #kj22exFE2HU74YiN $cubic_sprite→width := $quadratic_sprite→width / 2;
> #xjWTYy3bD4QPg09P $cubic_sprite→height := $quadratic_sprite→height / 2;
> #QK7xptRF2sqyIWZ1 $cubic_sprite→set_color(colors→blue);
> #i4Gl94pZNCuFJbP4 $cubic_sprite→set_pos($starting_position_→x, $starting_position_→y);
> #xrCfuCEelMDeQG43 $linear_sprite := $board→create_ellipse(20, 20);
> #xSuHXKTZ7T3C1MhQ $linear_sprite→set_pos($starting_position_→x, $starting_position_→y);
> #LDcW0UHgUZ2YnmBp $linear_sprite→set_color(colors→orange);
> meta private;
> meta sync;
> }
> #BdGhpbmca
> table curve_coordinates {
> type = “Object”;
> persistent = false;
> fields {
> #Ghaprprj8SGpRn3U starting_position : Vector3
> #xGKC1ws0WkjjxnNF ending_position : Vector3
> #oLlK07FLkLIaTexv control_point_1 : Vector3
> #MoVW1FkYTxg1eZ7A control_point_2 : Vector3
> }
> }
> #qrZgcIJNUt5oFvpm
> action get_linear_position(#VdEhaVdwLaKZ26Lr curve: * curve) returns(#x559wFU0yAqUNo0t position: Vector3) {
> #xUBDbxo2JJazoY8G // Gets the position (x,y) on a linear bézier curve based on the time elapsed and duration (t = 0 > t < 1)
> #jmVUwsGUyLG3xPEH // T = [0,1] (percentage of curve)
> #boUY6nsYHVSaTBko $curve→t := code→get_t_normalized($curve→t);
> #gU143MDtuLVv4A5d // (1-t)p0 + tp1
> #x7yWh1tr7RFweJeE $x := ((1 - $curve→t) * $curve→curve_coordinates→starting_position→x) + ($curve→t * $curve→curve_coordinates→ending_position→x);
> #roLW00pDYj4j3sgK $y := ((1 - $curve→t) * $curve→curve_coordinates→starting_position→y) + ($curve→t * $curve→curve_coordinates→ending_position→y);
> #qAcGvDorAY1tZK9l $position := math→create_vector3($x, $y, 0);
> meta private;
> meta sync;
> }
> #LpShD2CtzbNAlnPR
> action get_quadratic_position(#QyFst7XekNLW2rwQ curve: * curve) returns(#X4JqmaQ4z0QD4OgY position: Vector3) {
> #CLQ8ix41kVzLotej // Gets the position (x,y) on a quadratic bézier curve based on the time elapsed and duration (t = 0 > t < 1)
> #c8QkBRmpOLb1l76e // T = [0,1] (percentage of curve)
> #xrIFhSxvpi3OnyNF $curve→t := code→get_t_normalized($curve→t);
> #ZgWbfXTmjRZ9Azqs // P = (1-t)2•P1 + 2•(1-t) •t•C + t2•P2
> #xTQdK5SV4B4se1cX $x := math→pow((1 - $curve→t), 2) * $curve→curve_coordinates→starting_position→x + (2 * (1 - $curve→t) * $curve→t * $curve→curve_coordinates→control_point_1→x) + (math→pow($curve→t, 2) * $curve→curve_coordinates→ending_position→x);
> #iDrGm8K2rZiyXrk1 $y := math→pow((1 - $curve→t), 2) * $curve→curve_coordinates→starting_position→y + (2 * (1 - $curve→t) * $curve→t * $curve→curve_coordinates→control_point_1→y) + (math→pow($curve→t, 2) * $curve→curve_coordinates→ending_position→y);
> #SMNk1lEOwBOz4JMn $position := math→create_vector3($x, $y, 0);
> meta private;
> meta sync;
> }
> #nhfu28vQIJRdRJPD
> action get_cubic_position(#tZ9GVMgXEqNePWJb curve: * curve) returns(#ila22l2mwCFg7Wo3 position: Vector3) {
> #hYEL21UryJrRusid // 
> #dqMmeTaqegzCEaVY // Gets the position (x,y) on a cubic bézier curve based on the time elapsed and duration (t = 0 > t < 1)
> #xPBQBUIFVY1N9kf8 // T = [0,1] (percentage of curve)
> #v4zY5qb23EPsQAp2 $curve→t := code→get_t_normalized($curve→t);
> #rBGHDQoiOdmzJxH4 // P = (1-t)3•P1 + 3•(1-t)2•t•C1 + 3•(1-t)•t2•C2 + t3•P2
> #qhrZRThuNw4p0Ijk $x := (math→pow(1 - $curve→t, 3) * $curve→curve_coordinates→starting_position→x) + (3 * math→pow(1 - $curve→t, 2) * $curve→t * $curve→curve_coordinates→control_point_1→x) + (3 * (1 - $curve→t) * math→pow($curve→t, 2) * $curve→curve_coordinates→control_point_2→x) + (math→pow($curve→t, 3) * $curve→curve_coordinates→ending_position→x);
> #whtHsUYMcrgzkw2D $y := (math→pow(1 - $curve→t, 3) * $curve→curve_coordinates→starting_position→y) + (3 * math→pow(1 - $curve→t, 2) * $curve→t * $curve→curve_coordinates→control_point_1→y) + (3 * (1 - $curve→t) * math→pow($curve→t, 2) * $curve→curve_coordinates→control_point_2→y) + (math→pow($curve→t, 3) * $curve→curve_coordinates→ending_position→y);
> #xAUIk1mstjV2IhO1 $position := math→create_vector3($x, $y, 0);
> meta private;
> meta sync;
> }
> #xuXpAJPgL2DxDxYZ
> action get_t_normalized(#Z47arMG72YPSGHss t: Number) returns(#yZZfE1vlnyU7ERdS t_normalized: Number) {
> #cFAPQsXIDKZCOD9y $t_normalized := $t;
> #j184mZTSy5Bm272H if $t_normalized > 1 then {
> #j1ZbbEt2eOn28zI1 $t_normalized := 1;
> }
> else { #EAdR1p9xGBgELYzA if $t < 0 then {
> #O64r52Mi9CyMfqpD $t := 0;
> }
> else { } } 
> meta private;
> meta sync;
> }
> #vwry4nKnJq6R1cA5
> action get_percentage(#ltQxGTqNXtW2FOJc iteration: Number, #tZ94FbfuJo2SBPw3 total: Number) returns(#xVhdwcW9oJXCRoee percentage: Number) {
> #g1hzvYy14iEKqdTA // percentage = iteration / total
> #x8joQ2tXhrM6pumn $percentage := $iteration / $total;
> meta private;
> meta sync;
> }
> #YaPjwGRW5n1wfB4S
> action starting_position(#AsgYNBdtYgLy0nj8 curve_coordinates: * curve_coordinates) returns(#hm2hX2o46M6p9z20 starting_position: Vector3) {
> #hpfBVpQyhADvwMEH $starting_position := math→create_vector3($curve_coordinates→starting_position→x, $curve_coordinates→starting_position→y, 0);
> meta sync;
> }
> #HySlv4sJTQcbGm2B
> action ending_position(#jLEAP2LxrHBDnMiB curve_coordinates: * curve_coordinates) returns(#t4ZSzOO5NVXPXBe4 ending_position: Vector3) {
> #nGLWnCIgwQxwFB82 $ending_position := math→create_vector3($curve_coordinates→ending_position→x, $curve_coordinates→ending_position→y, 0);
> meta sync;
> }
> #f8BiKmgQ4a1C7hYI
> action control_point_1(#eO4RtGIrcCS7e5Q4 curve_coordinates: * curve_coordinates) returns(#mePeLc37tFTxephe control_point_1: Vector3) {
> #kXqNtXv64161iysj // Can return invalid -> vector3
> #XAF9ojeAwXKqR2jM $control_point_1 := invalid→vector3;
> #xlkdeQ1UkdN8cSBU if not $curve_coordinates→control_point_1→is_invalid then {
> #rDe3u8DeOpnlOWAy $control_point_1 := math→create_vector3($curve_coordinates→control_point_1→x, $curve_coordinates→control_point_1→y, 0);
> }
> meta sync;
> }
> #pODw76O8kXAsc1rU
> action control_point_2(#zNpLSKxz42YrzpBX curve_coordinates: * curve_coordinates) returns(#xt4ZCA2r0mNND6l6 control_point_2: Vector3) {
> #amoDJ1eE3rgJypXb // Can return invalid -> vector3
> #xQD5V8OI7MpsmXPR $control_point_2 := invalid→vector3;
> #FoPQ8tZ5pcK1z55C if not $curve_coordinates→control_point_2→is_invalid then {
> #h2CENz8Lf4CCfNXO $control_point_2 := math→create_vector3($curve_coordinates→control_point_2→x, $curve_coordinates→control_point_2→y, 0);
> }
> meta sync;
> }
> #vdkGV2qZXW7LAG9l
> action set_starting_position(#yQTzM0ByW2XOpNOi curve_coordinates: * curve_coordinates, #xCuwSTdArcU6gac6 starting_position: Vector3) {
> #HvR20r33AbrDvS4v $curve_coordinates→starting_position := $starting_position;
> meta sync;
> }
> #Hl0kN2P4vKwXtaQC
> action set_ending_position(#NfRc04X3uopqVcwI curve_coordinates: * curve_coordinates, #j0tD1qQLoagc8bn6 ending_position: Vector3) {
> #Oim2RIBjCNtk4VH7 $curve_coordinates→ending_position := $ending_position;
> meta sync;
> }
> #xLMBkcPQKv6oyCZT
> action set_control_point_1(#fbG4d3mVPNna056B curve_coordinates: * curve_coordinates, #RlAHLwJssLVg0H6y control_point_1: Vector3) {
> #lE3eClqWUGCRuBm2 $curve_coordinates→control_point_1 := $control_point_1;
> meta sync;
> }
> #xs5VSqG5ylf6hSiS
> action set_control_point_2(#OEY4sB9VB7pEvkbt curve_coordinates: * curve_coordinates, #JZWG1cVOEcpeOuDI control_point_2: Vector3) {
> #pYznP6smote5FfHE $curve_coordinates→control_point_2 := $control_point_2;
> meta sync;
> }
> #fATNKUyERCEta2cQ
> table curve {
> type = “Object”;
> persistent = false;
> fields {
> #ppUuSyAWkc2LBOkl curve_type : * curve_type
> #SW9cNy5ZPJw3WsDC curve_coordinates : * curve_coordinates
> #BknYaOvkqeHQwBgl t : Number
> }
> }
> #xk986ORLjlpbTDuF
> table curve_type {
> type = “Object”;
> persistent = false;
> fields {
> #W7vXqR6s7qF98Cs1 linear : Boolean
> #xtx4uiOHC5QwIOey quadratic : Boolean
> #xNRi3OXdgAOGUPOy cubic : Boolean
> }
> }
> #x7pQVfyVNAfv6MAh
> action coordinates(#VXs6zTgQT1UpFP2D curve: * curve) returns(#Whx3Nl4cybDUNgPF curve_coordinates: * curve_coordinates) {
> #MEx33U2Iin4ZlFWS $curve_coordinates := $curve→curve_coordinates;
> meta sync;
> }
> #b9jn7yvQIG6t6DfR
> action get_curve_type(#Hg72Sg3Eku7ZFV5t curve: * curve) returns(#qmxx86ggPXneJ6ct curve_type: * curve_type) {
> #khx0unplE14QdyNy $curve_type := $curve→curve_type;
> meta sync;
> }
> #FEcPoE2AI9MMGSdO
> action create_linear_curve(#xvLrqSHAkIH3lLx2 starting_position: Vector3, #xlOHhc2mUEvb3zjC ending_position: Vector3) returns(#xMOwiR3qnMDef7Xf linear_curve: * curve) {
> #VVIGxsbR2w5KC4gK if $starting_position→is_invalid then {
> #HUOrE4UlhgwFKBGs $starting_position := math→create_vector3(0, 0, 0);
> }
> #t4VxqQ1nbxaCBRhL if $ending_position→is_invalid then {
> #xAmvbjn7GxSkVX7z $ending_position := $starting_position;
> }
> #tNQwD3I244z5Gc7n $linear_curve := records→curve→create;
> #oSLBPyayxoZBfaED $linear_curve→curve_coordinates := records→curve_coordinates→create;
> #nwd2iNGy5jA8kZ0u $linear_curve→curve_type := records→curve_type→create;
> #f2JoeR12muo2QiDD $linear_curve→curve_coordinates→starting_position := $starting_position;
> #cyk4aAX926M7y1ls $linear_curve→curve_coordinates→ending_position := $ending_position;
> #mU4X4pWVbTuqH6Tr $linear_curve→curve_type→linear := true;
> meta sync;
> }
> #ibCTjaingbo8wyvI
> action create_quadratic_curve(#mO6VCyMhRLvoD2VJ starting_position: Vector3, #tBuwHIi2wctLx2hV ending_position: Vector3, #C44j5pXlUfcj0hmG control_point_1: Vector3) returns(#rS1ZMM6IUpFOo9Ph quadratic_curve: * curve) {
> #o4rHorpH6fh0AIpz if $starting_position→is_invalid then {
> #IEMb4LgmLaBJhhqi $starting_position := math→create_vector3(0, 0, 0);
> }
> #Xrx7b0MFUgSzX4HX if $ending_position→is_invalid then {
> #YVnWYRR322v70VOa $ending_position := $starting_position;
> }
> #lyyXnHihOZ4TknSe if $control_point_1→is_invalid then {
> #jpaADE3jQe39TVbY $control_point_1 := $ending_position;
> }
> #wkh4VjTAjaoufeO2 $quadratic_curve := records→curve→create;
> #QhyCPR4Zdh4NOY4N $quadratic_curve→curve_coordinates := records→curve_coordinates→create;
> #gBIN0S28sWXUykZu $quadratic_curve→curve_type := records→curve_type→create;
> #tvMxHHmSTM7PHa94 $quadratic_curve→curve_coordinates→starting_position := $starting_position;
> #X28Nsr3XOITnaBkv $quadratic_curve→curve_coordinates→ending_position := $ending_position;
> #DIdl2N8DcxYkv2Hg $quadratic_curve→curve_coordinates→control_point_1 := $control_point_1;
> #f5hmsWcp4S2eN19O $quadratic_curve→curve_type→quadratic := true;
> meta sync;
> }
> #t0C4DY22JLDdEscy
> action create_cubic_curve(#x6h6TaaPgHKDO7gq starting_position: Vector3, #gDJ4gJkhHizaqFlX ending_position: Vector3, #TmB5M8NjoJ2lBs6k control_point_1: Vector3, #U3IXXo25ooOmMVic control_point_2: Vector3) returns(#s3umkBL0FVZXRf8P cubic_curve: * curve) {
> #HaD455QFTu9Kmmh4 if $starting_position→is_invalid then {
> #o8ZFUsSrt2vtI5ih $starting_position := math→create_vector3(0, 0, 0);
> }
> #nyzhyZnLRkyTfOoW if $ending_position→is_invalid then {
> #Wq8bbWfOUMhV0vfT $ending_position := $starting_position;
> }
> #bJQFriL4pT29cC9S if $control_point_1→is_invalid then {
> #yWYpTwBQD34GR2lw $control_point_1 := $ending_position;
> }
> #xtBN4XnGyabP2V4i if $control_point_2→is_invalid then {
> #qtbvV8FoH4YA42lq $control_point_2 := $control_point_1;
> }
> #k1j5hzCZVUqCnuNG $cubic_curve := records→curve→create;
> #G7GZ7RYUq3kqi07I $cubic_curve→curve_coordinates := records→curve_coordinates→create;
> #vUmEjsFYv6OcGSUo $cubic_curve→curve_type := records→curve_type→create;
> #UG2y2tA81SITL4gf $cubic_curve→curve_coordinates→starting_position := $starting_position;
> #xn0GjvZkxU8kxaVI $cubic_curve→curve_coordinates→ending_position := $ending_position;
> #JemUCWZWu1SOwf3C $cubic_curve→curve_coordinates→control_point_1 := $control_point_1;
> #ECaVZA9btnoWuJBc $cubic_curve→curve_coordinates→control_point_2 := $control_point_2;
> #YrBn1KMZrX4TgA4W $cubic_curve→curve_type→cubic := true;
> meta sync;
> }
> #ZNA0dlqurm6004pA
> action t(#F59T6fonrwFyleDh curve: * curve) returns(#USuMT2kcJHPTy44W t: Number) {
> #BNPB894IxhyW2HQ1 $t := $curve→t;
> meta sync;
> }
> #xQF020RkBGVVyk6v
> action set_t(#ITrUtLENKqcpiKhS curve: * curve, #Mz8zpSMjmtRhfsM4 t: Number) {
> #lx6BQ3uh6U0aVh2D $t_normalized := code→get_t_normalized($t);
> #xErsRc442pI8MIjF $curve→t := $t_normalized;
> meta sync;
> }
> #Iz7r3PDIXM9pk1P8
> action get_position(#MpLGuVN2omjENOH3 curve: * curve) returns(#H4A3XKIRQZ2cIyWt position: Vector3) {
> #IOmUE5YxcjOVquOs $position := math→create_vector3(0, 0, 0);
> #CSD4EfBjFpHZKBUw if $curve→curve_type→cubic then {
> #nAS7fjvrpgpk7Zfy $position := code→get_cubic_position($curve);
> }
> else { #rs9Heg28m8JASiSv if $curve→curve_type→quadratic then {
> #mi8OsJj8gKmHb0IG $position := code→get_quadratic_position($curve);
> }
> else {
> #uo21j9pPEbxAz5I7 $position := code→get_linear_position($curve);
> }
> } 
> meta sync;
> }
> #wpNIywjItgaEAdq6
> var start_time : DateTime {
> transient = true;
> }
> #x0rG3nPQf2YeS85f
> var end_time : DateTime {
> transient = true;
> }
> #lPEZEiWBOMYwuxLq
> action linear(#xy4JLw82GtHHd58X curve_type: * curve_type) returns(#XB9UN4FlShhEoIe1 linear: Boolean) {
> #WUCE4ARYE4M1gBwI $linear := $curve_type→linear;
> }
> #xUX85M3gzxDg4Wph
> action quadratic(#xKhbBw7tJMeehdtc curve_type: * curve_type) returns(#IHwmsqecNh4S34kx quadratic: Boolean) {
> #xaJ4o1vcTayTqS3I $quadratic := $curve_type→quadratic;
> }
> #hq5NH0n42OoOOXR6
> action cubic(#H5TlrqF6um1uFOcm curve_type: * curve_type) returns(#KlcoCV4ZuYD303RB cubic: Boolean) {
> #IRH6QQFaltKJpWrz $cubic := $curve_type→cubic;
> }
> ”
> }
> ]
> }```
> 
> ````

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 5:21pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/7 "2020-09-30T17:21:45Z")

</div>

That is fantastic Alex! That makes the code much more readable, and I am really impressed with quick response.

Is there any chance I could send you the rest of the code? I have another 5 files.  
I don’t mind that others see the code, since this platform is all about sharing code and being open-source. If I can send the other files, would it be better to send them via email?

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [September 30, 2020, 5:36pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/8 "2020-09-30T17:36:44Z")

</div>

I’m a C# coder at heart, too. JavaScript and, even more so, TypeScript are easy languages to pick up with that background. The thing that sometimes gets me is the peculiar syntax that JavaScript has for declaring variables. I keep wanting to write them the C# way and IntelliSense keeps yelling at me. 😄

I’ll give you time to port your code. I find it’s a great way to learn a language. Please feel free to ask for help if you need any.

There are several nice documents in the MakeCode documentation about creating extensions. Once you’ve ported your code, I’ll be happy to help you with creating extensions.

* * *

Regarding your other files, we could work on them together via GitHub if you’d like. You can find me there as **alex-kulcsar**. Might be the best way to collaborate on this code if we treat it like a project. Since you’re porting your code to MakeCode Arcade, that might be the best way to start.

- Create a GitHub project within MakeCode Arcade.
- Add the Touch Develop code to your new project via the GitHub web site.
- Invite me as a collaborator.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 5:52pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/9 "2020-09-30T17:52:50Z")

</div>

I agree with you on the quirkiness of the syntax; but I also see that as an advantage in offering flexibility.

Working on the code together in GitHub sounds like a good idea; I will get back to you on that. To be honest, I am somewhat of an amateur to GitHub, since I have been cradled using tools such as Visual Studio and Bitbucket. I will keep in touch.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [September 30, 2020, 5:55pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/10 "2020-09-30T17:55:50Z")

</div>

Just in case you need it, here’s MakeCode Arcade’s documentation. MakeCode Arcade makes it pretty easy to work with GitHub, too.

> **[GitHub with MakeCode](https://arcade.makecode.com/github)**
>
> GitHub is a popular web site used by developers to host and work together on code. Using the GitHub integration in MakeCode, you can easily and freely host your programs and collaborate on them with friends.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 7:39pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/11 "2020-09-30T19:39:40Z")

</div>

I have indeed logged into my GitHub account and linked that to MakeCode. I am quite impressed with what MakeCode already offers in terms of integration. I will be taking baby steps with MakeCode, to first familiarize myself with the block code, and then moving on to creating extensions.

I am also curious as to how you formatted the Touch Develop code. Was that done using something from the old platform, of did you just simply use something that parses the string value?

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [September 30, 2020, 10:23pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/12 "2020-09-30T22:23:27Z")

</div>

@AlexK  
Baby steps project dealing with linear movement:

> **[Linear movement](https://arcade.makecode.com/87141-39649-38589-69577)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I don’t understand why the code does not work with blocks, maybe I need to add markdown for certain functions.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [October 1, 2020, 2:05am UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/13 "2020-10-01T02:05:11Z")

</div>

Yup; baby steps are a good thing! If you’re comfortable with the TypeScript environment, then, at least for this project, you probably want to stay there…especially if you’re planning on writing an extension. You can worry about the Blocks parts later. (Short answer: The TS code needs to be both structured and then annotated in a specific way in order for blocks to appear in the toolbox.)

You’ll definitely want to get into the Blocks environment, though, to gain an understanding of the interface before you try to develop an extension. I’d suggest using the Blocks tutorials in the **Tutorials** or the **Game Design Concepts** sections of the home page. They’re great introductions to the MakeCode Arcade interface, and they provide you with a bit of a glimpse into the philosophy behind the MakeCode Arcade project.

Regarding your Touch Develop JSON: I cheated. 🙂 All I did was load your code into a text editor and then replace `\n` with an actual newline. I’m not a Microsoft employee, past or present, and so I don’t have access to the Touch Develop source code. I’m simply a user and massive fan of both platforms…and a _very occasional_ contributor to the MakeCode Arcade platform.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [October 1, 2020, 7:24pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/14 "2020-10-01T19:24:21Z")

</div>

@AlexK  
I was able to get part of the code working in blocks. I know that the annotations are not entirely correct. I took a shortcut and used examples from the game extension (sprites.ts & sprite.ts). I will take a look at the documentation:

> **[Defining blocks](https://makecode.com/defining-blocks)**
>
> This section describes how to annotate your MakeCode APIs to expose them in the Block Editor.

[https://makecode.com/playground](https://makecode.com/playground)

For now it is so much information, I need to let it all sink in.

> **[Linear movement blocky](https://arcade.makecode.com/13950-98842-36806-69886)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 4, 2020, 9:55pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/15 "2020-10-04T21:55:36Z")

</div>

We had some code to convert touchdevelop programs… but it’s long gone now sorry.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [October 4, 2020, 10:10pm UTC](https://forum.makecode.com/t/porting-touch-develop-games/3686/16 "2020-10-04T22:10:39Z")

</div>

That is a pity; as that would have saved my a lot time recreating old games. Was ‘that code’ for converting block code, or written code? I’m sure someone has the tool lying around somewhere.
