Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Tinker on April 02, 2012, 03:23:07 PM

Title: Loop Actions while Mouse input is held? [SOLVED]
Post by: Tinker 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
Title: Re: Loop Actions while Mouse input is held?
Post by: Alex Chouls 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.
Title: Re: Loop Actions while Mouse input is held?
Post by: Tinker 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?
Title: Re: Loop Actions while Mouse input is held?
Post by: Alex Chouls on April 02, 2012, 04:33:31 PM
Sure. See attached screenshot.
Title: Re: Loop Actions while Mouse input is held? [SOLVED]
Post by: Tinker on April 02, 2012, 04:34:56 PM
Aha! Alright, that looks correct, thanks!  ;D