[request] keyboard and mouse plugins

Post your work in progress addons and get feedback

Post » Wed Apr 20, 2016 9:44 pm

Why the Mouse and the Keyboard plugins have no "activate" and "deactivate" controls, or something like this ... ?
For example , if I want to add an action that looks like this: "Set Keyboard Deactivated" ... or "Set Mouse Deactivated/Activated".
@Ashley This is a must in C2, and will save a lot of work in certain conditions.
B
41
S
10
G
9
Posts: 213
Reputation: 7,082

Post » Wed Apr 20, 2016 10:01 pm

Bring all the key and mouse conditions in event groups. Then system action:

Set group active
Set an event group active or inactive. None of the events in an inactive group run until it is activated again. The event group is identified by its name.

I know that it is a workarround in youre eyes. But its elegant and it works perfect.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Apr 20, 2016 10:04 pm

On any key, activate keyboard.
Whares the any key?
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Wed Apr 20, 2016 11:57 pm

@newt - is that a simpson's joke? or a you asking where the action is?

the idea with using a group is you would put all keyboard related control events in there, then deactivate it at start

then use the "on any key pressed' action -> enable group "keyboard controls"
B
90
S
44
G
17
Posts: 1,012
Reputation: 18,527

Post » Thu Apr 21, 2016 12:57 am

Right, and if there was a way to disable keyboard input, you would have no way to enable it using the same method.
Not even with the "any" key.
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Thu Apr 21, 2016 1:11 am

@newt

Designer could use other events like wait signal (for example, waiting the cut-scene finished) then enable keyboard events.
B
110
S
28
G
280
Posts: 4,487
Reputation: 156,566

Post » Thu Apr 21, 2016 9:12 am

Here's an example of an platformer that I am working on:

The player has different weapons that can select. I've made a global variable called "Available Weapons" (type: number) and assigned different actions from 0 to 6, because I want the player as he progress in the game to have the other weapons unlocked. In this game the player can teleport, and when he does that he is invisible for 2 seconds. In this interval of time I want to disable the mouse and keyboard so he can't shoot while is invisible. So to do that , I have to create a function with sub events for each number of the "Available Weapons" global variable with checks ... With a "Enable/Disable Mouse/Keyboard" action this would be a lot easier.

https://www.dropbox.com/s/9nq15ra64yj97 ... t.jpg?dl=0
B
41
S
10
G
9
Posts: 213
Reputation: 7,082

Post » Thu Apr 21, 2016 11:42 am

This is straightforward to do with events, I don't see why it needs its own specific feature? You could just put all your input events in a group, and disable the group. Or check a global variable like you're already doing.
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Thu Apr 21, 2016 1:55 pm

You are right, but if I want to add more things to my game this can turn to be more complicated. And why do we have to make groups and add lots of events and actions when we could do this in a single line? This plugins should make our life easier, let's complete them and they will bring us only benefits.
B
41
S
10
G
9
Posts: 213
Reputation: 7,082


Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests