Ok, I sem to be having problems with this, and many of you who half half a brain for programmin, will be able to figure this out lickity split. But I\'m new, again, so I need help... heres my whole entire code... I can\'t figure out how to get collision to work on the left wall, i can get it to work, but you can also jump if your touching the left wall, which allows you to use it as an elevator by holding the space button while touching it.
Chris K made an attempt to teach me this last year, but as you can see, it went through on ear and out the other for me...
set display mode 1024,768,16
hide mouse
autocam off
sync on : sync rate 30
dim level#(10,10)
dim walls(100)
numwalls=0
position camera 50, 50, -100
point camera 50,50,1
global ladder = 1000
global wall = 1001
global coin = 1002
global victory = 1003
global coin5 = 1004
global starting = 1005
global ladders = 1000
global walls = 1001
global coins = 1002
global victorys = 1003
global coin5s = 1004
global startings = 1005
set text size 18
set text to bold
levelstart = 1
global gravity#=.001
do
if levelstart = 1
if currlevel = 1
restore level1
endif
if currlevel = 2
restore level2
endif
for levely = 1 to 10
for levelx = 1 to 10
read levelv
level#(levely,levelx) = levelv
if levelv = 1
inc wall,8
walls(numwalls)=wall
numwalls=numwalls+1
make object cube wall,10
color object wall, rgb(0,160,160)
position object wall,(levelx*10),(levely*10),1
show object wall
endif
if levelv = 2
inc ladder,8
make object cylinder ladder,10
color object ladder,rgb(255,0,0)
position object ladder,(levelx*10),(levely*10),1
ghost object on ladder
show object ladder
endif
if levelv = 3
inc coin,8
make object sphere coin,5
position object coin,(levelx*10),(levely*10),1
color object coin,rgb(201,199,186)
endif
if levelv = 4
inc victory,8
make object cube victory,5
color object victory,rgb(255,255,0)
position object victory,(levelx*10),(levely*10),1
endif
if levelv = 5
inc coin5,8
make object sphere coin5,5
color object coin5,rgb(160,240,40)
position object coin5,(levelx*10),(levely*10),1
endif
if level = 6
inc starting,8
make object cube starting,5
color object starting, rgb(0,255,0)
position object starting,(levelx*10),(levely*10),1
endif
next x
next y
make object sphere 1,7
position object 1,20,20,1
x#=20
y#=20
levelstart = 0
endif
coincollision(coins)
coin5collision(coin5s)
laddertemp=laddercollision(ladders)
gosub _ground_wall_collision
gosub _left_wall_collision
if leftkey() = 1 and left# <=0 then x#=x#-1
if rightkey() = 1 then x#=x#+1
if upkey() = 1 and laddertemp=1 then y#=y#+1
if downkey() = 1 and laddertemp=1 then y#=y#-1
for i = 1009 to 1809 step 8
if object exist (i)
if object collision (1,i) > 0
position object 1,x#,y#, 1
else
position object 1,x#,y#, 1
endif
endif
next i
sync
Loop
level1:
data 1,1,1,1,1,1,1,1,1,1
data 1,4,3,3,3,3,3,6,2,1
data 1,3,0,1,1,1,1,1,2,1
data 1,3,2,0,3,3,3,3,0,1
data 1,3,2,1,1,1,1,3,1,1
data 1,3,0,3,3,3,3,0,2,1
data 1,3,1,1,1,1,0,0,2,1
data 1,3,3,3,3,3,1,1,2,1
data 1,3,0,0,0,0,3,3,0,1
data 1,1,1,1,1,1,1,1,1,1
level2:
data 1,1,1,1,1,1,1,1,1,1
data 1,5,1,3,2,3,0,3,6,1
data 1,0,3,0,2,1,3,0,0,1
data 1,3,1,0,0,0,1,1,1,1
data 1,0,5,0,4,3,0,3,2,1
data 1,1,0,1,0,1,0,1,2,1
data 1,2,0,0,0,3,0,0,0,1
data 1,2,1,1,5,1,5,1,1,1
data 1,0,0,0,0,0,0,0,0,1
data 1,1,1,1,1,1,1,1,1,1
function laddercollision(v)
OnLadder=0
for la = v to 2000 step 8
if object exist(la)
if object collision(la,1) > 0
OnLadder=1
endif
endif
next la
ENDFUNCTION OnLadder
function coincollision(v)
for co = v to 2000 step 8
if object exist(co)
if object collision(co,1) > 0
delete object co
endif
endif
next co
endfunction
function coin5collision(v)
for co5 = v to 2000 step 8
if object exist(co5)
if object collision(co5,1) > 0
delete object co5
endif
endif
next co5
endfunction
_left_wall_collision:
set cursor 0,0
left#=-1
for i=0 to numwalls-1
if object collision(walls(i),1)>0
lefttemp#=intersect object(walls(i),x#-3,y#,1,x#,y#,1)
if lefttemp#>left# then left#=lefttemp#
endif
next i
if laddertemp == 1
if left#>=0
x#=x#+left#
fallspeed# = fallspeed#+.1
jumpok=0
if fallspeed >2 then fallspeed = 2
endif
endif
if inkey$()=\" \" and jumpok=1
jumpok=0
fallspeed#=-1
endif
Return
_ground_wall_collision:
set cursor 0,0
ground#=-1
for i=0 to numwalls-1
if object collision(walls(i),1)>0
temp#=intersect object(walls(i),x#,y#-3,1,x#,y#,1)
if temp#>ground# then ground#=temp#
endif
next i
if laddertemp=1
fallspeed#=0
else
if ground#>=0
y#=y#+ground#
fallspeed#=0
jumpok=1
else
jumpok=0
fallspeed#=fallspeed#+.1
if fallspeed#>2 then fallspeed#=2
endif
endif
if inkey$()=\" \" and jumpok=1
jumpok=0
fallspeed#=-1
endif
y#=y#-fallspeed#
Return
A C.P.U is not smart at all, all it is, is a colleciton of millions of switches (albeit an extremely fast, exceptionally sophisticated collection of switches)/