Litlle games

I search little games (easy) for children for learning programming

Topic1
Basic: script, background, text, …

Topic 2
Constants and variables

Topic3
Functions (for ex. Math:+\-\:/x)

Topic4
Selection structure (if-then)

Topic 5
Repetition structure (while/do-until)

Explanation:
In topic 2 you can use knowledge of topic 1,…
But don’t use knowledge of topic 3 in topic 1 …,

You have ideas?

A racing game, make them have a few sprites on a screen, going in some direction towards the “finish line”

Also, a “whack a mole” game, a bit more complex, since it uses basics of math, but they should get the hang of it pretty fast.

@AnnSophie Here’s a little game I just wrote. I’m not sure where it fits in your list, but you can save it for when it’s appropriate. It’s a racing game. Two players move their finger on the screen to move the circles up the screen. One player on the left, the other on the right. The faster they move their fingers, the faster the circles move up the screen. The winner is the first one to the finish line.


displayMode(FULLSCREEN)

function setup()
    x1=200    -- starting x,y of circle 1
    y1=0
    x2=WIDTH-200    -- starting x,y of circle 2
    y2=0
    v1=1    -- speed of circle 1
    v2=1    -- speed of circle 2
end

function draw() 
    background(40,40,50)    -- clear screen
    
    stroke(255)    -- draw finish line
    strokeWidth(2)
    line(0,HEIGHT-100,WIDTH,HEIGHT-100)
    
    fill(255,0,0)    -- fill and draw circle 1
    ellipse(x1,y1,100)
    
    fill(0,255,0)    -- fill and draw circle 2
    ellipse(x2,y2,100) 
    
    fill(255)  -- check who the winner is
    if y1>HEIGHT-150 then
        text("WINNER",x1,HEIGHT-200)    -- circle 1 winner
        v2=0    -- stop circle 2
    end
    if y2>HEIGHT-150 then
        text("WINNER",x2,HEIGHT-200)    -- circle 2 winner
        v1=0    -- stop circle 1
    end
end

function touched(t)
    if t.state==MOVING then    -- check if finger is moving on screen
        if t.x<WIDTH/2 then    -- moving on left side of screen
            y1=y1+v1    -- add speed to circle 1
        else
            y2=y2+v2    -- add speedcto circle 2
        end
    end    
end

@AnnSophie Here’s another game I just wrote. Object is to tap the random circle. It shows how many time it was hit and how many times it was missed.


displayMode(FULLSCREEN)

function setup()
    fill(255)    -- set fill value
    count=60    -- set count
    hit=0    --set hit
    miss=0
end

function draw() 
    background(40,40,50)    -- clear screen
    text("Hit  "..hit.."  Miss  "..miss,WIDTH/2,HEIGHT-50)    -- show hit count
    count=count+1    -- add 1 to count
    if count>45 then    -- count greater than 45, new x,y position
        count=0    -- set count to 0
        x=math.random(50,WIDTH-50)    -- random x position
        y=math.random(50,HEIGHT-50)    -- random y position
    end
    ellipse(x,y,100)    -- draw ellipse
end

function touched(t)
    if t.state==BEGAN then    -- touch began
        v1=vec2(t.x,t.y)    -- set v1 to vec2 value
        if v1:dist(vec2(x,y))<50 then    -- touch inside circle
            hit=hit+1    -- add 1 to hit
            sound(SOUND_EXPLODE, 40387)    -- play sound
        else
            miss=miss+1
        end
    end
end

@AnnSophie A program to draw on the screen.


displayMode(FULLSCREEN)

function setup()
    backingMode(RETAINED)    -- screen to draw on
    x=-10    -- start x position
    y=-10    -- start y position
end

function draw() 
    fill(38, 220, 166, 255)    -- set fill color
    ellipse(x,y,10)    -- draw ellipse
end

function touched(t)
    if t.state==MOVING then    -- touch is moving
        x=t.x    -- touch x position
        y=t.y    -- touch y position
    end
end