Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » please help me make multiplayer and online games
- Prestonko
-
Scratcher
11 posts
please help me make multiplayer and online games
reply if you know how and please help me i need help i try but fail and idk how to make good games so ill apricate any help i can get
- bsteichman
-
Scratcher
500+ posts
please help me make multiplayer and online games
this is code for a co op game
in player sprite:
now make a sprite with the exact same costumes as the player sprite
you still need to make movement code and well, a game but this will make it so you can see other players doing the game.
also if you want more players (up to 100) use clones.
cons with using clones…
1: laggy: clones are laggy and you have to use an encode/decoder to split them and know what coordinates pair for what person
2: more complicated: it requires more skill (clone id, encode/decode)
pros of using clones
1: large player count
2: no extra sprites
in player sprite:
when green flag clickedthe costume thing is optional don't put if in if you don't need it because it uses a cloud variable
forever
reset timer
end
when [timer v] > (.2)
change [☁players v] by (-1)
when green flag clicked
change [☁players v] by [1]
set [player v] to (☁players)
if <(player) = [1]> then
forever
set [☁player 1 X v] to (x position :: motion)
set [☁player 1 Y v] to (y position :: motion)
set [☁costume 1 v] to (costume [number v] :: looks)
end
else
if <(player) = [2]> then
forever
set [☁player 2 X v] to (x position :: motion)
set [☁player 2 Y v] to (y position :: motion)
set [☁costume 2 v] to (costume [number v] :: looks)
end
else
switch costume to [too many players error message v]
say [too many player online wait for somebody to leave] for (2) secs
end
end
now make a sprite with the exact same costumes as the player sprite
when green flag clickedthe 2
wait (0) secs
wait (0) secs
if <(player) = [1]> then
forever
glide (.15) secs to x: (☁player 2 X) y: (☁player 2 Y)
switch costume to (☁costume 2)
end
else
glide (.15) secs to x: (☁player 1 X) y: (☁player 1 Y)
switch costume to (☁costume 1)
end
wait (0) secsjust means to wait 2 frames
you still need to make movement code and well, a game but this will make it so you can see other players doing the game.
also if you want more players (up to 100) use clones.
cons with using clones…
1: laggy: clones are laggy and you have to use an encode/decoder to split them and know what coordinates pair for what person
2: more complicated: it requires more skill (clone id, encode/decode)
pros of using clones
1: large player count
2: no extra sprites
Last edited by bsteichman (April 13, 2021 14:17:20)
- Prestonko
-
Scratcher
11 posts
please help me make multiplayer and online games
ill try to rember that dont delete it
- EmeraldCreeper789Dev
-
Scratcher
1000+ posts
please help me make multiplayer and online games
i tried this and it didnt do anything 

- Discussion Forums
- » Help with Scripts
-
» please help me make multiplayer and online games


