기능 단위 팩맨 |
|||||
---|---|---|---|---|---|
작성자 | 김용남 | 등록일 | 21.07.28 | 조회수 | 62 |
int x = int(random(width)); int y = int(random(height));
int xspeed = 2; int yspeed = 1;
int size = 50;
void setup(){ size(640, 480); }
void draw(){ println(frameCount); background(0); move(); display(); }
void display(){ fill(random(255), random(255), random(255)); // random(5); if(frameCount % 60 < 30){ arc(x, y, size, size, 0.5, 5.78); } else { arc(x, y, size, size, 0.1, 6.18); } }
void move(){ x = x + xspeed; y = y + yspeed;
if(x < 0 || x > 640){ xspeed= -xspeed; } if(y < 0 || y > 480){ yspeed = -yspeed; } }
void mousePressed(){ x = int(random(width)); y = int(random(height));
xspeed = int(random(10)); yspeed = int(random(10));
size = 50; } |
이전글 | 팩맨 |
---|---|
다음글 | 팩맨 |