修改雨滴显示效果
This commit is contained in:
1 parent
a50b746ee1
commit
1ff35871dc
1 file changed
+10
-6
@@ -33,7 +33,7 @@ class MainMenuScene(BaseScene):
|
||||
self.rain_max = 50
|
||||
self.rain_list = []
|
||||
# 雨滴生命周期
|
||||
self.rain_live_max = 6
|
||||
self.rain_live_max = 10
|
||||
# 初始化雨滴
|
||||
self.init_rain(self.rain_max)
|
||||
|
||||
@@ -148,13 +148,17 @@ class MainMenuScene(BaseScene):
|
||||
|
||||
# 当状态在区间1时绘制雨滴线条
|
||||
if rain["status"] <= self.rain_live_max - 3:
|
||||
# 线条长度
|
||||
line_len = 10*(self.rain_live_max - rain["status"])
|
||||
# 设计高度
|
||||
rain_high = 10 * self.rain_live_max
|
||||
# 起点位置
|
||||
# x坐标与最后落点x一致
|
||||
x = rain["dest"][0]
|
||||
y = rain["dest"][1] - line_len
|
||||
# y坐标为落点位置向上移动设计高度后,加上生命周期去掉尾帧后落下的位置
|
||||
y = (rain["dest"][1] - rain_high) + (rain["status"] * (self.rain_live_max + 2))
|
||||
y2 = y + 10
|
||||
line_start_point = (x, y)
|
||||
pygame.draw.line(self.screen, Color.white, line_start_point, rain["dest"], 1)
|
||||
line_end_point = (x, y2)
|
||||
pygame.draw.line(self.screen, Color.white, line_start_point, line_end_point, 1)
|
||||
# 状态在区间2时绘制涟漪
|
||||
elif self.rain_live_max - 3 < rain["status"]:
|
||||
point_width = rain["status"] - (self.rain_live_max - 3)
|
||||
@@ -164,7 +168,7 @@ class MainMenuScene(BaseScene):
|
||||
# pygame.draw.ellipse(self.screen, Color.white, rain_point_rect, 1)
|
||||
|
||||
# 雨滴状态每d_status毫秒变化一次
|
||||
d_status = 200
|
||||
d_status = 30
|
||||
if rain["timer"] > d_status:
|
||||
rain["status"] += 1
|
||||
rain["timer"] -= d_status # 不设为0,避免累计时间误差
|
||||
|
||||
Reference in new issue
Block a user