Discuss Scratch

Leo3333925
Scratcher
16 posts

Online Games

How can I make online games? I know that sounds dumb, but I don't know how. Is it something like this? Please, I am working really hard on a project that I want to have online support.
whenclickedgotox:0y:0setP1 xto0foreverifkeyright arrowpressed?thenchangexby10changeP1 xby10

P1 x is a cloud variable by the way. This is only for P1 x, but will it work?
Barbeque_Sus
Scratcher
100+ posts

Online Games

A better way would be
foreverifkeyright arrowpressed?thenchange☁ P1 xby10setxtoP1x
This is because cloud variables can only update every 1/10th of a second, and forever loops run 30 times a second, so the X would be higher than the cloud variable.

Last edited by Barbeque_Sus (Feb. 13, 2023 19:45:09)

kanomaster
Scratcher
100+ posts

Online Games

First off you need two have two scripts. One for sending information, and one for receiving information.
You should have two sprites for these as well. I'd have to show you to explain it though.

(Put your game link here and I'll experiment with it.)
Leo3333925
Scratcher
16 posts

Online Games

Thanks, but I think i might be able to handle it from here.
Also, a way to receive it is to do this;

whenclickedforeversetxtoP2x
This would be for the X on the other sprite, right?
kanomaster
Scratcher
100+ posts

Online Games

Yes
AntonL1kesPotato
Scratcher
1000+ posts

Online Games

It's something that can seem very complicated, i recommend searching up for tutorials. You can use max. 10 cloud variables, so using the variable only to store the x position is not efficient. Cloud variables can store up to 255 something numbers, so you could take advantage on that.

Powered by DjangoBB