Skip to content

Commit ba08ba5

Browse files
Fix location of tiles added, enhancing the graphics of Bad apple
1 parent edecbf4 commit ba08ba5

File tree

4 files changed

+53
-15
lines changed

4 files changed

+53
-15
lines changed

game.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def run_FGHJ(screen,clock,song_name,stage_speed,offset,judgement_shown,guide_lin
260260
####### change background color! ########
261261
change_background_color = 1
262262
screen.fill(background_color[change_background_color])
263+
tile.fix_loc()
263264
for T in tiles_off_screen + nodes_on_screen + holds_on_screen:
264265
T.draw(screen,screen_freeze)
265266
draw_frame(screen)

tiles.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
class Node():
1212
def __init__(self,line,point,special = None):
13+
global judgement_line, height
14+
self.judgement_line = judgement_line
15+
self.height = height
16+
1317
self.name = 'node'
1418
self.y = node_spawning_y_pos
1519
self.line = line # 몇 번 line에 넣을지 결정
@@ -37,13 +41,18 @@ def draw(self, screen, screen_freeze = False):
3741
def move(self,speed):
3842
self.y += (speed*10/fps)
3943

44+
def fix_loc(self, loc = None):
45+
if loc:
46+
self.y = loc
47+
else:
48+
self.y = self.judgement_line
49+
4050
def check_border(self):
41-
global judgement_line, height
42-
if self.special == 'BadApple' and self.y > judgement_line: # 'Late' for special node
51+
if self.special == 'BadApple' and self.y > self.judgement_line: # 'Late' for special node
4352
#print('border cross for Bad apple!')
4453
return True # border crossed for special node
4554

46-
if self.y >= height: # then node arrived at the border!
55+
if self.y >= self.height: # then node arrived at the border!
4756
#print("Border!")
4857
return True
4958
else:
@@ -56,6 +65,10 @@ def special_effect(self):
5665

5766
class Hold():
5867
def __init__(self,line,point,length,special=None):
68+
global judgement_line, height
69+
self.judgement_line = judgement_line
70+
self.height = height
71+
5972
self.name = 'hold'
6073
self.y = node_spawning_y_pos # hold 노드의 y 값은 제일 아래쪽의 y좌표이다. 즉, 홀드 노드의 시작점 좌표!
6174
self.length = length
@@ -88,8 +101,14 @@ def move(self,speed):
88101
self.this_judgement_pos += increment
89102
self.tail = self.y - self.length
90103

104+
def fix_loc(self, loc = None):
105+
if loc:
106+
self.y = loc
107+
else:
108+
self.y = self.judgement_line
109+
91110
def check_border(self):
92-
if self.tail>= height: # then node arrived at the border!
111+
if self.tail>= self.height: # then node arrived at the border!
93112
#print("Border!")
94113
return True
95114
else:

variables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
song_name = None # as a default
1919
song_info_list = []
2020

21+
high_quality_verifying_graphics = True
22+
2123

2224
# time settings
2325
fps = 60

verifier_class.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313

1414
class Verifier():
1515
def __init__(self,screen, score,speed,judgement_shown,bpm):
16-
global fps
16+
global fps, high_quality_verifying_graphics
1717
self.screen = screen
1818
self.speed = speed
1919
self.score = score
2020
self.tiles_to_verify = []
2121
self.judgement_frames = fps//2 #fps//2
2222
self.judgement_highest_pos = int((self.judgement_frames) *0.7)
2323
self.judgement_shown = judgement_shown
24+
self.high_quality_verifying_graphics = high_quality_verifying_graphics
2425

2526
self.frame_error = int(((10/fps)*self.speed) + 1)
2627
self.song_bpm = bpm
@@ -89,6 +90,15 @@ def draw_guide_lines_node(self,nodes_on_screen,screen):
8990
[line_axes[node.line - 1] - line_width // 2, node.y - judgement_half_size, line_width,
9091
2*judgement_half_size],1)
9192

93+
94+
def append_verification_tile(self,tile_verification):
95+
if self.high_quality_verifying_graphics:
96+
self.tiles_to_verify.append(tile_verification)
97+
else:
98+
time_added_verification = tile_verification + [pygame.time.get_ticks()]
99+
self.tiles_to_verify.append(time_added_verification)
100+
101+
92102
def verify_judgement_node(self,node):
93103
result = ''
94104
detail = ''
@@ -115,6 +125,8 @@ def verify_judgement_node(self,node):
115125
# print result of Lost/Hit/Perfect on the screen
116126
#print(result)
117127
self.tiles_to_verify.append([node,(result,detail),self.judgement_frames])
128+
129+
118130
self.score[0] += point
119131
if self.judgement_shown:
120132
print(round(human_error))
@@ -209,16 +221,20 @@ def check_keep_pressing(self,hold,keys):
209221

210222

211223
def draw_judgement(self):
212-
for i in range(len(self.tiles_to_verify)-1,-1,-1):
213-
verification = self.tiles_to_verify[i]
214-
if verification[2] <= 1:
215-
self.tiles_to_verify.remove(verification)
216-
else:
217-
write_text(self.screen, line_axes[verification[0].line-1], judgement_line -judgement_text*3 + self.calc_pos(verification[2]), "%s"%(verification[1][0]), judgement_text, background_color[0], highlight_text_color)
218-
write_text(self.screen, line_axes[verification[0].line - 1],
219-
judgement_line - judgement_text * 3 + self.calc_pos(verification[2])+judgement_text,
220-
"%s" % (verification[1][1]), detail_text, background_color[0], highlight_text_color)
221-
verification[2] -= 1
224+
if self.high_quality_verifying_graphics:
225+
for i in range(len(self.tiles_to_verify)-1,-1,-1):
226+
verification = self.tiles_to_verify[i]
227+
if verification[2] <= 1:
228+
self.tiles_to_verify.remove(verification)
229+
else:
230+
231+
write_text(self.screen, line_axes[verification[0].line-1], judgement_line -judgement_text*3 + self.calc_pos(verification[2]), "%s"%(verification[1][0]), judgement_text, background_color[0], highlight_text_color)
232+
write_text(self.screen, line_axes[verification[0].line - 1],
233+
judgement_line - judgement_text * 3 + self.calc_pos(verification[2])+judgement_text,
234+
"%s" % (verification[1][1]), detail_text, background_color[0], highlight_text_color)
235+
verification[2] -= 1
236+
else:
237+
pass
222238

223239
def calc_pos(self,note_stage):
224240
return (max(self.judgement_highest_pos, note_stage) - self.judgement_highest_pos)

0 commit comments

Comments
 (0)