YesNoOk
avatar

Holding Direction Key + Two Buttons? (Read 552 times)

Started by Bane84, March 09, 2020, 04:48:17 AM
Share this topic:
Holding Direction Key + Two Buttons?
#1  March 09, 2020, 04:48:17 AM
  • avatar
  • ***
  • Original characters are my forte.
    • http://network.mugenguild.com/bane84/
This is supposed to be an extremely simple command.  The player enters the state by holding the x+y keys, then exits the state by releasing them:

.CMD File
Code:
[Command]
name = "hold_xy"
command = /x+y

...

[State -1, Nutrition]
type = ChangeState
value = 1000
triggerall = var(2) <= 0
triggerall = statetype = S
triggerall = ctrl
; No AI.
trigger1 = !var(59)
trigger1 = command = "hold_xy"

.CNS File
Code:
[State 1000, PowerIcon]
type = Explod
trigger1 = Anim = 1000
ID = 1000
anim = 1002
pos = 0, -350
postype = p1
bindtime = -1
sprpriority = 3
scale = IfElse(!var(59)&&Command="holdup", 0.5, 0.2), IfElse(!var(59)&&Command="holdup", 0.5, 0.2)
ownpal = 1
facing = IfElse(Facing=1, 1, -1)

[State 1000, EndAnim]
type = ChangeAnim
triggerall = Anim = 1000
; No AI.
trigger1 = !var(59)
trigger1 = Command != "hold_xy"
; TODO: AI
value = 1001

[State 1000, 7]
type = ChangeState
trigger1 = Anim = 1001
trigger1 = AnimTime = 0
value = 0
ctrl = 1

I'm able to enter the state by holding x+y and exit the state by releasing x+y (triggering the animation to leave the state just fine), but the IfElse to enlarge the scale on the Explod plainly refuses to trigger when I hold the UP key.
Last Edit: March 10, 2020, 03:07:41 AM by Bane84
Re: Holding Direction Key + Two Buttons?
#2  March 09, 2020, 10:18:44 AM
  • *****
  • Shame on you!
    • USA
I forget the terminology but your keyboard is only sending the signal for holding the 2 buttons.
Comment out the changestate so you don't have to hold the buttons. Test if the up, scaling, works.
Explods are finicky also. IF the button press isn't actually working, Create 2 different explod calls with the different triggers, and set the scale that way.
vVv Wheat Stage Released vVv
Re: Holding Direction Key + Two Buttons?
#3  March 10, 2020, 03:07:04 AM
  • avatar
  • ***
  • Original characters are my forte.
    • http://network.mugenguild.com/bane84/
It was even simpler than that.  My laptop keyboard refuses to accept three simultaneous key inputs.  I got around this by doing what you said and entering the state on a single key press and a direction instead of a hold and leaving the state when the key is released.  I also switched to using a single directional key to enter the state.

Appreciate the help.