Pop Up menu?
by Robert Carroll · in Torque Game Builder · 10/18/2009 (6:30 am) · 11 replies
Im trying to make a pop up menu (NotGui) scene object. The point of it would be to show stats and objectives. Since im new to TS I don't know how to do this. What im looking for is somthing that I mount and is hidden until a key is pressed down. Right now im cheating :( use a shoots behavior to shoot the menu that follows the plyer then another shoots to shoot it down. So unprofessional :(
About the author
Stay Up all night playing PS3 ;) add me PSN: RCBASEBALL13.
#2
================================
if (!isObject(SwapImageOnClick))
{
%template = new BehaviorTemplate(SwapImageOnClick);
%template.friendlyName = "Swap Image On Click";
%template.behaviorType = "Effects";
%template.description = "Switches the image of an object when clicked";
%template.addBehaviorField(image, "The image to swap to", object, "", t2dImageMapDatablock);
%template.addBehaviorField(frame, "The frame of the image to swap to", int, 0);
}
function SwapImageOnClick::onBehaviorAdd(%this)
{
%this.owner.collisionCallback = true;
}
function SwapImageOnClick::onMouseDown(%this, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if (isObject(%this.image))
%this.owner.setImageMap(%this.image, %this.frame);
}
====================
But I can't get it to work :(
10/18/2009 (2:41 pm)
Heres My code I wrote. I================================
if (!isObject(SwapImageOnClick))
{
%template = new BehaviorTemplate(SwapImageOnClick);
%template.friendlyName = "Swap Image On Click";
%template.behaviorType = "Effects";
%template.description = "Switches the image of an object when clicked";
%template.addBehaviorField(image, "The image to swap to", object, "", t2dImageMapDatablock);
%template.addBehaviorField(frame, "The frame of the image to swap to", int, 0);
}
function SwapImageOnClick::onBehaviorAdd(%this)
{
%this.owner.collisionCallback = true;
}
function SwapImageOnClick::onMouseDown(%this, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if (isObject(%this.image))
%this.owner.setImageMap(%this.image, %this.frame);
}
====================
But I can't get it to work :(
#3
10/18/2009 (2:43 pm)
Any ways I need it to show the blank image onMouseUp so I need to add a differentline too.
#4
Just curious, but where'd you get that onMouseDown()?
All of my behavior onMouseDown's look like this:
function MyBehavior::onMouseDown(%this, %modifier, %worldPos)
{
}
theoretically %this is all you're using and it's in the same place, but?
Also, are you setting the image and frame in the editor or elsewhere?
-T
10/18/2009 (8:42 pm)
Robert,Just curious, but where'd you get that onMouseDown()?
All of my behavior onMouseDown's look like this:
function MyBehavior::onMouseDown(%this, %modifier, %worldPos)
{
}
theoretically %this is all you're using and it's in the same place, but?
Also, are you setting the image and frame in the editor or elsewhere?
-T
#5
10/18/2009 (9:11 pm)
I got the mouse down off of the onCollitionSwapImage Behavior. Im just setting it in the editor.
#6
You lost me a bit on that last post...
10/19/2009 (12:49 am)
ok... are you setting the image and frame in the editor or elsewhere? Is the .image and .frame data ok?You lost me a bit on that last post...
#7
10/19/2009 (1:08 am)
I think ther ok, you have to forgive me im a noob :). And yes I think im setting the image and frame in the editor. Im not setting it in notepad.
#8
it looks like the parameters you have in your onMouseDown callback are from the onCollision callback in one of those behaviors. Try using the ones from an onMouseDown callback.
I don't have time to go through it right now but should later on.
10/19/2009 (11:51 am)
Robert,it looks like the parameters you have in your onMouseDown callback are from the onCollision callback in one of those behaviors. Try using the ones from an onMouseDown callback.
I don't have time to go through it right now but should later on.
#9
10/19/2009 (12:00 pm)
Yah the parameters you used in your code(post#2) for mouse down are onCollision parameters I believe, not mouse ones, which you need.
#10
change "%this.owner.collisionCallback = true;"
in your onBehaviorAdd() function to this:
%this.owner.setUseMouseEvents(true);
The line you have is not needed, but that new one is.
-T
10/19/2009 (1:07 pm)
Also,change "%this.owner.collisionCallback = true;"
in your onBehaviorAdd() function to this:
%this.owner.setUseMouseEvents(true);
The line you have is not needed, but that new one is.
-T
#11
10/19/2009 (11:59 pm)
Thanks I got distracted with this Ill try it.
Torque Owner RollerJesus
Dream. Build. Repeat.
Take a crack at merging (and understanding) them and post your code back here and I'll give you a hand.