Doing a shoot-em-up Laser beam
Author: | cake
|
Submitted: | 1st December, 2003
|
Views: | 4974
| Rated: |
|
|
Alrighty, played a shmup like Baryon/Tyrian, etc lately? A lot of those kinda games have cool laser beams that get thicker the more you upgrade them. This article will explain how to make one .
Objects Needed
AOs
* A small laser beam block, with a height of 8 pixels. Give it a number of animations where is has a different thickness though. I did the following for mine:
Level 1 - 4x8pixels
Level 2 - 8x8pixels
Level 3 - 16x8pixels
Level 4 - 32x8pixels
Level 5 - 48x8pixels
* A splash object. This is the sprite that appears at the end of your laser. So as you are pummeling some poor enemy into oblivion you will wanna see a satisfying energy ball overlapping them. Similarly, you ar going to need varying sizes to match your laser beam block
* A targetter object, which is used to find where the laser needs to end. It is invisible, its basically just a detector, so again, make a number of animations to suit the thicknesses of your laser beam blocks.
* A painter object, which will place the laser beam blocks in a line between the ship and the targetter.
Other objects
* A fast loop object or just use MMFs built in loops feature
Events Needed
Right, the premise is pretty simple, while the player is holding down shoot, we need to find out the nearest point in front of him where the laser would hit, then fill in the space between the ship and that point. In this example i will use Global Value A to store the laser's power.
1.
Repeat while player 1 holds down fire button 1:
Set position of targetter to 0,0 from ship
Set animation of targetter to (global value A)
Destroy laser beam block
Start loop 0 for 50 loops
2.
Loop trigger 0
+ NOT targetter overlapping enemy
+ Y(targetter) > Y of Top of Screen:
Set Y position of targetter to Y position of targetter - 4
3.
Loop trigger 0
+ targetter overlapping enemy:
Stop loop 0
Set position of splash to 0,0 from targetter
Set position of painter to 0,0 from ship
Start loop 1 for (Ceil((Y(ship)-Y(targetter))/8 )) loops
4.
Loop trigger 0
+ Y(targetter) <= Y of Top of Screen:
Stop loop 0
Set position of splash to 0,0 from targetter
Set position of painter to 0,0 from ship
Start loop 1 for (Ceil((Y(ship)-Y(targetter))/8 )) loops
5.
Loop trigger 1:
Create laser beam block at 0,0 from painter
Set Y position of painter to (Y(ship)-((Loop step of loop 1)*8 ))
Bring Splash to front
6.
NOT repeat while player 1 holds down fire button 1:
Set position of Splash to -64,-64
Destroy Laser beam block
7.
Always:
Make targetter invisible
Make painter invisible
There you have it. 7 events isn't too bad for a very cool looking weapon which is sure to add spice to your Sh'mUp. . I'll upload an example .cca later on.
|
|
cake
Registered 13/12/2002
Points 1173
|