Posted: 4th Jan 2004 9:15
Since I was making a 2d scroller I will post some of my source code. The collision course works pretty well just need to make the collision course for the corners. You might have to load more images for like the back ground and main charater. I use tiles that are 50x50. Well Pretty Much this is simple code and not hard to read. Hope I edited good enough for here.
+ Code Snippet
set display mode 640,480,16

`//then Load the tiles here and other images
load image "textures/sgrass.bmp",1
`//And load more etc....

`//I like adding points at my end of my main charater
box 0,0,10,5
get image 7,0,0,10,5

box 0,0,5,10
get image 8,0,0,5,10

`//Load Level

`//Defone all the varibles
warray=1
numcoory=0
numcoorx=0
numimgs=0
once$="on"
vnum=1
rowx=12
rowy=5
fall$="off"
y=0
x=0

`//Reads the map Data
level:
data 0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,1,0,0,0,0,0
data 0,0,0,0,0,1,1,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1,1,1,1



for rowya=1 to rowy
for rowxa=1 to rowx
read tile


if tile>=1
numimgs=numimgs+1
numcoorx=numcoorx+1
numcoory=numcoory+1
endif
next rowxa
next rowya


`//sets up the arrays

dim imgcoorx(numcoorx)
dim imgcoory(numcoory)
dim imgnum(numimgs)
restore level
for rowya=1 to rowy
for rowxa=1 to rowx
read tile
`//sets up the tiels for the map



if tile=1
imgnum(warray)=1
imgcoorx(warray)=x
imgcoory(warray)=y
warray=warray+1
endif

x=x+50
next rowxa
y=y+50
x=0
next rowya

gravity$="on"
xz=0
yz=0
ok$="none"

sync on
sync rate 100
`//Load Game

uys=2
dys=-2
lxs=2
rxs=-2
`//background
sprite numcoory+6,0,20,10
set sprite numcoory+6,0,0
sleep 500
`//set up some sprites

`//main charater and some sticky helpers
sprite numcoory+1,screen width()/2,screen height()/2,24
`Right
sprite numcoory+2,screen width()/2+35,screen height()/2+20,7
`left
sprite numcoory+3,screen width()/2-5,screen height()/2+20,7
`top
sprite numcoory+4,screen width()/2+20,screen height()/2-5,8
`bottom
sprite numcoory+5,screen width()/2+20,screen height()/2+60,8

`//Finishing setting up the sprites
set sprite numcoory+1,0,1
sleep 500
set sprite numcoory+2,0,0
sleep 500
set sprite numcoory+3,0,0
sleep 500
set sprite numcoory+4,0,0
sleep 500
set sprite numcoory+5,0,0

play music 1
loop music 1

do
cls

uys=2
dys=-2
lxs=3
rxs=-3
if jump$="off" then dys=0


`// Collision course
for mlevel=1 to numcoory
sprite mlevel,imgcoorx(mlevel)+xs,imgcoory(mlevel)+ys,imgnum(mlevel)

if sprite hit(mlevel,numcoory+1) and sprite hit(mlevel,numcoory+3)
lxs=0
endif

if sprite hit(mlevel,numcoory+1) and sprite hit(mlevel,numcoory+2)
rxs=0
endif

if sprite hit(mlevel,numcoory+1) and sprite hit(mlevel,numcoory+5)
dys=0
gravity$="off"
jump$="on"
fall=1
ELSE if dys=-2
fall=0
gravity$="on"
endif:endif

if sprite hit(mlevel,numcoory+1) and sprite hit(mlevel,numcoory+4)
gravity$ = "on"
jump$="neutral"
j=0
uys=0
endif



next mlevel
`//end collision course
print fall;



if rightkey()=1
xs=xs+rxs
endif
if leftkey()=1
xs=xs+lxs
endif
if spacekey()=1 and jump$="on"
jump$="off"
fall$="off"
endif


`//Jump Code
if jump$="off"
ys=ys+3
inc j
endif

if j = 50
gravity$ = "on"
jump$="neutral"
j=0
endif
`//---End Jump code


if gravity$="on" then ys=ys-3
set cursor 300,0
print screen fps()
sync
loop
Posted: 10th Jan 2004 3:27
sorry to say but it doesnt work