Arcade/Rail shooter section

Started by strangechicken, Mon 30/01/2012 20:10:38

Previous topic - Next topic

strangechicken

Whats the easiest way to go about making an arcade/rail shooter section?

Its just for one room, i also want for the section the character to have a life bar of some sort, to track how much damage he has taken, I also want to ave in hud bullet "objects" that disappear each time a shot is fire (classic rail shooter style),  I know thats a lot for one room, I also want the enemy (theres is only one) to take about 5 shots before dying (not just a single shot).
Any help would be awesome, I am but a feeble simple peasant of the Ags system.

PS. My game is built with a context sensitive Broken Sword style cursor set up. i figured that might in some way make the intergration easier

Cheers.

SC.

Icey

Make a (int) variable called something like PlayerHP. Set it to like 5 or 10 for the total amount of DMG  the player can take.

Same goes for the Bullets, Something like Bullamount sounds good. Since the Enemy dies with 5 shots then set it to something higher than 5 maybe like 20.

Place in Rep_Ex_always in the global script.
Code: ags

if(bullmount == Maxnumber){   //Replace Max number with 19.
Bullet19.visible = false;//Make a GUI with 20 buttons that represent the bullets  
}



//Copy, Paste, and change the 19's to the next following number until you get to 1


if(bullmount == 0){  
//reload ammo or game over, take you pick.
}

Make a variable for the Enemy called TargetHP. Next put...

If(TargetHP == 0){
//End of shoot out

}


if(PlayerHP == Maxnumber){   //Replace Max number with 9
HPbar.width = 9;//Add a button for the HPbar and make sure it's width is 10 Max.
}



That should work.

ShiverMeSideways

#2
@Icey: I think he was actually asking how to MAKE a rail shooter. Contrary to beliefs by SOME people, a GAME is more than just VARIABLES.

Since you have only one character to shoot, that shouldn't be too hard.

First of all, you need to check if you're actually shooting the character. Do this by binding a function to the "Any Click on Character" event for your cBadGuy character. In the function, check "if (mouse.Mode==eModeShootyShooty)" and in there put in a function called "ShootBadGuy();" or something. Create this function before game_start.

Code: ags
function ShootBadGuy()
{
  BadGuyHP-=1;
  cBadGuy.Animate(BADGUYGETHITLOOP, delay);
  aGunSound.Play();
  Bullets-=1;
}


Then, in repeatedly_execute you should have something like "if ((BadGuyHP<=0) && (RailShootingSequenceIsStillGoingOn==true) EndRailShootingSequence();" where "EndRailShootingSequence();" should be another function you declare before game_start in which you put in what happens, well, obviously, when the rail shooting sequence is finished.

To actually fire a bullet when you're not clicking on the character put in an "if (mouse.Mode==eModeShootyShooty) { Bullets-=1; aGunSound.Play(); }" in the "on_mouse_click" function.

In order to do the GUI stuff you mentioned, that should be pretty simple. For the bullets, create a button on a GUI and put in repeatedly_execute something like "if (Bullets==5) { bBulletsLeft.NormalGraphic=[SpriteNumberForAnImageWith5Bullets]; } if (Bullets==4) { bBulletsLeft.NormalGraphic=[SpriteNumberForAnImageWith5Bullets]; }" and so on.

The health bar could be just a slider or something.

Hope this helps!

PS: Of course, these are just rough tips, customize, change and abuse to fit your game.

Khris

Regarding the health bar and bullets:
I'd use a single sprite for both and put it on a button, then set the button's .ClipImage to true and change its .Width.

Code: ags
  ...
  bullets--;
  btnBullets.Width = bullets*10;
  ...


And you shouldn't need any repeatedly_execute business besides handling the bad guy's shooting back.

SMF spam blocked by CleanTalk