OnMouseOver??
by Tom Lenz · in Torque Game Builder · 03/17/2008 (9:24 pm) · 3 replies
I'm looking for a way to highlight a button when you mouse over the button.
I was told onMouseOver would work... but it doesn't seem to like me.
I used the same code just changed it to onMouseDown... then it works great
This leads me to believe onMouseOver is not correct.
Any help?
My Code:
This one works:
I was told onMouseOver would work... but it doesn't seem to like me.
I used the same code just changed it to onMouseDown... then it works great
This leads me to believe onMouseOver is not correct.
Any help?
My Code:
function startButton::onMouseOver()
{
startButton.setImageMap(start_HighLightImageMap);
}This one works:
function startButton::onMouseDown()
{
startButton.setImageMap(start_HighLightImageMap);
}
Milan Rancic
Here is mine code for the same stuff:
/////////////////////////////////// // Written by Milan Ranchich // // EIPIX game development // // www.eipix.com // // Contact: starcraft@sbb.co.yu // /////////////////////////////////// function button_1::onMouseEnter(%this, %modifier, %worldPosition, %clicks){ %this.setFrame(1); } function button_1::onMouseLeave(%this, %modifier, %worldPosition, %clicks){ %this.setFrame(0); }Also, i think that (if you want to use "setImageMap") you have to put "image map" as a string (with quotes).
Mine engine is little different. I use static sprite with two frames in it, so they are generally just one file with two images inside. Then, i just switch among frames only.
You can put your entire HUD in just one image with all combinations of image buttons that exist in your game, and make 64 frames (for eg.) so you generally use the same code, just change the number (frame parameter).
Happy torquing ^_^