ok here's how it goes:
-Make a sprite for the player and another one for the floor
-Make an animated sprite for the tiles
-Loop
-player input
-gravity and jumping functions
-update sprites
-update tiles
-update screen
-End Loop
i only have one sprite for all tiles (animated sprite) which i chage it's frame every time i want to put a diffrent tile.
i need sprite for every collision detection with the player.
is it good? it's all done to code here it is:
sync on : sync rate 60
backdrop on : color backdrop rgb(82,245,245)
hide mouse
`-----
`Objects
box 0,0,10,10
get image 1,0,0,10,10
cls
line 0,0,640,17
get image 2,0,0,640,17
cls
`Tiles
load image "platform1.bmp",3
load image "platform2.bmp",4
create animated sprite 3,"platform1.bmp",18,11,3
size sprite 3,17,17
`Globals
xPos=20
yPos=400
High=0
Jump=1
Speed=5
KeyUp=0
`Primary Loop
do
if leftkey()=1 then xPos=xPos-Speed
if rightkey()=1 then xPos=xPos+Speed
if xPos>630 then xPos=630
if xPos<0 then xPos=0
if upkey()=1 and Jump=0 then KeyUp=1
if Jump=0 and KeyUp=1 then High=High+5
if High > 25 then High=25 : Jump=1 : KeyUp=0
if Jump=1 then High = High - 1
sprite 1,xPos,(yPos-High),1
sprite 2,0,446,2
gosub Make_World
if sprite collision(1,2) then Jump=0
sync
loop
Make_World:
`upper ground
set sprite frame 3,182
for i = 0 to 37
paste sprite 3,i*17,446
next i
`ground
set sprite frame 3,186
for i = 0 to 37
paste sprite 3,i*17,463
next i
return