Wiki

Clone wiki

Core / kidintro

We just set the stage for Spritey.

Now it is time to add him.

Our code starts like this:

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
end

-- This function gets called once every frame
function draw()
    -- This sets the background color to black
    background(0, 0, 0)
    -- Do your drawing here
    sprite("SpaceCute:Background",374,374)
end

When we added the background we typed the whole thing in.

This time we will look at the list of the sprites.

Add this:

    -- Do your drawing here
    sprite("SpaceCute:Background",374,374)
    sprite()
end

The () will be blue.

Press it.

You can pick what picture you want Spritey to be.

    -- Do your drawing here
    sprite("SpaceCute:Background",374,374)
    sprite("Planet Cute:Character Boy")
end

I picked Planet Cute:Character Boy.

Now play your program.

Ut-oh, he is not really all the way on the screen.

Let's add some numbers just like we did for the background.

sprite("Planet Cute:Character Boy",100,100)

There, all better.

Now it is time for some Hide and Seek

Updated