Discuss Scratch

PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

I just made a Multiplayer Platformer following the griffpatch tutorial and added a little more. I made it so when you are at a certain point of the level, your level will change. Like But when I played with people, when they went to the next level and I was still on the same level, it looked like they were walking on literally nothing. I need someone to help me with a script so when the opponent (person who just joined the game and is now playing with me) will disappear when they go to the next level so you can't see anyone walking on air.
deck26
Scratcher
1000+ posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

So the project should only show players on the same level and hide the others. You presumably have the level information passed by the cloud so it shouldn't be a problem - if you don't have the level information you need to add it!
PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

deck26 wrote:

So the project should only show players on the same level and hide the others. You presumably have the level information passed by the cloud so it shouldn't be a problem - if you don't have the level information you need to add it!
How do I add it??? I'm very confused.
deck26
Scratcher
1000+ posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

Are you including the level information or not?

If not you presumably have at least the x and y coordinates of each player being written to the cloud. You need to also write their level to the cloud so the local player can detect the level for the other player(s). If you understand what you're doing so far it shouldn't be difficult.
PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

deck26 wrote:

So the project should only show players on the same level and hide the others. You presumably have the level information passed by the cloud so it shouldn't be a problem - if you don't have the level information you need to add it!
Can it maybe be liked this
whenclickedforeverifcostume#=levelshow

Last edited by PixelBuild (Sept. 18, 2020 13:06:08)

PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

If this doesn't work i'm just going to make an infinite scrolling platformer so there will only be one level but it will be long.
deck26
Scratcher
1000+ posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

If you shared/identified the project it might help.

What data is each player passing to the other players via the cloud?

What script positions the sprites or clones that represent the other players? That script can equally well hide a player.

No idea why you're suggesting checking costume# in a loop and showing the sprite it costume#=level. That makes little sense to me but a script like that out of context is unlikely to make sense.

Do you actually understand how your project works or have you just copied scripts blindly? Doing the latter is a bad idea.
PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

deck26 wrote:

If you shared/identified the project it might help.

What data is each player passing to the other players via the cloud?

What script positions the sprites or clones that represent the other players? That script can equally well hide a player.

No idea why you're suggesting checking costume# in a loop and showing the sprite it costume#=level. That makes little sense to me but a script like that out of context is unlikely to make sense.

Do you actually understand how your project works or have you just copied scripts blindly? Doing the latter is a bad idea.

I followed the griffpatch tutortial and you can't blame me if i said I don't know EVERYTHING he said because after all, Multiplayer Scripts are probably the hardest scripts. I was kind of a beginner before I saw the video and I understand more like the join blocks and the encoding and decoding and all of that. If I would have copied it blindly, I would have looked up “How to make a multiplayer platformer” but I didn't because I just wanted griffpatch to teach me the basics of multiplayer so I can make it into a platformer. All I really need help with is making it so it changes the level only for one person. Here is the link to the gameYour text to link here…
deck26
Scratcher
1000+ posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

So the player doesn't send their level to the other players and you don't have the information you need to hide other players.

So after writing y position to encoded you need to write level to encoded so it is also written to the cloud.

The cloned other players will need a local variable for their level - perhaps call it ‘mylevel’. So when you decode their data you need to also decode ‘mylevel’. Rather than worry about disabling the movement just show or hide the clone according to whether or not mylevel=level (the local player's level).

I don't understand why the opponents sprite has a green flag script. If the opponents are clones and you get their positions from the cloud that script seems redundant to me. The sprite seems to stay hidden and I see no receivers for the broadcasts. Presumably the locla player should detect when it touches red or gets to the next level. Did you add this or was it in the original?
PixelBuild
Scratcher
11 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

The platformer stuff was the stuff that I added to the scripts. I would understand better if you remixed it and I could read the scripts. Then when I get it after that, I will modify the previous scripts I made.
deck26
Scratcher
1000+ posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

But I've given you all you need!

You have a custom block ‘write value to encoded’. After you write y position to encoded you need to write level to encoded.

The cloned opponents can't use the variable ‘level’ as the player is using that to keep track of their own level. And each opponent needs their own value so create a local (this sprite only) variable called ‘mylevel’ for the opponents.

So when the local player reads the data for the opponents it needs to include the level value and set the variable ‘mylevel’ to that value. So that's just an extra call to ‘value=read from encoded’ and ‘set mylevel to value’.

That only leaves hiding and showing which is just this, after the set mylevel to value.

ifmyvalue=levelthenshowelsehide
scratchking909
Scratcher
4 posts

Multiplayer Platformer. IT CHANGES THE LEVEL FOR EVERYONE!!! Help!?!?

deck26 wrote:

But I've given you all you need!

You have a custom block ‘write value to encoded’. After you write y position to encoded you need to write level to encoded.

The cloned opponents can't use the variable ‘level’ as the player is using that to keep track of their own level. And each opponent needs their own value so create a local (this sprite only) variable called ‘mylevel’ for the opponents.

So when the local player reads the data for the opponents it needs to include the level value and set the variable ‘mylevel’ to that value. So that's just an extra call to ‘value=read from encoded’ and ‘set mylevel to value’.

That only leaves hiding and showing which is just this, after the set mylevel to value.

ifmyvalue=levelthenshowelsehide
thank you i will try this

Powered by DjangoBB