Sure thing.
sync on : sync rate 60
set display mode 800,600,32
#constant SPRITE_FLOOR 1
#constant SPRITE_PLAYER 2
#constant SPRITE_PILLARS 3
#constant IMAGE_FLOOR 1
#constant IMAGE_PLAYER 2
#constant IMAGE_PILLAR 3
//Make images
create bitmap 1,50,600
set current bitmap 1
cls rgb(127,127,127)
get image IMAGE_PILLAR,0,0,49,599
delete bitmap 1
create bitmap 1,20,50
set current bitmap 1
cls rgb(127,200,127)
get image IMAGE_PLAYER,0,0,19,49
delete bitmap 1
create bitmap 1,4000,100
set current bitmap 1
cls rgb(255,255,255)
get image IMAGE_FLOOR,0,0,3999,99
delete bitmap 1
//Initialize some environment objects
DIM randomPillarThings(20) as integer
for c = 0 to 20
randomPillarThings(c) = rnd(4000)
sprite SPRITE_PILLARS + c, randomPillarThings(c), 0, IMAGE_PILLAR
offset sprite SPRITE_PILLARS + c, image width(IMAGE_PILLAR)/2, image height(IMAGE_PILLAR)
next c
//Initialize floor
floorpos = screen height()-100
sprite SPRITE_FLOOR, 0, floorpos, IMAGE_FLOOR
//Initialize player
playerXPos = 200
sprite SPRITE_PLAYER, playerXPos, floorpos, IMAGE_PLAYER
offset sprite SPRITE_PLAYER, image width(IMAGE_PLAYER)/2, image height(IMAGE_PLAYER)
//====== MAIN LOOP
do
cls rgb(0,0,0)
//Let player move around
if (leftkey())
dec playerXPos
//Restrict to ends of the map
if (playerXPos < 0) then playerXPos = 0
endif
if (rightkey())
inc playerXPos
//Restrict to ends of the map
if (playerXPos > 4000) then playerXPos = 4000
endif
//Figure out what position the "camera" should be at to keep the player centered
cameraX = playerXPos - screen width() / 2
//Stop camera at screen edges
if (cameraX < 0) then cameraX = 0
if (cameraX + 800 > 4000) then cameraX = 4000-800
//Draw pillars
//The position things are placed at is their real position minus the camera offset
for c = 0 to 20
sprite SPRITE_PILLARS + c, randomPillarThings(c)-camerax, floorpos, IMAGE_PILLAR
next c
//Draw floor
sprite SPRITE_FLOOR, -camerax, floorpos, IMAGE_FLOOR
//Draw player
sprite SPRITE_PLAYER, playerXPos-camerax, floorpos, IMAGE_PLAYER
sync
loop
There isn't much different between drawing boxes and drawing sprites. It's just important to remember that when you call SPRITE, it basically creates a persistent object that will just sit on the screen in the same place until you move it by calling SPRITE again. By contrast, when you draw BOXs or images, you have to draw them every frame - they get erased after each frame. Let me know if you have any specific questions about sprites.