Skip to content

Commit

Permalink
added dead invincibility delay
Browse files Browse the repository at this point in the history
  • Loading branch information
adangert committed Jun 6, 2019
1 parent c637298 commit 1427502
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions controller_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def main_track_move(menu, restart, move_serial, move_num, move_opts, force_color, battery, dead_count, game_mode, \
team, team_color_enum, controller_sensitivity, dead_move, music_speed, werewolf_reveal, show_team_colors, red_on_kill, zombie_opt,\
commander_intro, commander_move_opt, commander_powers, commander_overdrive,five_controller_opt, swapper_team_colors,\
invincibility, fight_club_color, num_teams,bomb_color,game_start,false_color, faked, rumble, kill_proc):
invincibility, fight_club_color, num_teams,bomb_color,game_start,false_color, faked, rumble, dead_invince, kill_proc):
print("starting Controller Process")

move = common.get_move(move_serial, move_num)
Expand All @@ -30,5 +30,5 @@ def main_track_move(menu, restart, move_serial, move_num, move_opts, force_color
speed_bomb.track_move(move, dead_move, force_color,bomb_color, five_controller_opt, game_start, false_color, faked, rumble, menu, restart)
else:
joust.track_move(move, game_mode.value, team.value, team_color_enum, dead_move, force_color, \
music_speed, werewolf_reveal, show_team_colors, red_on_kill, restart, menu, controller_sensitivity)
music_speed, werewolf_reveal, show_team_colors, red_on_kill, restart, menu, controller_sensitivity, dead_invince)

12 changes: 9 additions & 3 deletions joust.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@


def track_move(move, game_mode, team, team_color_enum, dead_move, force_color, \
music_speed, werewolf_reveal, show_team_colors, red_on_kill, restart, menu, controller_sensitivity):
music_speed, werewolf_reveal, show_team_colors, red_on_kill, restart, menu, controller_sensitivity, dead_invince):

SLOW_MAX = controller_sensitivity[0]
SLOW_WARNING = controller_sensitivity[1]
Expand All @@ -63,6 +63,8 @@ def track_move(move, game_mode, team, team_color_enum, dead_move, force_color, \
WERE_FAST_MAX = controller_sensitivity[6]
WERE_FAST_WARNING = controller_sensitivity[7]

dead_invince.value = False

start = False
no_rumble = time.time() + 2
move_last_value = None
Expand Down Expand Up @@ -153,15 +155,19 @@ def track_move(move, game_mode, team, team_color_enum, dead_move, force_color, \
move.set_leds(*my_team_colors)
#move.set_rumble(0)


if change > threshold:
if change > threshold and not dead_invince.value:
if time.time() > no_rumble:
dead_invince.value = True
if red_on_kill:
move.set_leds(*colors.Colors.Red.value)
else:
move.set_leds(*colors.Colors.Black.value)
move.set_rumble(90)
dead_move.value = 0
move.update_leds()
time.sleep(0.75)
dead_invince.value = False

elif change > warning and not vibrate:
if time.time() > no_rumble:
Expand Down
3 changes: 2 additions & 1 deletion piparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def __init__(self):
self.rumble = {}
self.kill_controller_proc = {}
self.controller_sensitivity = Array('d', [0] *10)
self.dead_invince = Value('b', False)

self.i = 0
#load audio now so it converts before the game begins
Expand Down Expand Up @@ -401,7 +402,7 @@ def pair_move(self, move, move_num):
self.music_speed, self.werewolf_reveal, self.show_team_colors, self.red_on_kill,zombie_opt,\
self.commander_intro, commander_move_opt, self.commander_powers, self.commander_overdrive,\
five_controller_opt, self.swapper_team_colors, invincibility, fight_club_color, self.num_teams,\
self.bomb_color,self.game_start,false_color, faked, rumble, kill_proc))
self.bomb_color,self.game_start,false_color, faked, rumble, self.dead_invince, kill_proc))

proc.start()
self.move_opts[move_serial] = opts
Expand Down

0 comments on commit 1427502

Please sign in to comment.