playMaker

Author Topic: Do While MouseIsDown  (Read 147 times)

Omninorm

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Do While MouseIsDown
« on: March 13, 2019, 09:37:35 AM »
I want the Player to continuously add Velocity to an object by holding down a mouse button, and  when lifting off the mouse button, it should stop. I have thought of doing it via a Boolean but this is not working out since I need to continuously check and then Playmaker throws a error.

I then found this but can't seem to find this video
https://hutonggames.com/playmakerforum/index.php?topic=20215.0

What I'm trying to do is a a rocket that adds velocity as the player presses the mouse and stop it when he doesn't

Any ideas on what seems to be simple, but the continuously adding the velocity is the issue. Obviously making it register a set velocity each time you click works fine.


ch1ky3n

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: Do While MouseIsDown
« Reply #1 on: March 13, 2019, 11:06:19 AM »
Get mousepick2d/ mousepick event

State1:
on mouse down > go state 2

state2
do stuff like add velocity but make sure to tick the every frame checkbox
on mouse up > go state 1


Omninorm

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Re: Do While MouseIsDown
« Reply #2 on: March 15, 2019, 01:26:55 AM »
Thanks for the help.
When adding It asks for collider2D.  I tried using Box Collider 2D and it does not trigger the event on MouseDown

I have obviously also tried clicking for Auto Adding.