Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Multiplayer, sprites update on each client, but not on host

Author
Message
prinsallan
3
Years of Service
User Offline
Joined: 29th Jul 2021
Location:
Posted: 21st Oct 2021 08:06
Hi everybody.
After a few weeks of tutorials, I finally made the simplest game possible to test multiplayer.
It consists of a red ball (host) and a green ball (client). They connect fine when picked from computer 1 and 2,
but when I move the red one, it only moves on the hosts screen, and vice versa with the green...
How do I tell the host to update on that computer and then send the location to the client?
Here's the code I have so far...


If you want to test it, you need the media-folder in the project, It can be found, zipped, below.

Best Regards
-Jonas

Attachments

Login to view attachments
Heavens
9
Years of Service
User Offline
Joined: 10th May 2015
Location:
Posted: 21st Oct 2021 09:57 Edited at: 21st Oct 2021 09:59
I done away with the media easy to add back in and a removed the type as you was doing different things with it but again should be able to add it back in replace it with two variables.



The main thing you was doing wrong was while sending the data you wasn't using it to position the sprite, you were only recording it in to x# and y# and then deleting it.

I'm also using different variable names for the sprite position, so it is more apparent what each sprite is using for its position.

The green sprite still won't move on the host, but with the info above, you should be able to work it out.

Login to post a reply

Server time is: 2024-11-24 02:12:36
Your offset time is: 2024-11-24 02:12:36