Hi,
I am working on a 2d platformer (very similar to mario) and so far i have a sprite whom runs left and right, but iv come across a problem...
basically, i have a level editor that works by having a bunch of data strings, made of 1s and 0s,and if there is a 1 present then it should paste an image from a spritesheet
tile=24
spritenum=2
`making the level
for y=0 to 12
for x=0 to 16
`reads the data at the bottom of the program
read a
`if a=1 puts a sprite in the right place on the screen
if a=1
sprite spritenum,x*40,y*40,tile
t=t+1
endif
next x
next y
`data
data 0,0,0,1,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,0,0,0,0
data 0,0,0,1,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,0,0,0,0
data 0,0,0,0,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,0,0,0,0
data 0,0,0,0,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,0,0,0,0
data 0,0,0,0,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,0,0,0,0
data 0,0,0,0,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,0,0,0,0
it does not come up with a syntax error but it does not print the sprite either
Please help, thanks in advance
PS. Here is the full code
`GHOST TEST
`tiles 1-23=ghost
`tiles 24-27=ground
cls
`ghost
load bitmap "ghostsheet.bmp",1
`A=Hight of frame
A=40
`B=Width of frame
b=40
`C=Num of frames along Row
c=4
`D=Num of frames in Anim
d=23
`E=Num of rows-1
e=5
`f=num of frames in row-1 so leave as is
f=c-1
for y=0 to e
for x=0 to f
get image 1+x+(y*c),(x*b),(y*a),(x*b)+b,(y*a)+a
next x
next y
delete bitmap 1
`tiles
load bitmap "tilesheet.bmp",2
`A=Hight of frame
A=40
`B=Width of frame
b=40
`C=Num of frames along Row
c=2
`D=Num of frames in Anim
d=4
`E=Num of rows-1
e=1
`f=num of frames in row-1 so leave as is
f=c-1
for y=0 to e
for x=0 to f
get image 24+x+(y*c),(x*b),(y*a),(x*b)+b,(y*a)+a
next x
next y
delete bitmap 2
xpos=200
ypos=200
image=7
rightspeed#=0
leftspeed#=0
acceleration#=0.5
sync on
sync rate 30
`--------------------------
do
`--------------------------
`------------------------MOVE GHOST-----------------------------
`sprite
sprite 1,xpos,ypos,image
wait 1
`run
if keystate(29)=1 then topspeed=10
if keystate(29)=0 then topspeed=5
`right
if keystate(205)=1
if keystate(203)=0
image=image+1
if image>11 then image=7
rightspeed# = rightspeed# + 0.25
if rightspeed#>topspeed then rightspeed# = rightspeed#-0.5
leftspeed#=leftspeed#+0.25
endif
endif
`left
if keystate(203)=1
if keystate(205)=0
if image<12 then image=12
image=image+1
if image>21 then image=16
leftspeed# = leftspeed# - 0.25
if leftspeed#<-topspeed then leftspeed# = leftspeed#+0.5
rightspeed#=rightspeed#-0.25
endif
endif
`no keys pressed
if keystate(203)=0
if keystate(205)=0
image = 1
rightspeed#=rightspeed#-0.5
leftspeed#=leftspeed#+0.5
endif
endif
`both keys pressed (skid)
if keystate(203)=1
if keystate(205)=1
`still
if rightspeed# + leftspeed# =0
image = 1
endif
`skidding left
if rightspeed# + leftspeed# >0
image = 22
endif
`skidding right
if rightspeed# + leftspeed# <0
image = 23
endif
`calculate skid
rightspeed#=rightspeed#-0.5
leftspeed#=leftspeed#+0.5
endif
endif
`renaming values
if leftspeed#>0 then leftspeed#=0
if rightspeed#<0 then rightspeed#=0
xpos=xpos+rightspeed#+leftspeed#
`------------E-N-D -MOVE GHOST----------------------
`------------ MAKE LEVEL -------------------------------------
tile=24
spritenum=2
`making the level
for y=0 to 12
for x=0 to 16
`reads the data at the bottom of the program
read a
`if a=1 puts a sprite in the right place on the screen
if a=1
sprite spritenum,x*40,y*40,tile
t=t+1
endif
next x
next y
`data
data 0,0,0,1,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,0,0,0,0
data 0,0,0,1,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,0,0,0,0
data 0,0,0,0,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,0,0,0,0
data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0
data 0,0,0,0,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,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
sync
loop