Player attack
Player attack
Torpedo movement
Go back in the frame editor and drop in the frame the "Torpedo_Player" object. Drop it in the bottom of the screen, close to the periscope object but on the right of it. Now click on this object to display its properties in the property explorer.
Choose the "Path" movement in the "Type" property. You now must enter a straight-line movement, from bottom to top. Enter it in several chunks, and make sure the speed decreases as it moves to the top of the screen (it must be fast at first, then slower and slower).
The object must move throughout the height of the screen and give the impression to disappear in the horizon. This movement must be synchronised with the animations.
Shooting the torpedo
Once the movement of your torpedo defined, move the it out of the game area (so that it does not appear wher the game starts). Go back in the event editor and enter the following events. You will remember that we limit the number of torpedos to one. This will increase the difficulty of the game.
- Upon pressing "Space bar"
+ Number of (torpedo_player) = 0
: Create (torpedo_player) at (-1,145) from (periscope)
(torpedo_player) : Bring to back
- (torpedo_player) has reached the end of its path
(torpedo_player) : Destroy
Collisions
We have to handle the collisions between the torpedo and the ships. The following events acheive this task for the first boat.
- Collision between (torpedo_player) and (warship02L)
(torpedo_player) : Destroy
(warship02L) : Destroy
(Player 1) : Add 100 to Score
The previous event were simple : detection of the collisions, destruction of the boat, and playing a sound. Here are the events to enter for the other boats.
- Collision between (torpedo_player) and (submarine05S)
(torpedo_player) : Destroy
(submarine05S) : Destroy
(Player 1) : Add 1000 to Score
- Collision between (torpedo_player) and (warship03M)
(torpedo_player) : Destroy
(warship03M) : Destroy
(Player 1) : Add 500 to Score
- Collision between (torpedo_player) and (warship01S)
(torpedo_player) : Destroy
(warship01S) : Destroy
(Player 1) : Add 250 to Score
Spread the word!
You can share this document using the following buttons.