Woops though I had it in there
this is everything.
`Platformer Tutorial : Part 1 : March-08
`By Andrew Vanbeck
`Adjust resolution to suit
set display mode 1280,1024,32
sync on
sync rate 50
autocam off
set dir ".."
autocam off
hide mouse
global curobj=100
type maptype
col as byte
block as integer
id as integer
state as byte
marker$ as string
endtype
global map_x=500
global map_y=80
global plx#
global ply#
global plz#
global plf#
global pli#
global oplx#
global oply#
global plxs#
global plys#
global pdir#
global pdir
global retx
global rety
global retx#
global rety#
global curx#
global cury#
global curz#
global x#
global y#
global z#
global magnus
magnus = 0
dim char_col(2,2)
dim map(map_x,map_y) as maptype
`load image "media\backdrops\desert mountains.png",10
`Block 1, Brick
make object cube 31,5.0 : hide object 31
`Block 2, Jewel
load object "media\meshes\jewel.x",32 : hide object 32
`Block 3, Enemies
make object cube 33,4.5 : hide object 33
`Ice
make object cube 36,5.0 : hide object 36
`Cones
make object cone 37,5.0 : hide object 37
`Make editor plain
make object plain 10,5000,5000 : rotate object 10,0,0,0
ghost object on 10 : color object 10,0
`Create Magnus
make object sphere 35,6.0 : disable object zdepth 35 : color object 35, rgb(155,0,0)
`Block = 12
global map_tran$=" *ofgw#dlvica"
`global jewel_count
`global jewel_score
`jewel_count=0
`jewel_score=0
gosub set_testmap
gosub build_map
set camera range 20.0,1000.0
color backdrop rgb(128,128,255)
fog distance 1000
fog off
fog color rgb(128,128,255)
remstart
`Make backdrop plains
for n=0 to 4
make object plain 20+n,146*7,87*5
position object 20+n,map_x*2.5,n*50.0-rnd(32),300+(n*50)
texture object 20+n,10
scroll object texture 20+n,rnd(100)/100.0,0.0
set object transparency 20+n,2
set object texture 20+n,0,0
set object fog 20+n,1
next n
remend
load object "media\characters\schlump.x",5 : loop object 5
do
remstart
`Work out 3D location of mouse cursor, using plain object 10
pobj=pick object(mx,my,10,10)
if pobj=10
curx#=camera position x()+get pick vector x()
cury#=camera position y()+get pick vector y()
curz#=camera position z()+get pick vector z()
curx=int(curx#/5)
cury=int(cury#/5)
position object 35,(curx*5.0)+2.5,(cury*5.0)+2.5,0.0
endif
remend
` In your main loop / function that is called from there
pobj = pick object(mousex(), mousey(), 10, 10)
if pobj = 10
x# = camera position x(0) + get pick vector x()
y# = camera position y(0) + get pick vector y()
z# = camera position z(0) + get pick vector z()
` For the Y-coordinate, you can also use the height of the ground
` object at the particular (x, y) position
position object 35, x#, y#, z#
endif
position object 33,xx#+1,yy#,zz#
`64-400
SET CAMERA TO FOLLOW plx#, ply#, 0, 0, 100, 10, 1, 0
plz# = object position z(5)
`position object 35,mousex(),-mousey(),0
update_player()
update_pickups()
update_magnus()
`text 0,0,"Jewels: "+str$(jewel_score)+"\"+str$(jewel_count)
text 0,0,"Element: "+str$(magnus)
sync
loop
`-------------------------------------------------------------------------------------
set_testmap:
` 000000000011111111112222222222333
` ## 012345678901234567890123456789012
map_set(00,"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE")
map_set(01,"* ********************************* *")
map_set(02,"* ** * *")
map_set(03,"* ** * *")
map_set(04,"* d ** * *")
map_set(05,"* d ** * *")
map_set(06,"* ddd ddd * c *")
map_set(07,"* ddddddd ddddd o * c a c *")
map_set(08,"* dd#dd ************ ddd#ddd *********************************************** * a aaa a *")
map_set(09,"* S # # f *************** * o aaaaaaaaaaa *")
map_set(10,"*********************************************iiiiiiiii*************** o * aaaaaaaaaaa *")
map_set(11,"*********************************************iiiiiiiii*************** * v ***********************************************")
map_set(12,"************************************************iiiiii*************** ******************************** v# ***********************************************")
map_set(13,"************************************************iiiiii*************** ## v ***********************************************")
map_set(14,"********************************************************************** ###v ***********************************************")
map_set(15,"*********************************************************************** v### ***********************************************")
map_set(16,"******************************************************************************** # ***********************************************")
map_set(17,"********************************************************************************* # ***********************************************")
map_set(18,"*************************************************************************************************************************************************************************")
map_set(19,"*************************************************************************************************************************************************************************")
map_set(20,"*************************************************************************************************************************************************************************")
map_set(21,"*************************************************************************************************************************************************************************")
map_set(22,"*************************************************************************************************************************************************************************")
map_set(23,"*************************************************************************************************************************************************************************")
map_set(24,"iv**********************************************************************************************************************************************************************v")
return
`-------------------------------------------------------------------------------------
build_map:
for y=0 to map_y
for x=0 to map_x
curobj=((y*(map_x+1))+x)+1000
if object exist(curobj)=1 then delete object curobj
xx#=(x*5.0)+2.5
yy#=(y*5.0)+2.5
zz#=0.0
if map(x,y).block=1 `Brick
map(x,y).id=curobj
clone object curobj,31
scale object curobj,100,100,200
r=150 : g=100 : b=20
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=2 `Health Pickup
inc jewel_count,1
map(x,y).id=curobj
map(x,y).state=0
clone object curobj,32
r=100 : g=255 : b=0
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
ghost object on curobj
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=3 `Enemy (Fire)
map(x,y).id=curobj
clone object curobj,33
scale object curobj,100,100,100
r=255 : g=0 : b=0
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=4 `Enemy (Grass)
map(x,y).id=curobj
clone object curobj,33
scale object curobj,100,100,100
r=255 : g=0 : b=0
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=5 `Enemy (Water)
map(x,y).id=curobj
clone object curobj,33
scale object curobj,100,100,100
r=255 : g=0 : b=0
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=6 `treetrunk
map(x,y).id=curobj
clone object curobj,31
scale object curobj,100,100,100
r=50 : g=20 : b=5
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#+5
endif
if map(x,y).block=7 `treeleaves
map(x,y).id=curobj
clone object curobj,31
scale object curobj,100,100,100
r=0 : g=255 : b=5
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#+5
endif
if map(x,y).block=8 `Environment Lava
map(x,y).id=curobj
clone object curobj,36
scale object curobj,100,100,200
r=150 : g=100 : b=20
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=9 `Environment Vines
map(x,y).id=curobj
clone object curobj,36
scale object curobj,100,100,200
r=80 : g=255 : b=80
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=10 `Environment Ice
map(x,y).id=curobj
clone object curobj,36
scale object curobj,100,100,200
r=100 : g=100 : b=255
color object curobj,rgb(r,g,b)
ghost object on 36,1
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#
endif
if map(x,y).block=11 `cones
map(x,y).id=curobj
clone object curobj,37
scale object curobj,100,250,100
r=100 : g=100 : b=100
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#+5
endif
if map(x,y).block=12 `altar
map(x,y).id=curobj
clone object curobj,31
scale object curobj,100,100,100
r=100 : g=100 : b=100
color object curobj,rgb(r,g,b)
set object emissive curobj,rgb(r/2,g/2,b/2)
position object curobj,xx#,yy#,zz#+5
endif
next x
next y
return
`-------------------------------------------------------------------------------------
function map_set(y,marker$)
y=map_y-y
for p=1 to map_x+1
pm$=mid$(marker$,p)
x=p-1
if pm$="S" `Start marker
plx#=(x*5.0)
ply#=(y*5.0)
endif
for n=1 to len(map_tran$)
if mid$(map_tran$,n)=pm$ then map(x,y).block=n-1
next n
map(x,y).marker$=pm$
next p
endfunction
`-------------------------------------------------------------------------------------
function update_player()
oplx#=plx#
oply#=ply#
`Left and Right movement control
mv=0
if keystate(30)=1 then mv=-1
if keystate(32)=1 then mv=1
`Adjust player speeds
if mv=-1 then dec plxs#,0.4
if mv=1 then inc plxs#,0.4
if mv=0 then plxs#=plxs#/1.4
if mv=0 and plxs#>-0.05 and plxs#<0.05 then plxs#=0.0
`Limit player speed
if plxs#<-1.0 then plxs#=-1.0
if plxs#>1.0 then plxs#=1.0
`Update animation
if plf#<49
`Static or moving
if mv=0
plf#=10.0+(sin(timer()/10.0)*7.0)
else
if plf#<19 then plf#=19 : pli#=1.0
inc plf#,abs(plxs#*2.0)
if plf#>44 then dec plf#,20.0
endif
else `Jumping
inc plf#,0.5
if plf#>51 then plf#=51
endif
`Update player position
inc ply#,plys#
inc plx#,plxs#
`Increase player drop rate
dec plys#,0.2
if plys#<-2.5 then plys#=-2.5
`USAGE:x#,y#,Radius#,Height#
colb=character_col(plx#,ply#,3.0,6.5)
if colb=1
if character_col(plx#,oply#,3.0,6.5)=1 then plx#=oplx#
if character_col(oplx#,ply#,3.0,6.5)=1
ply#=oply#
if plys#<0 then plys#=plys#*0.5 else plys#=0
if plf#>50 then plf#=0.0
pli#=2.0
endif
if character_col(plx#,ply#,3.0,6.5)=1 `Safety measure, avoid sticking
plx#=oplx# : plxs#=0.0
ply#=oply# : plys#=0.0
endif
endif
if keystate(17)=1 and character_col(plx#,ply#-1.5,3.0,6.5)=1
plys#=3.5
plf#=51
pli#=3.0
endif
`Update player direction Left:Pdir=-1, Right:Pdir=1
if plxs#>0.2 and pdir<1 then pdir=1
if plxs#<-0.2 and pdir>-1 then pdir=-1
if pdir<0 then dec pdir#,0.3
if pdir>0 then inc pdir#,0.3
`Limit Pdir
if pdir#>1.0 then pdir#=1.0
if pdir#<-1.0 then pdir#=-1.0
`Update player animation smoothing
dec pli#,0.1 : if pli#<0 then pli#=0 else set object interpolation 5,pli#
`Update player position etc
position object 5,plx#,ply#,0 : rotate object 5,0,pdir#*-90.0,0
set object frame 5,plf#
endfunction
`-------------------------------------------------------------------------------------
function update_pickups()
ang#=timer()/3.0
for y=0 to map_y
for x=0 to map_x
if map(x,y).block=2
rotate object map(x,y).id,0,ang#+(map_x*10.0),0
endif
next x
next y
endfunction
`-------------------------------------------------------------------------------------
function character_col(x#,y#,r#,h#)
col=0
charcol=0
for yy=0 to 2
for xx=0 to 2
xx#=0.0
if xx=2 then xx#=r#
if xx=0 then xx#=0.0-r#
yy#=h#/2.0
if yy=0 then yy#=h#
if yy=2 then yy#=0
col=map_block(x#+xx#,y#+yy#)
if col=1 then charcol=1
if col=2
if map(retx,rety).state=0
inc jewel_score,1
obj=map(retx,rety).id
map(retx,rety).state=1
map(x,y).block=0
hide object obj
endif
endif
if col=3
text 0,10, "HIT"
endif
if col=9 then charcol=1
char_col(xx,yy)=col
next xx
next yy
endfunction charcol
`-------------------------------------------------------------------------------------
function map_block(x#,y#)
x=int(x#/5.0)
y=int(y#/5.0)
if x<0 then x=0
if x>map_x then x=map_x
if y<0 then y=0
if y>map_y then y=map_y
retx=x
rety=y
col=map(x,y).block
endfunction col
function update_magnus()
if keystate(16) = 1 and magnus = 0
color object 35, rgb(0,155,0)
magnus = 1
else if keystate(16) = 1 and magnus = 1
color object 35, rgb(0,0,155)
magnus = 2
else if keystate(16) = 1 and magnus = 2
color object 35, rgb(155,0,0)
magnus = 0
endif
endif
endif
if keystate(18) = 1 and magnus = 0
color object 35, rgb(0,0,155)
magnus = 2
else if keystate(18) = 1 and magnus = 2
color object 35, rgb(0,155,0)
magnus = 1
else if keystate(18) = 1 and magnus = 1
color object 35, rgb(155,0,0)
magnus = 0
endif
endif
endif
endfunction
but the line im trying to use to make it move is
position object 33,xx#+1,yy#,zz#
Sorry about the lack of comments i just never remember to do them untill i need help