Discuss Scratch

SeuAmigo35
Scratcher
500+ posts

How to create an multiplayer game?

one day i saw an video on YouTube showing how to make an multiplayer game (the easiest way), but it's not working!!!
Type of game: Multiplayer team cannon game
What gone wrong: Red cannon can't join the game!
Scripts:
Load (an invisible character):
whenclickedgotox:0y:0showsetP1 online?to0setP2 online?to0setPlayer IDto0set☁ Player1 checktoP1online?set☁ Player2 checktoP2online?sayLoading...for2secsifPlayer1check=P1online?thensetPlayer IDto1set☁ Player1 checkto0broadcastjoinelseifPlayer2check=P2online?thensetPlayer IDto2set☁ Player2 checkto0broadcastjoinelsesaysorry, the server is full :( try again later.for5secsstopall
whenIreceivejoinifPlayerID=1thenforeversetPlayer1 checkto1wait1secsifPlayerID=2thenforeversetPlayer2 checkto1wait1secs
P1 (Blue Cannon):
whenclickedgotox:-200y:0hide
whenIreceivejoinifPlayerID=1thenshowforeversetP1 XtoxpositionsetP1 YtoypositionsetP1 DtodirectionwhenIreceivejoinifPlayerID=1thenforeverifkeyup arrowpressed?thenchangeyby3whenIreceivejoinifPlayerID=1thenforeverifkeydown arrowpressed?thenchangeyby-3whenIreceivejoinifPlayerID=1thenforeverifkeyleft arrowpressed?thenchangexby-3whenIreceivejoinifPlayerID=1thenforeverifkeyright arrowpressed?thenchangexby3whenIreceivejoinifPlayerID=2thenwaituntilPlayer2check=1forevergotox:P1Xy:P1YpointindirectionP1DwhenIreceivejoinifPlayerID=1thenforeverpointtowardsmouse pointer
P2 (Red Cannon):
whenclickedgotox:200y:0hide
whenIreceivejoinifPlayerID=2thenshowforeversetP2 XtoxpositionsetP2 YtoypositionsetP2 DtodirectionwhenIreceivejoinifPlayerID=2thenforeverifkeyup arrowpressed?thenchangeyby3whenIreceivejoinifPlayerID=2thenforeverifkeydown arrowpressed?thenchangeyby-3whenIreceivejoinifPlayerID=2thenforeverifkeyleft arrowpressed?thenchangexby-3whenIreceivejoinifPlayerID=2thenforeverifkeyright arrowpressed?thenchangexby3whenIreceivejoinifPlayerID=1thenwaituntilPlayer1check=1forevergotox:P2Xy:P2YpointindirectionP2DwhenIreceivejoinifPlayerID=2thenforeverpointtowardsmouse pointer

Last edited by SeuAmigo35 (July 31, 2020 16:41:24)

Scratcheur-2020
Scratcher
100+ posts

How to create an multiplayer game?

You can join multiple scripts
SeuAmigo35
Scratcher
500+ posts

How to create an multiplayer game?

Scratcheur-2020 wrote:

You can join multiple scripts
ummm can you tell me what it means and how to do it?

Powered by DjangoBB