bounding box
Blitz3D Forums/Blitz3D Programming/bounding box
| ||
I am using camerapick with the x and y coords of the mouse. It works well now and returns the gametile selected and everything. BUT There is one small problem... If the mouse is click off of the board the program crashes because there is no entity to pick. I have tried a few creative ways to get around this but nope... I was thinking of creating invisible entitys around the gameboard... but no... that would returnm an address to the program. So I was wondering how to create a bounding box that would keep the mose between: 4 , 570 and 244 , 221 and 556 , 221 and 797 , 570 its not really a square is it? :] So you see my prob. Oh... X number is first! -Rook |
| ||
You could just do hit=cameraPick(zipzanger) if hit=0 ;skip regular code. else ;check as normal endif Unless blitz crashes no matter what if you camerapick over empty space(Which just sounds impossible to me but I don't know.) |
| ||
CameraPick is fine if there is no entity picked. You'll get a MAV if you attempt to do anything to the picked entity when no entity was picked, so code like Otacon suggests. Check if anything was picked before running your code. Depending on what you're doing of course this would probably be more useful (but amounts to the exact same thing:) hit=CameraPick(foo) If hit<>0 ;do stuff EndIf |
| ||
Jhocking and Octacon have done it good! Yeah I needed to check that my camerapick was greater than 0 again... I have that so I can change the color of the entity I picked... Thanks dudes! |