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 / wondering if anyone could help me on health

Author
Message
Fa1con
17
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 21st Aug 2007 07:57
i was just wondering how i could get a health bar to work.

right now i have my sprite then when i hit something itll resize the sprite but i can only do it once

this is what i hav so far:
[/code]IF SPRITE COLLISION(1,0)
SIZE SPRITE 24, 60, 20

ENDIF

[code]


if that is completely wrong or if anyone has any idea how to do it any help would be great.

that is probably completely wrong or am i on the right track?

btw SPRITE 24 is my health bar
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 22nd Aug 2007 03:07
Isn't that decreasing the size by 5 pixels rather than 5 percent??
To decrease it by 5%, you would have to use:

STRETCH SPRITE 24, SPRITE SCALE X(24) - (SPRITE SCALE X(24) / 20 ), SPRITE SCALE Y(24) - (SPRITE SCALE Y(24) / 20)

However, if you reduce it by 5% each frame, you'll never reach zero. So you're method was right for what he's trying to do. haha. sorry for being my nit-picky self

--This is where my sig would be if I had the energy to make one...--
Fa1con
17
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 22nd Aug 2007 06:51
yes that would work but how would i get it to zero and die?
Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 22nd Aug 2007 15:32


Untested code. made at work in my dinner break but hopefully even if it doesn't work it should give you an idea.

'Ooh 'eck chief'...'crumbs'
Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 23rd Aug 2007 21:53
So has that solved your problem?

'Ooh 'eck chief'...'crumbs'
Fa1con
17
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 24th Aug 2007 02:22
yes thank you it gave me a great idea how to make it work
Aralox
17
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 29th Aug 2007 10:05 Edited at: 30th Aug 2007 09:40
you need to put a
Quote: "
at the end of it,"
or just select your code and click the code button


3rd edit : bah you know what i mean

Your signature has been erased by a mod

Login to post a reply

Server time is: 2024-09-27 05:15:43
Your offset time is: 2024-09-27 05:15:43