本文整理汇总了Python中stage.Stage.draw_self方法的典型用法代码示例。如果您正苦于以下问题:Python Stage.draw_self方法的具体用法?Python Stage.draw_self怎么用?Python Stage.draw_self使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stage.Stage
的用法示例。
在下文中一共展示了Stage.draw_self方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from stage import Stage [as 别名]
# 或者: from stage.Stage import draw_self [as 别名]
#.........这里部分代码省略.........
selected_swing.destroy_joint(child_bonus, grandchild_bonus)
elif event.type == KEYDOWN and event.key == K_s and stage.running == True:
# SECRET WEAPONNNNN!!!!
for swing in stage.swings:
swing.destroy_joint(child_bonus, grandchild_bonus)
elif event.type == KEYDOWN and event.key == K_r and stage.running == True:
# If there is no ball, respawn the ball
if selected_swing.ball == None:
selected_swing.respawn_ball(selected_swing.circle_mass, selected_swing.radius, 1, "red")
else:
# If there is a ball create a new child
# the masses of the segments and balls are determined by which tier the swing is
# Tier1 swing is the original swing and can have 3 children. Has 3 segments
# Tier2 swings are children of tier1 swings and can have 2 children. Masses are 1/3 of the tier1. Has 2 segments
# Tier3 swings are children of tier2 swings and can't have children. Masses are 1/2 of tier2. Has 1 segment
new_tier = selected_swing.tier + 1
if new_tier == 2:
new_swing = Polyswing(
stage,
200,
550,
1,
10,
0.33 * selected_swing.section_mass,
500,
1,
0.33 * selected_swing.circle_mass,
15,
1,
2,
selected_swing,
2,
new_tier,
"red",
)
else: # its tier 3
new_swing = Polyswing(
stage,
200,
550,
1,
10,
0.5 * selected_swing.section_mass,
500,
1,
0.5 * selected_swing.circle_mass,
10,
1,
1,
selected_swing,
0,
new_tier,
"red",
)
elif event.type == KEYDOWN and event.key == K_t:
# toggle through the swings
try:
selected_swing.selected = False
except UnboundLocalError:
print "no selected swing yet"
try:
selected_swing = stage.swings[swing_index]
except IndexError:
print "the swing that was selected isn't there anymore"
selected_swing.selected = True
if swing_index + 1 > len(stage.swings) - 1:
swing_index = 0
else:
swing_index = swing_index + 1
elif event.type == KEYDOWN and event.key == K_SPACE:
barrel_cannon1.shoot(1200, bullet_color)
# new_ball = Bullet(stage, f275, 36 ,2.0,10,0.5,bullet_color)
except UnboundLocalError:
print "im too lazy to fix this problem right now" # cant release or make the ball for poly_swing2 unless it exists
if stage.running == True:
barrel_cannon1.move()
spinner1.move()
spinner2.move()
screen.fill(THECOLORS[bg_color])
stage.process_input()
stage.draw_stats()
# create new threads for these calls?
if stage.running == True: # two of these need to be done because step must be infront of draw
stage.bullet_reload(pg_time)
stage.space.step(1 / 60.0)
else:
stage.set_end_time()
stage.draw_self()
pygame.display.flip()
clock.tick(60)
pygame.display.set_caption("FPS: " + str(clock.get_fps()))