Is there a way in blitz3d to make something pickable with the mouse? Say I make a tic tac toe game for instance.... Is there a way to click the square with your mouse button and the square knows it was clicked on?
3d question regarding interfaces
Blitz3D Forums/Blitz3D Beginners Area/3d question regarding interfaces is that with the blitz gui or is that blitz3d?
If you're doing this in 3d then all you need to do is set all of your entities you to be able to pick by using EntityPickMode() and then use CameraPick() to find out which was picked. Here's an example if you didnt get that:
Or if you're doing it in 2d, then all you need to do is use the RectsOverlap() command to see if the mouse is overlapping your object.
Graphics3D 640,480,0,2 SetBuffer BackBuffer() Camera=CreateCamera() PositionEntity Camera,0,0,-6 Cube1=CreateCube() EntityColor Cube1,255,0,0 EntityPickMode Cube1,2 PositionEntity Cube1,-3,0,0 Cube2=CreateCube() EntityColor Cube2,0,255,0 EntityPickMode Cube2,2 PositionEntity Cube2,0,0,0 Cube3=CreateCube() EntityColor Cube3,0,0,255 EntityPickMode Cube3,2 PositionEntity Cube3,3,0,0 Light=CreateLight() TurnEntity Light,30,50,0 While Not KeyDown(1) Cls If MouseHit(1) Select CameraPick(Camera,MouseX(),MouseY()) Case Cube1 EntityColor Cube1,255,255,255 EntityColor Cube2,0,255,0 EntityColor Cube3,0,0,255 Case Cube2 EntityColor Cube2,255,255,255 EntityColor Cube1,255,0,0 EntityColor Cube3,0,0,255 Case Cube3 EntityColor Cube3,255,255,255 EntityColor Cube1,255,0,0 EntityColor Cube2,0,255,0 Default EntityColor Cube3,0,0,255 EntityColor Cube1,255,0,0 EntityColor Cube2,0,255,0 End Select EndIf UpdateWorld RenderWorld Flip Wend
Or if you're doing it in 2d, then all you need to do is use the RectsOverlap() command to see if the mouse is overlapping your object.
Exactly what I was looking for. Thank you!