Skip to content

Instantly share code, notes, and snippets.

@dz0
Last active February 24, 2017 07:16
Show Gist options
  • Select an option

  • Save dz0/c518144cdb6a0fbc22b34f6e17c526db to your computer and use it in GitHub Desktop.

Select an option

Save dz0/c518144cdb6a0fbc22b34f6e17c526db to your computer and use it in GitHub Desktop.
int x=100, y=100;
int vx=5, vy=3;
void setup(){
size(600, 600);
}
void draw(){
background(255);
fill(0, 200, 0);
ellipse( x, y, 30, 30);
// judesys -- suveikia kas akimirką (ne kas sekundę)
x += vx;
y += vy;
if(x >= width) x = 0;
if(y >= height) vy = -vy;
// info
fill( 0, 0, 100 );
text("x: "+x + ", y: "+y, 30, 30);
text("vx: "+vx + ", vy: "+vy, 30, 60);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment