팩맨 |
|||||
---|---|---|---|---|---|
작성자 | 심소은 | 등록일 | 21.07.28 | 조회수 | 56 |
int x1 = int(random(width));
int y1 = int(random(height));
int xspeed1 = 2;
int yspeed1 = 1;
int size = 50;
int mouthtime = 0;
void setup(){
size(640, 480);
}
void draw(){
println(frameCount);
background(0);
move();
fill(random(255), random(255), random(255)); // random(5);
if(frameCount % 60 < 30){
arc(x1, y1, size, size, 0.5, 5.78);
} else {
arc(x1, y1, size, size, 0.1, 6.18);
} }
void move(){ x1 = x1 + xspeed1;
y1 = y1 + yspeed1;
if(x1 < 0 || x1 > 640){
xspeed1 = -xspeed1;
}
if(y1 < 0 || y1 > 480){
yspeed1 = -yspeed1;
} }
void mousePressed(){
x1 = int(random(width));
y1 = int(random(height));
xspeed1 = int(random(10));
yspeed1 = int(random(10));
size = 50;
} |
이전글 | 기능 단위 팩맨 |
---|---|
다음글 | 몬드리안 실습 |