function checkladder()
REM find out if player is next to a ladder
collCount = CountCollisionsPRO( cam_obj )
found=0
for t=1 to collCount ` go through each collision
var = CollisionHitType( cam_obj, t )
if var = TYPE_LADDERS then found=1
var = CollisionHitObj( cam_obj, t )
if var = ladders then found=1
next t
endfunction found
neither collisionhittype nor collisionhitobj will work. when i run the line is highlighted yellow on BlueIDE and it exits right after the program starts. is it because i'm using v. 2.01? the command is in the 2.01 help documentation though
edit...the documentation is wrong. i looked at the NGC Include file and it is collisionobjhit not collisionhitobj
edit... NGC wasnt acting nciely when i told the camera object to collide with both the level and the ladders. and even though i told it not to have any collision response with the ladders, it kept colliding (without sliding collision) with teh ladders. so i am just using intersectobject so if you are facing (or facing directly away from) the ladder, and you are going into it, you go up if facing up, down of facing down. if you arent pressing into it, you just stay there, so you can hang out on the ladder. unfortunately if you turn to your side you start to fall, i only made intersect object rays frontwards and backwards
here is the code
REM climb up ladders
ladderfront# = intersect object(ladders, cx#, cy#, cz#, newxvalue(cx#,ca#,4.0), cy#, newzvalue(cz#,ca#,4.0))
ladderback# = intersect object(ladders, cx#, cy#, cz#, newxvalue(cx#,wrapvalue(ca#-180),4.0), cy#, newzvalue(cz#,wrapvalue(ca#-180),4.0))
`go updown ladder
if ladderfront#<2.2 and ladderfront#>0.0 `if running into ladder
if cax#<360.0 and cax#>270.0 `if pointing forward
fall#=-0.5
endif
if cax#>0.0 and cax#<90.0 `if pointing downward
fall#=0.5
endif
endif
`stay at ladder
if ladderfront#>2.2
fall#=0.0
endif
`go updown ladder backwards
if ladderback#<2.4 and ladderback#>0.0 `if running into ladder
if cax#<360.0 and cax#>270.0 `if pointing forward
fall#=0.5
endif
if cax#>0.0 and cax#<90.0 `if pointing backward
fall#=-0.5
endif
endif
`stay at ladder backwards
if ladderback#>2.4
fall#=0.0
endif
the fall# variable is used for other things like jumping, accelerated falling, etc. being on the ladder overrides those since it uses the fall# variable after the other things use it