Button? zomg o rly? ya rly! :O

Blitz3D Forums/Blitz3D Beginners Area/Button? zomg o rly? ya rly! :O

Link(Posted 2008) [#1]
does anyone know how you could click on an entity,picture,sprite, etc., to do an action?
txs


GIB3D(Posted 2008) [#2]
For 2d pictures, check to see if the mouse is greater than the x and y position and less than the x+width and y+height. Then if the mouse is within those boundaries, check to see if the mouse button is hit/down.


Link(Posted 2008) [#3]
im trying to put a button into a 3d environment
unless you can make one area 2d and another 3d (which i doubt)


GIB3D(Posted 2008) [#4]
use CameraViewport to move the viewport somewhere else on the screen and put the 2d in the part where the camera is not at...


Warner(Posted 2008) [#5]



Link(Posted 2008) [#6]
hmm...i still dont understand how it works. why is it when i take out
;check if sprite is clicked
CameraPick cam, MouseX(), MouseY()
If PickedEntity() = sp Then
Text 400, 50, "sprite!", 1, 1
End If
the image still works?
i would understand if none of them worked, but the fact that the image is working and the cube isnt even though i didnt touch the cube blows me away


Link(Posted 2008) [#7]
nvm, i figured it out! thx 4 the help!


Link(Posted 2008) [#8]
...or maybe not.
i was trying to change the name cube to door, and make you click on a door to open it instead, but it wont work now (the door is made out of blitz3d)

is it sposed to do that?


Warner(Posted 2008) [#9]
Well, if I change 'cube' to 'door', it still works, so that can't be the problem:
So it would be something else.. maybe the object has children ? In that case, use this function to change the pickmode:
Function SetEntityPickMode(ent, pm)

	EntityPickMode ent, pm
	
	For i = 1 To CountChildren(ent)
		g = GetChild(ent, i)
		SetEntityPickMode g, pm
	Next
	
End Function

usage: SetEntityPickMode door, 2 instead of EntityPickMode door, 2