screen barriers?

Blitz3D Forums/Blitz3D Programming/screen barriers?

EvilMeowChi(Posted 2004) [#1]
hey, im making a birdseye space shooter, i need to make it so you cant leave the camera which i usually do like this.

if entityx(ship)> 10 then positionentity ship,10 . . .

which would work fine except that ive made it so you can dive down. So if the ships X is 10 and the Y is 0 it works, but once you go down the ship isnt at the edge of the screen anymore. What is a fast way to allow it to go to the edge of the camera?


jhocking(Posted 2004) [#2]
Well the fastest way would be to have invisible boundary geometry and setup collision detection against that. Unfortunately the builtin collision detection system doesn't work well with moving entities, and I'm guessing your game scrolls.

I suppose you can do if entityx(ship)>boundary instead of hardcoding 10, and then do a little math to change the variable boundary depending on the ship's Y position.


Nacra(Posted 2004) [#3]
How about going fully 3d and using (EntityDistance#(src_entity,dest_entity) > 10) as your position test?


Rook Zimbabwe(Posted 2004) [#4]
I was going to say something about using PickEntity to check depth but I realize that I need to learn more about that command myself.