Numbers

Ping pong
[p5js code canvas]
float x;
float y;
float speedx;
float speedy;
float radius;
float gameScore;
float recty;
float easing = 0.1;
void setup() {
size(600,400);
x = 300;
y = 300;
speedx = 20;
speedy = 10;
radius = 20;
frameRate(30);
}
void draw () {
background(0,0,0);
noStroke();
ellipseMode(CENTER);
ellipse(x, y, radius*2, radius*2);
rect(580,mouseY,20,100);
rectMode(CENTER);
textAlign(CENTER);
rect(20,recty,20,100);
rectMode(CENTER);
textSize(30);
text(“SCORE: “+gameScore, 100, 50);
x = x+speedx;
y = y+speedy;
if(y+radius >= height || y-radius <=0) { speedy = -speedy; fill(random(255),random(255),random(255)); } if(x+radius >= width-40 && y + 50 > mouseY && y-50 < mouseY) { speedx = -speedx+2; fill(random(255),random(255),random(255)); gameScore++; } if(recty > y-radius) {
recty = recty-random(90,100) * easing;
}
if(recty < y-radius) { recty = recty+random(90,100) * easing; } if(x-radius <= 40 && y>= recty-50 && y <= recty+50) { speedx = -speedx + 2; } if(x-radius <= 0) { textSize(40); fill(255,255,255); textAlign(CENTER); text("GAME OVER ", width/2, 150); text("YOU WON", width/2, 200); text("click anywhere to restart", width/2, 250); x = random(80,100); y = random(20,200); x = x+speedx; y = y+speedy; noLoop(); recty = y; } if(x+radius >=width) {
textSize(40);
//fill(255,255,255);
textAlign(CENTER);
text(“GAME OVER “, width/2, 150);
text(“YOU LOST”, width/2, 200);
textSize(20);
text(“click anywhere to restart”, width/2, 240);
x = random(80,100);
y = random(20,200);
x = x+speedx;
y = y+speedy;
recty = y;
noLoop();
}
}
void mouseClicked() {
gameScore = 0;
loop();
redraw();
}
[/p5js]
Flappy bird time game
Voronoi and Dleaunay shapes
Other games available at resources.
Games to learn numbers:
Counting goblins game
Responsive and interactive image maps created for numbers:

Erasmus+ project 2015-2017