0 Favourites

"When key pressed" doesn't work my events

  • So I'm making this system for turn based combat, just a basic system that switches between character selection and then enemy selection when S is pressed. The problem is when the 'battlestate' variable goes into 'selectenemy' state, the S button doesn't work anymore. I added a picture of my messy system with highlights of the important events. Have a look and disregard the events outside the highlights.

  • i had the same problem the other day, you need to make a toggle. create an instance variable, set the value to 0.

    event 1: condition: playerhotbox-"instance variable" set value equal to 0. action: playerhotbox-"instance variable"=0

    event 2: condition: playerhotbox- "instance variable"set value equal to 1. action: playerhotbox-"instance variable"=1

    event 3: condition: playerhotbox-"instance variable" set value equal to or greater than 1. action: playerhotbox-"instance variable"=0

    event 4: condition: on keyboard key pressed "S". action: playerhotbox- "instance variable" add to value +1

    try that and test it in debug mode to make sure the "S" key is toggling properly.

    now do the following -

    event: condition: playerhotbox-"instance variable" set value equal to 0.

    subevent: system battlestate = select enemy etc etc

    CHARACTER SELECT

    event: condition: playerhotbox- "instance variable"set value equal to 1

    subevent: system battlestate = etc etc

    i hope some of that made sense. you will need to change some of your actions but i hope some of this helped.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • EDIT: Nevermind, I found this tutorial that explained what you were trying to explain: https://www.scirra.com/tutorials/158/ve ... two-states

    I didn't understand your explanation at first, but now it's clear. Thank you!

  • no worries

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
4,517 857,592
Tinimations's avatar
Tinimations
Unread sticky
1,586 437,380
matriax's avatar
matriax
Unread hot topic
378 33,279
part12studios's avatar
part12studios