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.

DarkBASIC Discussion / Sleep, hunger, etc.

Author
Message
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 17th Oct 2007 15:42
How do I do this? So far I have the bars they go in this pattern 100%,50%,10%,0% although they are images (like The Sims) how do I make them reduce randomly?

Thanks,
CGJ

New Website! Check it out!
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 17th Oct 2007 17:06
could you go into more detail?

how far have you got with trying to figure this out?

If you've got nowhere so far and don't know where to start, I would suggest you start looking up arrays, then decide what values you are going to store in them, then figure out how to read the values, then paste the appropriate image to the screen.

If, however, it's a coding issue, post which aspect is causing problems.

http://jamesmason01.googlepages.com/index.htm
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 17th Oct 2007 17:32
I don't know where to start. So you are saying I cannot use variables?

New Website! Check it out!
Lucifer
19
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 17th Oct 2007 17:43
in my game i begin by doing this and setting up the character and variables

and then i put this into the loop

the higher the foodsecond# is, the longer it will take the food to decrese, just check this code out..

Lord Voldemort needs no signature!
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 17th Oct 2007 18:13
So just edit your code to make into decreasing the image?

New Website! Check it out!
Lucifer
19
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 17th Oct 2007 18:25
well what i do is just print "Food: ", Food# , but i suppose it's posible to get the bars to shrink or get bigger.

try doing this, make an image wich is 100x40, color it with the preferred bar color,load it into dbc, and turn it into a sprite then paste it on the place on the screen you want it to be. then try something like this inside the loop :
i dont know if this code will work, but it's an idea you could work with...

Lord Voldemort needs no signature!
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 17th Oct 2007 19:30
Nope

New Website! Check it out!
Lucifer
19
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 18th Oct 2007 00:54
well you do realise that's " Scale sprite sprite number, food# " ?

Lord Voldemort needs no signature!
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2007 01:13
@CGJ
does this help?

I will work on a cutting example that can be hard-coded if you'd like.

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 18th Oct 2007 03:01 Edited at: 18th Oct 2007 03:03
Wow... that is really good. Any way to make it go from 100% to 50% to 0% though?

Quote: "well you do realise that's " Scale sprite sprite number, food# " ?"


Yes.

New Website! Check it out!
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2007 03:42
yes, write stretch sprite 1,100*x,100 but replace x with whatever stat you are using. I'll leave working out how to go from 100 to 50 to 0 to you
STRETCH SPRITE has an advantage over SCALE SPRITE as you can define the width and height (always a % relative to the sprite's original size).

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2007 03:51
here's an example that changes the stat randomly and smoothly moves to the new value.


Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 18th Oct 2007 04:10
You are awesome.

New Website! Check it out!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Oct 2007 17:21 Edited at: 18th Oct 2007 17:45
If you have any problems, I've attached a progress bar function.

It's quite old and doesn't use sprites though.

[Edit] I just checked the example demo in the attached zip and it's an old one with a couple of errors. Correct version below:



TDK_Man

Attachments

Login to view attachments
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2007 17:27 Edited at: 18th Oct 2007 23:24
thanks, I was bored
The "cutting" bar was more complicated than I thought so here's an example of both working at the same time.


The sprite commands seem faster than the image commands.

[edit]
I swear I did the "cutting" bar before and it was much simpler than all this grabbing from bitmaps. isn't there a way to scale a sprite without affecting the image?

Login to post a reply

Server time is: 2025-05-31 20:44:17
Your offset time is: 2025-05-31 20:44:17