Wiki

Clone wiki

Core / kidrect

When we were done coloring bubbles we had this:

-- 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)
    fill(0,0,255,255)
    ellipse(200,100,100,100)
end

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

First, let's hide our bubble using a comment. This is that dash dash -- we put in front of things to hide it from the program but so we can still read it ourselves.

    fill(0,0,255,255)
    --ellipse(200,100,100,100)
    end

Now play.

Our bubble is hidden, but, we knew that would happen.

It is time for our square bubble.

Add this:

    fill(0,0,255,255)
    --ellipse(200,100,100,100)
    rect(200,100,100,100)
    end

We have a square bubble. How silly is that?

Notice it is the same color as our regular bubble.

This is because the fill(0,0,255,255) we left in.

OK, let us stop being silly and put our round bubble back.

    fill(0,0,255,255)
    ellipse(200,100,100,100)
    --rect(200,100,100,100)
    end

Maybe a bubble we could see through would be better.

Updated