File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1616import pyxel
1717
1818TRANSPARENT_COLOR = 2
19+ FLOOR_YI = 10
1920
2021_height = 0
2122player = None
@@ -28,11 +29,11 @@ def is_colliding(y, is_falling):
2829 y2 = (pyxel .ceil (y ) + 7 ) // 8
2930
3031 for yi in range (y1 , y2 + 1 ):
31- if yi >= 10 :
32+ if yi >= FLOOR_YI :
3233 return True
3334
3435 if is_falling and y % 8 == 1 :
35- if y2 >= 10 :
36+ if y2 >= FLOOR_YI :
3637 return True
3738 return False
3839
@@ -84,7 +85,7 @@ def update(self):
8485 if not self .space_pressed : # スペースが新たに押された
8586 self .space_pressed = True
8687 # 地面にいるか、空中で1回目のジャンプができるか
87- if self .dy == 10 and not self .is_falling :
88+ if self .dy == FLOOR_YI and not self .is_falling :
8889 # 地面からのジャンプ
8990 self .dy = - 8
9091 self .jump_count = 1
@@ -111,7 +112,7 @@ def update(self):
111112 self .is_falling = self .y > last_y
112113
113114 # 地面に着いたらジャンプカウントをリセット
114- if self .dy == 10 and not self .is_falling :
115+ if self .dy == FLOOR_YI and not self .is_falling :
115116 self .jump_count = 0
116117
117118 if self .y >= _height :
You can’t perform that action at this time.
0 commit comments