Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Introduction
Cyber Battle Game
Game elements
Main Game Loop
Robot moves
Final game

Instruction

Okay! We created a laser_shoot_up() function. We still need two more functions to complete our laser beam "experience".

First, we need a function which will decide whether to shoot left, right, up, or down, based on the robot's direction.

Second, we need a function which clears all laser beams from the game board after both robots have moved.

Exercise

Write a function named laser_shoot(board, robot, lives_left) which invokes laser_shoot_left(), laser_shoot_right(), laser_shoot_down(), or laser_shoot_up() based on the direction the robot is facing.

Stuck? Here's a hint!

In laser_shoot, check robot['direction'] to find out which laser function to invoke.