-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpillar.pde
More file actions
37 lines (33 loc) · 922 Bytes
/
pillar.pde
File metadata and controls
37 lines (33 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//障害物の壁
class pillar{
float xPos, wallSpace;
boolean cashed = false;
pillar(int i){
xPos = 200+(i*280);//棒と棒の間隔が狭まる(1)
wallSpace = random(400)+100;//壁が出てくる範囲(上)
}
void drawPillar(){
line(xPos,0,xPos,wallSpace-100);//壁のない範囲
line(xPos,wallSpace+100,xPos,800);//壁のない範囲、
}
void checkPosition(){
if(xPos<0){
xPos+=(280*3);//棒と棒の間隔が広がる(1)
wallSpace = random(400)+100;//壁が出てくる範囲(下)
cashed=false;
}
if(xPos<250&&cashed==false){//
cashed=true;
score=score+1;//スコアの追加する点数
}
}
}
void reset(){
end=true;
score=0;//スコアの初期値は0
b.yPos=100;//ボールの開始位置
for(int i = 0;i<3;i++){
p[i].xPos+=550;//スタートから壁が出てくるまでの範囲
p[i].cashed = false;
}
}