Hi, I'm quite new to Dark Basic Pro, despite that I've been registerd on this forum for quite a while now.
Anyway, I'm working on a small FPS game and I'm already having slight problems. The problem is with the collisions.
Here is the code I use:
for i=2 to 4
if object collision(i,1) and _camy < object position y(i)+object size y(i)
_camcol = 1
_camjump = 0
position camera _camxold,_camyold,_camzold
endif
if object collision(i,1) and _camy > object position y(i)+object size y(i) and _camy < object position y(i)+object size y(i)+2
_camcol = 0
_camjump = 0
_camy = _camy+object position y(i)+object size y(i)
position camera _camx,_camy+_camyview,_camz
position object 1,_camx,_camy+_camyview,_camz
endif
if not object collision(i,1)
_camcol = 0
position object 1,_camx,_camy+_camyview,_camz
position camera _camx,_camy+_camyview,_camz
endif
next i
It checks for collisions between the camera boundry and the world objects. Problem is that it will only collide with the last object and despite my efforts on making a code so you can walk on them, you can't. You just get stuck and you need to jump to get out of it. Although this only happens for the last object, it works for the two others. But then, you won't get elevated as much as you should. :/
Does anyone see what I've done wrong? If that is the case, could you help me?
Any help would be great!
EDIT: I found the great beginners FPS tutorial and I learnt a better FPS collisions system. I'll use that one instead of this one. But if someone still wants to solve his, then go ahead.