-
Notifications
You must be signed in to change notification settings - Fork 2
/
player.pde
57 lines (54 loc) · 1.34 KB
/
player.pde
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class player{
float xPos,yPos,ySpeed;
player(){
xPos = 300;//タイトル画面のプレイヤーのx軸 // player x co-ordinates
yPos = 340;//タイトル画面のプレイヤーのy軸 // player y co-ordinates
}
void drawplayer(){
stroke(255);
noFill();
strokeWeight(2);
ellipse(xPos,yPos,20,20);//操作キャラの大きさ
}
void jump(){
ySpeed=-3;//ジャンプで上がる高さ
}
void drag(){
ySpeed+=0.2;//落ちる速さ
}
void move(){
yPos+=ySpeed;
for(int i = 0;i<3;i++){ // i = no.of walls
p[i].xPos-=3;//スクロールスピード //game speed
}
}
//
void invi(){
if (intro && count == 0) {
// 当たったときの処理
count = 30; // 無敵時間をセット //invincible period in seconds
}
if (count > 0) {
xPos = 0;
--count;
if (count <= 0) {
// 無敵時間の終わり //invincible period
count = 0;
intro = false;
}
}
}
// collision
void checkCollisions(){
if(yPos>800){
end=false;
}
//↓当たり判定 // collision
for(int i = 0;i<3;i++){ // p == pillar
if((xPos<p[i].xPos+10 && xPos>p[i].xPos-10) // 10 pixel before and after piller
&&(yPos<p[i].wallSpace-100||yPos>p[i].wallSpace+100)){ //
end=false;
}
}
}
}