Welcome to the wonderful world of AppGameKit Rossy
2D Mutidirection scrolling with wrapping example
SetVirtualResolution(1024,768)
GLOBAL Block as integer[5,4]
for y= 1 to 4
for x = 1 to 5
Block[x,y] = createSprite(0)
setSpriteSize(Block[x,y],300,300)
setSpritePosition(Block[x,y],(x-1)*300,(y-1) * 300)
setSpriteColor(Block[x,y],random(1,255),random(1,255),random(1,255),255)
next x
next y
do
speed#=10
if GetRawKeyState(37) //left arrow pressed
ScrollRight(speed#)
endif
if GetRawKeyState(39) //right arrow pressed
ScrollLeft(-speed#)
endif
if GetRawKeyState(38) //up arrow key pressed
ScrollDown(speed#)
endif
if GetRawKeyState(40) //Down arrow pressed
ScrollUp(-speed#)
endif
Sync ()
loop
function ScrollUp(y# as integer)
for y=1 to 4
for x = 1 to 5
SetSpritePosition (Block[x,y], getSpritex(Block[x,y]), GetSpriteY (Block[x,y]) + y#)
next x
for x = 1 to 5
if getSpriteY(Block[x,y])<-300
SetSpritePosition (Block[x,y], getSpritex(Block[x,y]), GetSpriteY (Block[x,y]) + 1200)
endif
next x
next y
endfunction
function ScrollDown(y# as integer)
for y=1 to 4
for x = 1 to 5
SetSpritePosition (Block[x,y], getSpritex(Block[x,y]), GetSpriteY (Block[x,y]) + y#)
next x
for x = 1 to 5
if getSpriteY(Block[x,y]) > GetVirtualHeight()
SetSpritePosition (Block[x,y], getSpriteX(Block[x,y]), GetSpriteY (Block[x,y]) - 1200)
endif
next x
next y
EndFunction
function ScrollLeft(x# as integer)
for y=1 to 4
for x = 1 to 5
SetSpritePosition (Block[x,y], GetSpriteX (Block[x,y]) + x#, GetSpriteY (Block[x,y]) )
next x
for x = 1 to 5
if getSpriteX(Block[x,y])<-300
SetSpritePosition (Block[x,y], GetSpriteX (Block[x,y]) + 1500, GetSpriteY (Block[x,y]))
endif
next x
next y
endfunction
function ScrollRight(x# as integer)
for y=1 to 4
for x = 1 to 5
SetSpritePosition (Block[x,y], GetSpriteX (Block[x,y]) + x#, GetSpriteY (Block[x,y]) )
next x
for x = 1 to 5
if getSpriteX(Block[x,y])> getVirtualWidth()
SetSpritePosition (Block[x,y], GetSpriteX (Block[x,y]) - 1500, GetSpriteY (Block[x,y]))
endif
next x
next y
endfunction
That's an older version of some code I made to make an endless map that should help if I find the
latest in my library of code I will post that.
I haven't tried the server side code in AppGameKit yet so cant help you there but there are several examples on the forum I will see what I can find.
There is much to learn how the AppGameKit commands work so I have Some
useful 2D and 3D examples
https://forum.thegamecreators.com/thread/222027fubar