Hi.
I want make a platform game and wrote a code for move view depend on move player, but It don't work good.
this is my code:
SetDisplayAspect( 4.0/3.0 )
global Player as Integer
global back as Integer
global ground as Integer
SetPhysicsGravity(0,100)
SetPhysicsWallLeft ( 0 )
SetPhysicsWallRight ( 0 )
//Create Player
Player = CreateSprite(0)
SetSpritepositionByOffset(Player,30,92)
SetSpriteDepth(Player,0)
SetSpriteColor(Player,255,0,0,255)
SetSpritePhysicsOn(Player,2)
FixSpriteToScreen(Player,1)
//Create Background
back = CreateSprite(0)
SetSpriteSize(back,GetDeviceWidth(),GetDeviceHeight())
SetSpritePosition(back,50,0)
//Create Ground
ground = CreateSprite(0)
SetSpritePosition(ground,0,95)
SetSpriteColor(ground,0,0,255,255)
SetSpriteSize(ground,GetDeviceWidth(),6)
SetSpritePhysicsOn(ground,1)
do
if GetRawKeyState(39) = 1
SetSpritePosition(Player,GetSpriteX(Player)+0.5,GetSpriteY(Player))
else
if GetRawKeyState(37) = 1
SetSpritePosition(Player,GetSpriteX(Player)-0.5,GetSpriteY(Player))
endif
endif
SetViewOffset(GetSpriteXByOffset(Player),GetViewOffsetY())
Sync()
loop
Please Guide Me to wrote a Platform view.
Thanks.