Change Controls at Run Time

For questions about using Classic.

Post » Sun Dec 09, 2012 6:30 pm

So this is literally the last thing I have on my "to do" list before uploading my game for beta testing. Everything else is done, and I figured this would be fairly easy. Depending on the value of a "Controls" global variable, I would have the game respond to different keys for the basic controls. WASD movement, or arrow key movement.

However, I can't see any way of changing the controls settings through events. And running a forum search for the topic led to recommendations for using this plugin: http://www.scirra.com/forum/customcontrols-works-new-demo-cap-fixes-360-analog-problems_topic38157_page6.html Which hasn't worked for over two years!

Is there any other way to do this? Is it supported in-game now, and I'm just missing something?

Thanks for reading
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Sun Dec 09, 2012 7:24 pm

Yes, this can be done. However, just a question; but would it clash with anything you're doing if you just had both controls activated? Then the user could just decide on the fly what controls he wants to use, and you wouldn't need to have a menu just for that.MrMiller2012-12-09 20:21:46
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sun Dec 09, 2012 8:51 pm

It would, yes. If I handled it the way I have planned. I was going to use three different control options:

WASD Movement, Arrow Keys for abilities (four different elemental abilities)

Arrow Key movement, numbers 1 to 4 for abilities

Arrow Key movement except spacebar to jump instead of the Up Arrow, numbers 1 to 4 for abilities

I've have pondered the idea of allowing the player to set his own keys for each action, but that all depends on how much time it would take to implement.
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Sun Dec 09, 2012 8:52 pm

Though having said that, if there's a way to make the spacebar function as a jump button as well as another button (W or Up Arrow) then I can condense that down to two options instead of three
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Sun Dec 09, 2012 10:42 pm

Oh, I see. I may have a .cap for you. I'll be back shortly to report whether I do or not.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sun Dec 09, 2012 11:20 pm

Thanks man

I'm going to call it a night for now, but hopefully I can get this final hurdle cleared tomorrow and let people play the game! I've just found I have issues with the High Score implementation as well, but I have a solution to work around that for now. Finding a way to change controls at run-time is the last thing I need to do!
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Mon Dec 10, 2012 2:50 am

Here is the .cap:

https://rapidshare.com/files/4170808448/ControlsMenuForSilverFinal.cap

I'm not sure of how you have your controls set up so I have it set for left and right movement. You'll have to add in the specifics of your setup, but the foundation of activating and deactivating control types at runtime based on a setting are in the .cap. The .cap has two control types (WASD and Arrows); "other" has no function, but it is already attached to a global variable so you can attach events for another control setting to it.

To use: Run the "Control Settings" layout.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Mon Dec 10, 2012 1:38 pm

Ahh, the trouble with handling it this way is that (as far as I'm aware) there's no way to handle acceleration, deceleration, jump sustain, etc. It would completely change how the game handles when you change the control layout.

Man, that's a shame. I guess I'll just have to go with arrow key movement, and abandon the control options idea

Thanks for the suggestion though! There might be a way to pull it off with this method, but it would likely involve scripting out huge chunks of Construct's platform behaviour from scratch. I can't believe this option isn't included as standard.
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Mon Dec 10, 2012 3:57 pm

Well, with the platform movement object already attached, you can still set acceleration, deceleration, and jump sustain just like you normally would for the arrow keys, so that's no problem. It works easily because Construct is already set to have the platform movement work with the arrow keys by default.

But I'm wondering if just switching player control commands might do the trick. Like, if the global global variable 0 it would activate player 1's controls that are WASD keys and disable player 2. And if the global variable is 1 it would activate player 2's controls that are Arrow keys and disable player 1. If it's a one-player game you'd be using the same keyboard for both player settings.

... I dunno just an idea, I've never actually tried it before.MrMiller2012-12-10 16:04:10
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Mon Dec 10, 2012 4:02 pm

[QUOTE=MrMiller]
But I'm wondering if just switching player control commands might do the trick. Like, if the global global variable 0 it would activate player 1's controls that are WASD keys and disable player 2. And if the global variable is 1 it would activate player 2's controls that are Arrow keys and disable player 1. If it's a one-player game you'd be using the same keyboard for both player settings.

... I dunno just an idea, I've never actually tried it before.[/QUOTE]

Woah, that's an awesome idea. I'll give it a spin! Thanks for the suggestion
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests