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.
SetDisplayAspect ( 4.0 / 3.0 )
CreateSprite ( 1, 0)
SetSpritePosition ( 1, 10, 20 )
SetSpriteSize ( 1, 10, -1 )
SetSpriteColor(1, 255, 0, 0, 255)
CreateSprite ( 2, 0)
SetSpritePosition ( 2, 50, 20 )
SetSpriteSize ( 2, 10, -1 )
SetSpriteColor(2, 0, 255, 0, 255)
Global NetworkID As Integer = 0
Global State As Integer = 0
Global iAmHost As Integer = 0
Global iAmClient As Integer = 0
do
if State = 0
Print ( "Select Red ball to host a game" )
Print ( "Select Green ball to join a game" )
if GetPointerPressed ( ) = 1
hit = GetSpriteHit ( GetPointerX ( ), GetPointerY ( ) )
if ( hit = 1 )
NetworkID = HostNetwork ( "AGK Test Game", "Player 1", 44441 )
iAmHost = 1
Elseif ( hit = 2 )
NetworkID = JoinNetwork ( "AGK Test Game", "Player 2" )
iAmClient = 1
endif
State = 1
endif
endif
if State = 1 and IsNetworkActive ( NetworkID ) <> 0
id = GetNetworkFirstClient ( NetworkID )
while id <> 0
Print ( GetNetworkClientName ( NetworkID, id ) )
id = GetNetworkNextClient ( NetworkID )
endwhile
if iAmHost = 1
x1# = GetSpriteX ( 1 ) + GetDirectionX ( )
y1# = GetSpriteY ( 1 ) + GetDirectionY ( )
SetSpritePosition ( 1, x1#, y1# )
messageID = CreateNetworkMessage ( )
AddNetworkMessageFloat ( messageID, x1# )
AddNetworkMessageFloat ( messageID, y1# )
SendNetworkMessage ( NetworkID, 0, messageID )
Elseif iAmClient = 1
x2# = GetSpriteX ( 2 ) + GetDirectionX ( )
y2# = GetSpriteY ( 2 ) + GetDirectionY ( )
SetSpritePosition ( 2, x2#, y2# )
messageID = GetNetworkMessage ( NetworkID )
while messageID <> 0
x1# = GetNetworkMessageFloat ( messageID )
y1# = GetNetworkMessageFloat ( messageID )
SetSpritePosition ( 1, x1#, y1# )
DeleteNetworkMessage ( messageID )
messageID = GetNetworkMessage ( NetworkID )
endwhile
endif
endif
Sync ( )
loop
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.