playMaker

Author Topic: Loop Actions while Mouse input is held? [SOLVED]  (Read 3432 times)

Tinker

  • Playmaker Newbie
  • *
  • Posts: 6
Loop Actions while Mouse input is held? [SOLVED]
« on: April 02, 2012, 03:23:07 PM »
Hello! I am working on a top-down shooter.

The main object instaniates a projectile on mouse down input like it is suppose to.

However, i cannot figure out how to constantly instaniate the projectile while the mouse is held down because it only instaniates the projectile once until I re-click again.

At the moment, I have a Listener state for the object that waits for a "Get Mouse Button Down", Which once held, sends a event to a state that performs the "Create Object" which then waits for "Get Mouse Button Up" to return back to the Listener state.

Thank you!   ;D
« Last Edit: April 03, 2012, 12:03:26 AM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Loop Actions while Mouse input is held?
« Reply #1 on: April 02, 2012, 04:23:35 PM »
Loop the state that creates the projectile. E.g. Send Event or Wait with a 0.5 second delay. Or make the delay a variable so you can expose it in the inspector and tweak it.

Tinker

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Loop Actions while Mouse input is held?
« Reply #2 on: April 02, 2012, 04:28:14 PM »
I tried having two states that kept sending the event back to eachother but i believe i am doing it wrong.

as for the "Wait" function, i don't see where the use of this is needed?

Do you mean, have a event within itself to flow back into its own state?

Can you be more specific on how the loops should be set up?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Loop Actions while Mouse input is held?
« Reply #3 on: April 02, 2012, 04:33:31 PM »
Sure. See attached screenshot.

Tinker

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Loop Actions while Mouse input is held? [SOLVED]
« Reply #4 on: April 02, 2012, 04:34:56 PM »
Aha! Alright, that looks correct, thanks!  ;D