Horizontal Game Maker Laser help SOLVED

A place for people with an interest in developing new shmups.
Post Reply
ZeoOfFire
Posts: 4
Joined: Thu Apr 18, 2013 11:01 am

Horizontal Game Maker Laser help SOLVED

Post by ZeoOfFire »

First time posting on the forum, but I've been lurking a little while.
Hope this is the right section to post this also.
I've seen topics on making lasers in game maker, like the DDP style lasers based on GMOSSE and S-20 stuff, and someone's tileable lasers, but I just have one (likely simple) request.
Can anyone help me make it for a horizontal Shmup?
I've tried fiddling with variables, but for the life of me, I can never get it to work properly. Sometimes the code to look at is quite daunting, so I'm at a loss what to change, other times I try and strange issues occur (I once had my ship fly off-screen ridiculously fast instead of firing).
I'm not asking for hand-outs (though I wouldn't dismiss them :P) just a poke in the right direction (no pun intended).
Hope someone can help
Last edited by ZeoOfFire on Sun Apr 21, 2013 3:59 pm, edited 1 time in total.
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: Horizontal Game Maker Laser help

Post by n0rtygames »

Where the laser examples you've been looking at traverse the Y axis... make them traverse the X axis instead.. :0)

I can dig out my Chronoblast code at some point to help you along a little more - it really doesn't take much to convert from vert to hori
facebook: Facebook
ZeoOfFire
Posts: 4
Joined: Thu Apr 18, 2013 11:01 am

Re: Horizontal Game Maker Laser help

Post by ZeoOfFire »

n0rtygames wrote:Where the laser examples you've been looking at traverse the Y axis... make them traverse the X axis instead.. :0)

I can dig out my Chronoblast code at some point to help you along a little more - it really doesn't take much to convert from vert to hori
In theory, I should be able to change some 'y's to 'x's, but as I say, I'm not a brilliant coder, and some of it goes over my head at times.
Oh, by the way, the ones I've tried to use (and change) are from:
http://shmups.system11.org/viewtopic.php?p=750066
and the rainbow coloured one from:
http://shmups.system11.org/viewtopic.ph ... game+maker
Last edited by ZeoOfFire on Fri Apr 19, 2013 3:21 pm, edited 1 time in total.
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: Horizontal Game Maker Laser help

Post by BPzeBanshee »

Ah. Complex stuff.

S20-TBL's laser (which got put in and then ripped out from GMOSSE) trick is complicated but should indeed allow for horizontal movement. I think the last example version I updated for that thread supported aiming of the laser via mouse, ergo it could go multidirectional. That code can be modified so that instead of aiming at the mouse it goes to a set angle (right in GM = 0 degrees).

Rozyrg's one I just don't understand at all. Love his games but his code is not easy to understand and had a few more collision-related bugs than S20's above.

If you're doing a hori like Gradius then the laser in that is most likely actually not any trickery at all but a constant production of small 'laser' objects. This is how it was more or less done in Xeno Fighters regarding Vic Viper's laser shot, and is how Giest118 does it in his games as well. Simpler to use although not as visually effective. The trick to keeping it aligned to the player like a laser is as easy as adding:

Code: Select all

if instance_exists(playership)
   {
   y = playership.y;
   }
to it so that each laser object is aligned with the ship. There's more than one way to skin a cat though so pick whatever's easiest and suitable for you.
ZeoOfFire
Posts: 4
Joined: Thu Apr 18, 2013 11:01 am

Re: Horizontal Game Maker Laser help

Post by ZeoOfFire »

Thanks for all the help.
Ended up Gutting Swordfish's laser and fiddling about for a while, ended up with:

Code: Select all

Information about object: PlayerLaser

Sprite: laserLASER
Solid: false
Visible: true
Depth: 10
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
execute code:

image_speed = 0.5;
image_yscale = 0;
timer = 0;


 Step Event:
execute code:

timer += 1
if image_yscale < 1 && timer < 30
    {image_yscale += 0.1}
y = ShmupPlayer.y -1
x = ShmupPlayer.x +8
if timer >= 30 && image_yscale > 0
    {image_yscale -= 0.1}
if timer >= 30 && image_yscale = 0
    {instance_destroy()}

User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: Horizontal Game Maker Laser help SOLVED

Post by BPzeBanshee »

Swordfish's laser bomb is as you've seen the most simplest out of the lot: one sprite the size of the screen 'appearing' from increasing the apparent width (or in your case height) of the laser until it reaches full size, then decrease back to 0 and die after a certain amount of time.

It does nothing special in terms of colliding with enemies though: thus it's main feature in GMOSSE as a penetrative bomb and that only.
ZeoOfFire
Posts: 4
Joined: Thu Apr 18, 2013 11:01 am

Re: Horizontal Game Maker Laser help SOLVED

Post by ZeoOfFire »

It does the job, due to time constraints (Games Design Student), some stuff needed cutting/simplifying, so a more complicated laser was scrapped.
Although the game is simply a concept demo, so hmmmmmm...In the future maybe...
Sorry for vagueness, I'll likely chuck something up about my game soon.
Post Reply