Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Managing one image used multiple times

Author
Message
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Jun 2016 01:57 Edited at: 1st Jun 2016 02:10
I am creating a lot of buttons. They all have unique images but they also all have an translucent overlay image to give them a bevel (For both the UP and DOWN state)
What is the best way to implement that. Do i have to have a unique sprite for each images UP and DOWN state?
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 1st Jun 2016 04:12
Well, it is what I do, having buttons with two (or more) frames. For a simple button, frame 1 is at rest, frame 2 is when hovered over and frame 3 is when clicked. If wanting animated button, then range a-b is at rest, c-d when hovering and e-f when pressed.

Though I suppose, since you're re-using a translucent image to signify hover - you could put this into a sprite that is overlayed over a button whenever the pointer is within the area of a button. So every time you hover over a button, you move the translucent sprite over it (by giving it the same coordinates as the button in question) and set it to visible. And when the pointer is outside the button again, you simply hide the translucent sprite, and have it ready for getting new coordinates and being visible again.
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Jun 2016 07:02
sounds good! thanks for the help

Login to post a reply

Server time is: 2024-11-21 20:41:07
Your offset time is: 2024-11-21 20:41:07