How do you switch between players?

I’m completely new to this, but I’m trying to make a multi-player board game. I have the starting positions of my pieces, but how do I transfer control between them? Basically, how do the pieces move only during their “turn”?

Maybe another way to phrase this for now is: how do you only allow 1 sprite to be active at a time, so when I press an arrow key, only the intended piece moves and not all of them?

make p1 be enabled and all others disabled. When p1 is done its turn make it send a message to p2

Luminous700 wrote: make p1 be enabled and all others disabled. When p1 is done its turn make it send a message to p2
^^ Make p1 disabled with the 'enabled' behavior. Send a message to p2 with the 'message' behavior. Receive the message in p2 with the 'mailbox' behavior and make p2 enabled with the 'enabled' behavior.

To make the players disabled in the beginning. Do this in the player:
[Once] --> [(false) Enabled]

Default of the enabled behavior is true

Thanks guys. OK - I found the Enabled behavior in the Behavior - Properties section, and the Mailbox behavior in the Behavior - Triggers section. I don’t see anything about messages, though, nor do I have any concept about how to link something like that between sprites. (Sorry - I literally just started looking at this for the first time last night, so please bear with me. And hopefully this will help out other total noobs, too.)

I found Messages! (it’s under Behavior - Components). But still not sure how to hook everything up. I imagine is needs to be something like Mailbox, then Enabled, but do these need to be connected somehow to my arrow key keyboard triggers? Or does the mailbox/enable system just need to be present somewhere?

Also, I added [Once] --> [(false) Enabled] (thanks Latif3 for extra details - that really helped me understand), but it’s not disabling, so all the pieces are still moving when I hit an arrow key. Am I supposed to hook that up somehow to something else?

Hmm that’s weird. Because it should. Can you post a link to your game so we can take a look? Because I’m really sure something went wrong.

Setting enabled to false just disables the object’s physics and collisions - you can still move them manually. You’ll probably need to use some switches to disable your controls instead, just place the switches just after the Keyboard triggers.

You could then switch control from one pawn to the other by turning the bank of switches off and on.

Here’s my game, such as it is…
http://flowlab.io/game/view/547095

I agree with grazer…you need some switches. Depending on your game board rules, you set your parameters for a player’s turn, and then once those conditions have been met, you use turn off that player’s switches and send a message to the next to turn theirs on. So P1 would have, for example, [Up key]–>[(in) Switch], the switch set to on when the game starts. Your turn parameters would send a signal to [(off) Switch] when met and also send a message to P2. You would have a mailbox on P2 that would connect to [(on) Switch], along with identical control behaviors…and so on and so forth. You’ll get the hang of it :smile: