int x=50,y=50,point=0;
int boX=300,boY=300;
void setup(){
size(500,500);
background(0);
rectMode(CENTER);
}
void draw(){
background(0);
rect(boX,boY,30,30);
text(point,10,20);
if (keyPressed) {
if (key == 'w' || keyCode == UP){
y=(y-5);
if (y==0)
y=height;
}
if (key == 's' || keyCode == DOWN){
y=(y+5)%height;
}
if (key == 'a' || keyCode == LEFT){
x=x-5;
if (x==0)
x=width;
}
if (key == 'd' || keyCode == RIGHT){
x=(x+5)%width;
}
}
ellipse(x,y,20,20);
if (x<=boX+15 && x>=boX-15 && y>=boY-15 && y<=boY+15){
point+=1;
boX=int(random(width-50));
boY=int(random(height-50));
}
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
commit เพิ่มเติม : เพื่ม userstory, bookmark
>> add userstory ทำการเพิ่ม userstory ใน functional tests >> add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...
-
1 2 3 4 5 6 7 8 9 def setup (): print (d2b( 8 )) def d2b (num): x = "" while num > 0 : x = str ( int (n...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 def test_layout_and_styling ( self ): # Edith goes to the home page self . brow...
-
การใช้ template inheritence คือการสืบทอดเทมเพลต เพื่อให้ไม่ต้องเขียนโค้ดหน้าเว็บๆซ้ำๆ เราจะมีหน้าหลักอันเดียว (base.html or parent) ภายในนั...
ไม่มีความคิดเห็น:
แสดงความคิดเห็น