Multiplayer AFK player deleted

I have a student who is trying to make a multiplayer game, but if only 2 of the 4 players are active, the other 2 players will be deleted. Below is a screenshot of what we tried for the code. This deleted the 2 players that were actually playing the game, not the unconnected players. Any ideas?

5 Likes

P1, P3, and P4 are swapped here

3 Likes

instead of deleting them if they’re inactive, have you considered using the “on player connected” event instead? that event will fire whenever a player first gives input (or connects to the game if using online multiplayer) and you could create the sprite inside of that event rather than destroying it when they stop moving.

if you’re set on having a “dead man’s switch” in your game though, I would do something like this:

(note that this example uses the multiplayer extension, which i think you’ll find makes working with four players way easier)

or, if the intention is just to make it so that once they’ve done any input then they are no longer at risk of being deleted, i’d set a boolean for each player instead of keeping track of the last input time like so:

3 Likes

ah good catch. I will have him try swapping that.

2 Likes

It would be cool to add sprites saying use character or something like that like some arcade games
[this being insert for the other round]
Insert Coin, the arcade documentary worth feeding all your quarters into -  Ars Technica

2 Likes