Run MakeCode's Python Code on a Raspberry Pi?

We cannot run MakeCode on a Raspberry Pi. Our school district blocks RPi internet access. So, our students want to take the Arcade-generated Python code for a game and run it as a pure Python program on a Raspberry Pi 4. Does Microsoft provide the graphics library, sprite files, etc?

For example, what library provides this function?

controller.move_sprite(…)

Code.org, for example uses the p5.play library and it’s open source. Here’s an example of a simple Arcade-generated Python listing of the type we want the kids to run on the RPi’s. Our middle-school students would provide the sprites. Any help is greatly appreciated.

scene.set_background_color(0)
scene.set_background_image(img(“”" {garbage-image numbers removed for clarity}
“”“))
pizza = sprites.create(img(”“” {garbage-image numbers removed for clarity}]
“”"),
SpriteKind.player)
pizza.x = 50
pizza.x = 50

def on_forever():
mySprite: Sprite = None
controller.move_sprite(pizza, 12, 15)
controller.move_sprite(mySprite, 100, 100)
forever(on_forever)

1 Like

You can’t do that. But you can install the makecode arcade pi0 os but that would not work with a pi4 only pi0. So Yeah.

1 Like

Hi @MicroGuy,

You would not be able to easily interpret/compile MakeCode Python code into a game and run it on a RPi, since MakeCode Python is only an translation layer on top of MakeCode Static TypeScript(JavaScript), which can be run online in the simulator or compiled into executables for different supported hardware.

However, when first compiled to the supported RPi0 hardware in the editor and downloaded to .elf files, these games actually work on most ARM hardware running Linux(RPi0, 1, 2, 3, 4 etc.).

Not only on “pi0” and not requiring the “arcade pi0 os” as @robotosaurus incorrectly/inaccurately claims above.

Lacking internet access for your RPis, you could transfer the .elf game files by e.g. USB thumb drives.