How do I

Get help using Construct 2

Post » Mon Apr 14, 2014 10:37 am

Oh, Constructtwonians a question burns deep within my loins!

I'm trying to figure out what the best way is to facilitate different controlling options for different players:

Player1 on keyboard1 (wasd, gyh)
Player2 on keyboard2 (Arrows, shft, ret, ctrl)
Player3 on Controller1 (controller 1....)
Player4 on Controller2 (A banana.......... eh, I mean controller 2)

So, how can i set this up to easily switch the different sets of controls to different players in the option screen?

I liked how Spelunky HD did it, but perhaps there are other, better ways?

As always, I thank you!
B
7
S
2
Posts: 51
Reputation: 627

Post » Mon Apr 14, 2014 11:23 am

If you're using objects in a family or of the same object type you can just set up an instance variable 0-3 which determines the control method. Then when you make the events, make them so they are segmented into the different control methods, and pick the instance of that object which has the instance variable that corresponds to the control. Ok I'll show you with pictures because this is making my head hurt.
controlmethod.png

Then under those groups add the rest of the controls.

Edit: Then of course in your options screen you have events which stop the user choosing the same controls for multiple players. When you want to change the control method, even during runtime, you just change the instance variable and it will instantly take effect.
You do not have the required permissions to view the files attached to this post.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Mon Apr 14, 2014 12:45 pm

Ah yes, this is what I thought too. However, what happens when player 1 wants to play on keyboard2 and player 2 wants to play with the xbox controller? I could write out all four control schemes out for all four players. I am looking for a more time-efficient way to do this.

Neat explanation though!
B
7
S
2
Posts: 51
Reputation: 627

Post » Mon Apr 14, 2014 12:50 pm

Not sure what you mean. It would work with that too. What this does is just applies whatever your control does, to whatever instance has that control type enabled. If you do it that way then it will work for anything at all. It's not writing out the control scheme for each player, just for each control scheme. Furthermore you can add more objects to it without much hassle using a family.

Edit: the reason it would work is because it picks the instance which has the control method.

Edited Edit: Here's an example in a capx.
Controlmethods.capx

Also it doesn't matter if you have an object for each player, all that would mean is that you would use a family for all these events instead of my "players" platformer. I used only one because it's simpler, but if you were to use more than one, a family with the same events would work too. If you can't use families then you should use an instance variable determining player id which changes the animations anyway.
You do not have the required permissions to view the files attached to this post.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Casimir, tarek2, Yahoo [Bot] and 10 guests