playMaker

Author Topic: [solved] Refire?  (Read 4962 times)

Nekoyoubi

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 35
  • I scribble syntax, paint pixels, carve faces, and
    • Nekoyoubi Games
[solved] Refire?
« on: April 11, 2011, 02:03:43 PM »
I was trying to work on getting some refire on a weapon that I've got in my (thus far) PlayMaker-only game-in-the-works.

Problem is (and I've tried this many different ways already) that I can't seem to detect or act on an appropriate mouse button state after the initial Down or Up, and the actual Down/Up actions do not seem to want to repeat if nothing's changed.

Basically, what I end up with is: Idle> *Click+Hold* > Fire > Idle > *Still holding* ... *Never going to click again*

I thought, "well, it's just the action of clicking, so of course it's not firing again". So I turned it into a Bool Test. The variable was set appropriately (so I see in debugging), but never fires the event it's wired up to.

Am I misusing the Bool Test? Is there an example already that can articulate weapon refire? Thanks much in advance.
« Last Edit: April 15, 2011, 04:19:13 PM by alexchouls »
- Lance @ Nekoyoubi Games (nekoyoubi.com)

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Re: Refire?
« Reply #1 on: April 11, 2011, 08:04:57 PM »
You mean even when the flag is tested in BoolTest the state flow is *not* going to the desired state? That's really weird.. Anyways, description is a tad nebulous, a screenshot of your FSM would help (us to help you).
--
Breno "MaDDoX" Azevedo
@brenoazevedo

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Refire?
« Reply #2 on: April 13, 2011, 04:52:00 PM »
Do you want the weapon to fire repeatedly while the mouse button is pressed?

I would set up the Fire state to transition to itself after a delay (the repeat rate of the weapon).

The Fire state should transition back to Idle on mouse up (or ammo == 0 etc.)

Nekoyoubi

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 35
  • I scribble syntax, paint pixels, carve faces, and
    • Nekoyoubi Games
Re: Refire?
« Reply #3 on: April 13, 2011, 05:33:29 PM »
@Alex : So [Idle + *Click+Hold* > Fire (still held) > Fire (still held) > Fire *Release* > Idle] ?
- Lance @ Nekoyoubi Games (nekoyoubi.com)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Refire?
« Reply #4 on: April 13, 2011, 06:20:02 PM »
Exactly. You can then add more states as you develop the game. Once you get the hang of it, a visual FSM lets you quickly build quite complex behavior that is still easy to read and debug.

Nekoyoubi

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 35
  • I scribble syntax, paint pixels, carve faces, and
    • Nekoyoubi Games
Re: Refire?
« Reply #5 on: April 13, 2011, 11:29:18 PM »
It was the "staying-in-the-fire" so to speak that got me. I've been coming along fairly well I guess, as that's really the first thing I was stumped on. Everything else I go to do (so far, anyway) proves to be delightfully simple where I was always getting irritated at how I would have to write little tiny scripts for everything before. Not that code is a problem for me, but some things (like randomly shining a light, responding to key presses, or rotating a projectile) shouldn't require constant rewrites of tiny scripts.
 
I greatly appreciate your response. You diagramming my exact scenario helped it to click for me very quickly. I literally just took what you said in the first response and applied it in less than 30 seconds to see it working exactly as I intended. Thanks again!

Oh, and by the way, are you a wizard?
- Lance @ Nekoyoubi Games (nekoyoubi.com)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: [solved] Refire?
« Reply #6 on: April 15, 2011, 04:22:52 PM »
You're welcome! Unfortunately not a wizard - just getting older with more grey hair every year :-\