playMaker

Author Topic: Firing bullets from multiple sources pressing just one button?  (Read 1526 times)

ecruzm

  • Playmaker Newbie
  • *
  • Posts: 2
The solution to this might actually be quite simple but I can't find it yet. I'd really appreciate it if someone could help me out please :)

I'm building a vertical 2D shmup and have a player that fires bullets. I set an fsm with get button down (Fire1 with the z key) and a bool test to fire the bullets continuously while z is pressed (once the z key is released it stops firing bullets).


Simple right? Now... I wanna start firing more bullets from other gameobjects along with the player while "z" is being pressed, however I haven't been entirely successful to do this. I've made 4 weapons as items (each use this same fsm), when one of them is collected it gets attached to the player and starts firing bullets along with the player but only until z is pressed again and not while z is being pressed at the moment it was collected. What I mean by this is that when I'm pressing "z" (which is firing the player's bullets) and collect a weapon I have to release the z key and press it again to make the weapon fire its bullets along with the player and that's what is annoying me...

So yeah, I hope this is clear. Is there any way to make those item's bullets start firing automatically when the item is collected instead of having to release the "z" key and press it again in order to make it work? Using get button down for each weapon to start firing it is not proving to be very useful in this situation...
« Last Edit: March 21, 2018, 12:21:21 AM by ecruzm »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Firing bullets from multiple sources pressing just one button?
« Reply #1 on: March 21, 2018, 02:28:59 AM »
Hi,
Maybe for each shot position you can have a dedicated fsm

Then for single shots you can use 'on button up' or don't loop the shot.

if you would have different weapons and some would multi shot,

then before you do the shot, check which weapon need and you can have both systems in 1 fsm.

if you don't understand, i will try to make a sample tonight.

ecruzm

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Firing bullets from multiple sources pressing just one button?
« Reply #2 on: March 21, 2018, 09:45:31 PM »
Hi,
Maybe for each shot position you can have a dedicated fsm

Then for single shots you can use 'on button up' or don't loop the shot.

if you would have different weapons and some would multi shot,

then before you do the shot, check which weapon need and you can have both systems in 1 fsm.

if you don't understand, i will try to make a sample tonight.

Hey, I did what u said and I solved the issue. I made each shot position have a specific fsm and used a get button up along with get button down in the same state for it to work, now when you collect the weapon while pressing z it will start firing until z is released with get button up which is what I wanted, it was very simple actually.

Thanks a lot for the help ;D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Firing bullets from multiple sources pressing just one button?
« Reply #3 on: March 22, 2018, 02:09:44 AM »
Hi.
Happy to help.
When you know how, its simple.
The more you play around with playmaker, the easier it gets :)