Forums

Fading text button


Subscribe to Fading text button 12 posts, 6 voices

 

Jul 4, 2008 12:31am

Mongolia Mongolia 42 posts

How would i make a button with the starting text c_black then when the mouse is in the sprite it lights up to c_white, and then when the mouse leaves the sprite it goes back to black, im thniking about image_alpha?

Sapphire Game Studios

 

Jul 4, 2008 1:23am

ICE BURNER ICE BURNER 320 posts

you want to have a sprite of the normal and the highlighted button(can be the same sprite with a subimage)
www.grsites.com has a custom button maker that provides that
under mouse event mouse enter event set image_index 1
mouse leave set image_index 0
set image speed 0 at all times

The best forum ever, no question about it
http://illusionest.forumotion.com/index.htm
PS its not even mine lol

 

Jul 4, 2008 2:27am

Mongolia Mongolia 42 posts

i no how to do that, i wanted it to fade in and out

Sapphire Game Studios

 

Jul 4, 2008 9:44am

miner1666 miner1666 107 posts

if (mouse_x > x&&mouse_x < sprite_width&&mouse_y > y&&mouse_y < sprite_height&& image_alpha < 1)
{
image_alpha += 0.1
}
else
if image_alpha > 0 image_alpha -= 1

i didn't try this code so its posible it wouldn't work

><><><><><><><><><><><><><
------------------------------
><><><><><><><><><><><><><
-------------------------------
><><><><><><><><><><><><><

 

Jul 4, 2008 5:06pm

Darth Krattus Darth Kra... 531 posts

I've posted a tutorial of it here.
Hope it helps. smile

 

Jul 4, 2008 8:52pm

Nidoking Nidoking 656 posts

Miner's code is missing something very important. I'll leave what that is as an exercise to the reader.

 

Jul 5, 2008 2:15am

Mongolia Mongolia 42 posts

i have no clue whats missin', is it that it goes below negative 0 and also my mouse doesnt have to be on ti to start fading
also it fades the wrong way

Sapphire Game Studios

 

Jul 5, 2008 9:14am

miner1666 miner1666 107 posts

QuoteMiner's code is missing something very important. I'll leave what that is as an exercise to the reader.
i didn't test it so i don't know whats wrong with it.

><><><><><><><><><><><><><
------------------------------
><><><><><><><><><><><><><
-------------------------------
><><><><><><><><><><><><><

 

Jul 5, 2008 3:22pm

Mongolia Mongolia 42 posts

well i used darth's example so its working now, thanks

Sapphire Game Studios

 

Jul 6, 2008 1:00am

Darth Krattus Darth Kra... 531 posts

Quotewell i used darth's example so its working now, thanks
Glad to hear it. If you need anything else, don't hesitate to ask.

 

Jul 6, 2008 1:49pm

Nidoking Nidoking 656 posts

Hint: What does it mean for mouse_x to be less than sprite_width? Significantly, where will the mouse pointer be?

Also, when the sprite hits maximum alpha, it will start to flash due to inadequate condition logic.

 

Jul 6, 2008 3:07pm

Trollsplatterer Trollspla...
Moderator 2812 posts

if(mouse_x < x + sprite_width)
=> the mouse pointer is at the left of the RIGHT-SIDE of the object.
So if you want to check if the mouse is over the object (horizontally):
mouse_x >= x AND
mouse_x < x + sprite_width

Visit www.trollsplatterer.be for some files I made to help people out.