createSprite is not defined

I have a student that has a game that he would like to run outside of code.org. He has put all of his code in an index.html file so that he can run it on Visual Studio. The problem he is having is that when he goes to run it he gets an error code that says “createSprite is not defined.” He is running it on Live Server extenstion. for Visual Studio. After he gets the createSprite is not defined, the next line says: “Failed to load resources the server responded with a status of 404 not found.”

The question is is how can he get code to run outside of code.org. He wants to begin creating things outside and wants to know how to run the code/program. How can he do that?

Here is what he is trying to run:
var snowman = createSprite(300,300);

snowman.setAnimation(“snowmanL.png”);

function draw() {

background(“grey”);

if (keyDown(“a”)) {

snowman.setAnimation(“snowmanL.png”);

snowman.x = snowman.x - 5;

}

if (keyDown(“d”)) {

snowman.setAnimation(“snowmanR.png”);

snowman.x = snowman.x + 5;

}

if (keyDown(“space”))

snowman.rotation = randomNumber(10,360)

drawSprites();

}

You can create the game on game lab, then use an embed to put it in an <iframe>. However there is something called an embed: https://studio.code.org/gamelab/GAMEID/embed

I think this is a similar question.

Hi @hensleyn,

This is another nice post about running Game Lab outside of Code.org. I attached a screenshot of where you can find the export feature (located in the SHARE dialog box) so that all the sprite libraries/assets are exported and imported into other tool.
Migrating Game Lab Code off Code.org With p5.play

Hope it is helpful!
Michelle