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 DBPro Corner / Better Healthbar in Dbpro

Author
Message
Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 17th Sep 2005 09:18
I looked about for any examples of code to make a player health bar in the forums and code base and couldn't find any so I made my own.
Being a Noob an all ive realized that there must be a better way of doing this.



If any one has some suggetions as to improving it please tell me my minds a blank

I read somewhere that the paste image command was very slow and should be avoided if possible is this true?

Feel free to use any part of this code you want for your own purposes though. Doesn't load any media
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 17th Sep 2005 13:37 Edited at: 17th Sep 2005 13:38


a simple scaled box works well enough, that looks like a lot of hard work, if the game is 2d then you could just scale a sprite instead.




the average IQ is 100...but the people that took the test where trying to look smart. most people don`t go over 50.
Area 51?, I`m more intrested in what they have in areas 1 to 50
Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 17th Sep 2005 13:49
Thanks for that. It certainly is a lot simpler than my code and would make my game which is 3D a lot more compact not to mention faster.

All the extra 2d code you see is mostly extra glitz to give it a 3d look etc.

Maybe i should have just made an animated 3d Object and lock it to the screen but im not sure what the Frame hit rate would be.

Gonna try incorporating your bit of code in my game to see how it feels. thanks for that.

Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 17th Sep 2005 14:15
I've put your code in my game and it works well. I can see why you used position object instead of lock object on its a lot faster.

Many Thanks
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 17th Sep 2005 14:42 Edited at: 17th Sep 2005 14:43
that was just an example, to place it into a game you would need to make it track the camera since the bar is just another 3d object in the world (you might want to set collision off on it as well to save confusion), heres one way of getting the bar to track the camera and appear in the correct place, the lines between the rem reposition the object where you want it.






the average IQ is 100...but the people that took the test where trying to look smart. most people don`t go over 50.
Area 51?, I`m more intrested in what they have in areas 1 to 50
Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 17th Sep 2005 15:08
Ok I will give that a try but I also have EZrotate do you think it might be a good idea to use that to reposition the object when turning?

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 18th Sep 2005 11:01
yeah, whatever works best for you, little snippets like this are just starting points, you can reforge it to make it work however you like, whatever rocks your boat



the average IQ is 100...but the people that took the test where trying to look smart. most people don`t go over 50.
Area 51?, I`m more intrested in what they have in areas 1 to 50

Login to post a reply

Server time is: 2024-11-27 16:52:14
Your offset time is: 2024-11-27 16:52:14