Discuss Scratch

MCAnimator3D
Scratcher
500+ posts

"Username different than others" block for multiplayer games.

I have trying to make a game that 4 Scratch users can play the same game together, but I ran into a problem. I do have the join game and pick a player button, but when it came to making the players move, all of the players move when I press W, A, S, or D. So I thought I could use the new “username” block to define which player is which. If there was an “username is different than others” statement block (goes in if/then block) then I could put that in an “and” block with the “key w pressed” in the other string box in the “and” block. That would make only one player get controlled by one user, not one user controls all the players in the game. With the new cloud variables, it would be easy to make it so one player's x and y position will be updated continuously on another player's screen.


scratch
mitchboy
Scratcher
1000+ posts

"Username different than others" block for multiplayer games.

Umm… how exactly would this work? How would you define “others”? A variable? List?

And I don't really see any uses for this except for a project exactly like yours. Plus, there's a workaround. Just instead of “username is different than others”, input “if <not (user1) = (user2)>” and do that for all players. Or, even better, only have “user1” equal to the first person and use "if <(username) = (user1)> and <key [] pressed> || move () steps".

Last edited by mitchboy (July 23, 2013 15:11:44)


Capsicum annuum.
MCAnimator3D
Scratcher
500+ posts

"Username different than others" block for multiplayer games.

It's supposed to work exactly like you explained. I see what you are saying, and that just might work! Thanks for the awesome tip!


scratch

Powered by DjangoBB