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
64
S
8
G
9
Posts: 290
Reputation: 8,590

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
64
S
8
G
9
Posts: 290
Reputation: 8,590

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
64
S
8
G
9
Posts: 290
Reputation: 8,590

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
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu Oct 04, 2012 3:25 am

I am also looking for this so I can use the platform behavior...
Image
B
35
S
13
G
9
Posts: 142
Reputation: 7,340

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
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

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 R238 for all examples
B
60
S
17
G
6
Posts: 363
Reputation: 9,125

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
64
S
8
G
9
Posts: 290
Reputation: 8,590

Next

Return to How do I....?

Who is online

Users browsing this forum: chcteacher, Televangelist and 28 guests