TASK #1
TASK:
Take a closer look at bullets.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #2
TASK:
Create a Bullet class.
HINT:
You will need to create a class that describes a bullet. Remember
that a bullet is simply a small sprite that will be moving forward at a set speed. Consider what
information the bullet will need at the time of creation. Then think about whether this info will
be different for each bullet and needs to be passed to the constructor.
TASK #3
TASK:
Define Bullet’s update method.
HINT:
Considering that when a bullet is created it simply
moves mindlessly upward, the Bullet's update method will need to cause this behavior by affecting
the rect appropriately.
TASK #4
TASK:
Create a bullet object.
HINT:
To create a bullet, you will need to call the Bullet's
constructor. Be sure to give the constructor any information it needs to create the bullet. At this point,
simply have the ship indiscriminantly fire bullets all the time.
TASK #5
TASK:
Create key detection for the firing of a bullet.
HINT:
You will need to consider which key will be
the trigger event for the creation of a bullet. Then, you will need to detect that event
and call the Bullet class' constructor.
TASK #6
TASK:
Slow down the firing of the bullets to 6 per second.
HINT:
You will need to cause the firing of the bullet
be limited by a timer that is modulo'ed by a certain value. Consider how often the bullet is
being created and modulo the timer by an amount that results in 6 bullets going off every second.
CHALLENGE EXERCISE #1
- Create two streams of bullets coming from the ship.
- Add graphics to all the sprites.
TASK #7
TASK:
Create a Huey class.
HINT:
You will be creating a class similar to the ship
that will be controlled remotely via code. When thinking about what type of instance variables
the Huey class will need, refer to your ship. Remember that any information that will be different for each
object needs to be passed into the constructor.
TASK #8
TASK:
Create a huey object at the top of your screen.
HINT:
You will need to set the huey's rect values such that
it appears at the top of the visible screen when the game starts.
TASK #9
TASK:
Cause the huey to shoot a bullet downward every 2 seconds
HINT:
You will need to have the Huey class's update method
create a bullet that is based on a condition involving a timer and the modulo operator.
TASK #10
TASK:
Cause the huey to shoot a second bullet
that travels to the right.
HINT:
A second bullet will need to be created, however now, the bullet
will not simply shoot downward. Now the bullet will have a direction. You will need to update the Bullet class
so that it can take in that information and travel accordingly. To accomplish this task, you will need to use
sin and cos to calculate the amount the bullet needs to travel on the x and y axis.
CHALLENGE EXERCISE #2
- Cause the huey to shoot a third bullet that travels to the left.
TASK #11
TASK:
Have the huey start at (WIN_W/2, -huey.height)
and fly downward a few
inches before stopping.
HINT:
To accomplish this, you will need to have the huey
move downward until a timer lets the huey know 2 seconds has passed. At this point, you will
need to cause the huey to stop.
CHALLENGE EXERCISE #3
- Have the huey move to the left and right twice.
- Have the huey move downward and to the right until it goes off screen.
- Remove the huey from the group when it goes off screen.
TASK #12
TASK:
Cause the huey to be destroyed when it absorbes
an appropriate amount of bullets.
HINT:
The Huey class will need to be modified so that
it has an energy instance variable. This variable will be decremented when the Huey touches
a bullet and when the energy reaches 0, remove the huey from the group.
TASK #13
TASK:
Cause the ship to be destroyed when it
absorbs a shot from an enemy.
HINT:
You will need to check for a collision between
the ship and an enemy's bullet. If there is a collision, the ship is removed from the group
and the game ends.
Congratulations!
You have completed the RAIDEN 2 project!
You have completed the RAIDEN 2 project!