Wiki

Clone wiki

Core / kidcircle

After playing with gravity our code was as so:

-- Use this function to perform your initial setup
function setup()
    spx = 100 -- Spritey x
    spy = 100 -- Spritey y
    print("Hello World!")
    print("Look at me go!")
    parameter.watch("spx")
    parameter.watch("spy")
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)
    spx = spx + Gravity.x
    spy = spy + Gravity.y
    tint(0, 255, 0, 255)
    sprite("Planet Cute:Character Boy",spx,spy,101/2,171/2)
end

function touched(touch)
    spx = touch.x
    spy = touch.y
end

Now add this line to blow a bubble.

    sprite("Planet Cute:Character Boy",spx,spy,101/2,171/2)
    ellipse(200,100,90,90)
end

If you move Spriety to the bubble, he goes behind it.

Just like the we drew Spritey after the background, which puts Spritey on top..

We drew the bubble after Spriety, which puts the bubble on top.

The first two numbers, 200, 100, are the position just like Spritey.

Then next two numbers, 90, 90, is the size, just like we shrank Spritey.

It is called and ellipse because it doesn't have to be a circle.

Try ellipse(200,100,45,90)

It makes an oval.

Let us color our bubble

Updated