"When key pressed" doesn't work my events

Get help using Construct 2

Post » Sat Mar 05, 2016 1:51 am

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.

Image
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sat Mar 05, 2016 2:53 am

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.
B
6
Posts: 12
Reputation: 270

Post » Sat Mar 05, 2016 11:35 pm

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!
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sun Mar 06, 2016 1:02 am

no worries
B
6
Posts: 12
Reputation: 270


Return to How do I....?

Who is online

Users browsing this forum: David181, jorgmaquoi, OBLIVION, unicornspitfire, Yahoo [Bot] and 24 guests