Touch/Keyboard Question

Get help using Construct 2

Post » Tue Mar 20, 2012 3:51 am

Is there anyway to have an object being touched simulate a keyboard key being pressed/down. I'm not using behaviours for this at all. There must be someway to have something like...

If object.InTouch = True Then
KeyboardKey.Down = True
End If

Is there anyway to accomplish this without behaviours through purely the event sheet?
B
70
S
10
G
9
Posts: 300
Reputation: 8,962

Post » Tue Mar 20, 2012 4:07 am

it's really just the ability to tell the system a keyboard key has been pressed without the user actually needing to press the key
B
70
S
10
G
9
Posts: 300
Reputation: 8,962

Post » Tue Mar 20, 2012 5:52 pm

I've tried using the keycode and extra expressions plugins but haven't been able to get anything to work, is there really no way to do this?
B
70
S
10
G
9
Posts: 300
Reputation: 8,962

Post » Tue Mar 20, 2012 8:27 pm

There may be a way to work around this, depending on what result you're looking for. What would pressing the key do?
B
19
S
2
Posts: 37
Reputation: 1,464

Post » Tue Mar 20, 2012 11:03 pm

I'm not really sure that "KeyboardKey.Down = True" is even programatically possible. Aren't key states read only?
B
25
S
8
G
7
Posts: 184
Reputation: 6,040

Post » Wed Mar 21, 2012 9:58 pm

I basically want to trick the system into thinking a key has been pressed when it hasn't. It's meant for an easy to event, multiple control system engine. I've found a work-around, it's long winded, but seems to work. I'd rather just be able to manually tell the system that a key has been pressed without needing that key to be pressed physically
B
70
S
10
G
9
Posts: 300
Reputation: 8,962

Post » Thu Oct 04, 2012 3:25 am

I am also looking for this so I can use the platform behavior...
Image
B
36
S
14
G
11
Posts: 142
Reputation: 8,465

Post » Fri Oct 05, 2012 7:52 pm

Use a variable to store the state of each key you use and update them with keyboard and touch events. Then in the rest of your event just compare their value to see the state.
B
91
S
31
G
103
Posts: 5,241
Reputation: 67,768

Post » Sat Oct 06, 2012 12:19 am

I'm with R0J0hound, just have it that if Space is pressed > Veriable = true, else false. You could then have if object A is touching Object B > variable = true, else false.

Like this - https://dl.dropbox.com/u/108799982/Capx%20Demos/SimulatePress.capx
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sat Oct 06, 2012 7:35 am

I'm afraid this isn't quite what I'm after... I'm looking for User Defined control. Something like this...

Defining Control
- user selects the option to customize controls
- user selects the control "move left"
- the system then waits for user input
- the system returns a value for the first key the user presses
- the system saves that value to the variable "moveLeft"
- the system then saves that all to webstorage

In Game Control
- user presses a key
- the system returns a value for the key pressed
- the system compares that value to all the control variable values
- if key pressed and the value of "moveLeft" are equal, then proceed...

I've tried various ways of using both the Keyboard and Keycode plugins but I haven't got it working yet...
B
70
S
10
G
9
Posts: 300
Reputation: 8,962

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie, Syazanie Amirin and 4 guests