Arkanoid – początek
Poniżej początek kodu do naszej gry typu Arkanoid:
PVector location, velocity; void setup(){ size(600, 400); location = new PVector(300, 200); velocity = new PVector(random(10), random(10)); } void draw(){ background(0, 0, 0); ellipse(location.x, location.y, 30, 30); location.x = location.x + velocity.x; location.y = location.y + velocity.y; if(location.y > height || location.y < 0){ velocity.y = - velocity.y; } if(location.x > width || location.x < 0){ velocity.x = - velocity.x; } }