4 Replies - 607 Views - Last Post: 05 June 2014 - 02:14 PM Rate Topic: -----

#1 dexter1088  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-May 14

Java Eclipse Health Bar

Posted 31 May 2014 - 02:32 AM

Hi there!

I'm programming a game in Eclipse using Java for Android.
I was wondering if anyone had a good example of a Health bar using Images.
All I can find is people using the progress bar, but i feel that's unprofessional looking.

My goal is to layer 2 images. 1 being the frame of the health bar, 1 being the value of the health bar.
I figured it would be something like moving the value health bar image few pixels over depending on the variable of health.

any direction on this would be much appreciated thank you!

Is This A Good Question/Topic? 0
  • +

Replies To: Java Eclipse Health Bar

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1363
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: Java Eclipse Health Bar

Posted 31 May 2014 - 03:52 AM

Using a ton of images for each percentage is a really bad way of going about things. It's really inefficient and a bit of waste of time to be honest. The reason all you can find is progress bar examples is because that is the way you should do it. It's a built in control for this very purpose. Sounds like you just need to style it.
Was This Post Helpful? 0
  • +
  • -

#3 farrell2k  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 865
  • View blog
  • Posts: 2,657
  • Joined: 29-July 11

Re: Java Eclipse Health Bar

Posted 31 May 2014 - 08:39 AM

Here

Draw the background image of the health bar, draw the foreground image over it, and when you take damage, resize the foreground image on the x axis appropriately.

This post has been edited by farrell2k: 31 May 2014 - 08:43 AM

Was This Post Helpful? 0
  • +
  • -

#4 dexter1088  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-May 14

Re: Java Eclipse Health Bar

Posted 05 June 2014 - 02:05 PM

Hi there!

I have a game I'm working on but having a issue with one thing. I have 2 variables a "current number" and a "target number" in the game. I need someone to write me a sample code in eclipse that will make one image appear at the target number value, like a horizontal line. And a second image of a bar that moves up as the current number counts up. That's it, simple as that. You can use solid color graphics I'll replace them later. The point of this is to get a bar to fill up 1 to 200 that is vertical. And show the target number in that bar that will be random 1 to 200.

Thank you
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,293
  • Joined: 12-June 08

Re: Java Eclipse Health Bar

Posted 05 June 2014 - 02:14 PM

Merging duplicate topics.


Quote

. I need someone to write me a sample code in eclipse that will

A gentle reminder of the rules regarding asking for folks to do your work.


Let's see what you have so far..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1