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.

AppGameKit Classic Chat / How to generate a glossy health bar with code

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 08:05 Edited at: 15th May 2013 01:38
Use left/right mouse buttons to change health amount.





Here's a new version with a little animation to show chunks of the health bar cut away. Not my most modular code ever, but shows a nice example I think. MOUSE buttons to grow/shrink health bar, press SPACE to cut away a chunk.

V.2


"You're all wrong. You're all idiots." ~Fluffy Rabbit
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th May 2013 17:45
Well, being curious about the above, I opened up my v10811 AppGameKit IDE and copied the code.

First, it is missing the argb and getColor functions.

Next, as I suspected, you cannot 'return' a call to another function.

After that, it ran and is cool. But the buttons don't do anything.

Is the bar supposed to follow the mouse around?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
The Daddy
15
Years of Service
User Offline
Joined: 13th Jan 2009
Location: Essex
Posted: 14th May 2013 22:58
AL

You have made me laugh out load.....really.

You are so funny.

Where is the digital?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th May 2013 23:11 Edited at: 14th May 2013 23:13
Really?

I actually finally spotted where the bar was supposed to follow the mouse.

But I couldn't get it to change with my arrow keys.

And I had to add the two functions from Phaelax's other thread and edit one so that it stored the argb value locally and returned it before I could get it to compile without errors.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th May 2013 01:09 Edited at: 15th May 2013 01:39
Oops, I'm not sure how I didn't copy the entire snippet over. Fixed the snippet above.

Quote: "But I couldn't get it to change with my arrow keys."

It's not suppose to, I never said anything about arrow keys, use the MOUSE buttons! And yes, it is suppose to follow the mouse.

I added a new snippet above with a neat little update.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th May 2013 05:19
Quote: "use the MOUSE buttons!"

My bad. Somehow I interpreted it as using the keyboard (left/right).

Sorry.

Works great!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 12th Jul 2013 07:56
Hi Phaelax,
Can I use this code in my commercial project?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jul 2013 17:04
Yea sure. But you'd probably get better performance using images.

Login to post a reply

Server time is: 2024-05-02 21:45:45
Your offset time is: 2024-05-02 21:45:45