"When key pressed" doesn't work my events

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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)