New condition type - Problem and Possible solution

Get help using Construct 2

Post » Thu Jun 04, 2015 12:25 am

Hi! My name is Jeff.
I have a problem and a possible solution.
For make the move of the Sprite i used the platform, i turned off default control because i want to configure the controls using the Gamepad.
So far so good, i use the directional gamepad "xbox Controller" and make the Jump press "A" button.
But, i have 2 gamepads,and i need to make a multiplayer game. to make the control 2 control Sprite 2, I have to copy and paste all command made by gamepad1 and replace Sprite1 to Sprite2?

This is my solution:

Image

Made in Photoshop for help.
I put a platform behavior in the family, because all sprites will receive the platform comportment.

Sprite1 is UID 0
Sprite2 is UID 6

I tested separately and it worked.
It recognizes that I am focusing the action on a single object.
Well. This would save me from getting copying and pasting all Gamepad1 commands
And yet I could do the commands to 4 players with only one line of code.
But is not possible :(

This is my idea of creating a new condition type.

Someone finds it useful?
Someone knows how to solve the problem of the gamepad?
B
7
S
2
G
1
Posts: 6
Reputation: 989

Post » Thu Jun 04, 2015 12:48 am

You don't need to create for every new player - new sprite and there is no need in family. That's i can say for sure.

About gamepads. Well, i have none of that could support the plugin. So, sadly cannot test anything to help you :(
I'm a Magician, not a Developer.
B
22
S
8
G
25
Posts: 106
Reputation: 14,294

Post » Thu Jun 04, 2015 3:22 am

Thank you friend!
I do not know the logic to create an event that will serve for each player.
Any link which teaches me to create it?
B
7
S
2
G
1
Posts: 6
Reputation: 989

Post » Thu Jun 04, 2015 9:55 am

This is perhaps will be a stupid question.

But how did you make only one "or" in conditions?
I'm a Magician, not a Developer.
B
22
S
8
G
25
Posts: 106
Reputation: 14,294

Post » Thu Jun 04, 2015 6:12 pm

This condition is not possible. I did it in Photoshop to illustrate the resolution of my problem.
If it were possible to create a "or" anywhere condition would solve my problem.
B
7
S
2
G
1
Posts: 6
Reputation: 989

Post » Thu Jun 04, 2015 7:22 pm

My last message here - https://www.scirra.com/forum/viewtopic.php?f=147&t=147611&p=938715#p938715

This example (or almost finished for someone game) probably will help to your project too.
I'm a Magician, not a Developer.
B
22
S
8
G
25
Posts: 106
Reputation: 14,294

Post » Thu Jun 04, 2015 8:00 pm

You could do something like this to deal with multiple gamepads. Here, GamepadID is an instance variable (or could be a family instance variable in your case) used to identify which Sprite will be moved by each gamepad.
Image
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Thu Jun 04, 2015 8:54 pm

XpMonster
Thank you friend, that your code has opened my mind ...
In my code I still use the family with Platform Behavior.

Magistross
Your code works perfectly.
The gamepad (0) Controls Player1, the gamepad (1) Controls Player2, is perfect.
Now I will study what you did.
Thank you very much!!
B
7
S
2
G
1
Posts: 6
Reputation: 989

Post » Sun Jun 28, 2015 7:36 pm

Just want to thank you. I am working on a multiplayer mode and this helped me a lot. So thank again i 've just drop event number by 8 to 10%.

Magistross wrote:You could do something like this to deal with multiple gamepads. Here, GamepadID is an instance variable (or could be a family instance variable in your case) used to identify which Sprite will be moved by each gamepad.
Image
Check out the demo of my first C2 Game
https://www.scirra.com/arcade/other-gam ... n-demo-482
Follow me @84Gamestudio
B
16
S
5
G
2
Posts: 24
Reputation: 2,816


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 45 guests