|
Post by Xenith on Apr 30, 2004 19:31:20 GMT -5
Okay i've got some experience with making a health bar and also using hearts ( like zelda ) but i need a little help in using numbers. I'm gonna set them on the upper part of the screen( i already know how ) but i can't remember how to divide a 999 number into 1s, 10s, and 100s place i remember doing it in rm2k but i heard there were different ways in GM.
|
|
|
Post by hamalnamal on May 1, 2004 18:14:23 GMT -5
why not justr make it 1000 and make your like easyer?
|
|
|
Post by Xenith on May 1, 2004 20:09:05 GMT -5
what's the difference? my question is how to get my health into numbers it has nothing to do with the amount of health is maximum
|
|
|
Post by IsmAvatar on May 1, 2004 22:35:48 GMT -5
I'd turn it into a string, and pop out each number, optionally turning them back into integers.
Just curious, why would you want to break health up into each digit?
|
|
|
Post by Xenith on May 2, 2004 0:10:22 GMT -5
well actually i came here wanting to know if there was a different way of doing it. you see the program i used (rm2k) was not very flexible so i wasn't sure if this is how you do it on game maker. It's gonna be using sprites to show the pictures of the numbers too.
|
|
|
Post by IsmAvatar on May 2, 2004 0:31:45 GMT -5
well, just convert the number into a string, and then loop through all the characters in the string.
|
|
|
Post by Xenith on May 2, 2004 0:51:30 GMT -5
how would i be able to show it in numbers though?
|
|
|
Post by Antman on May 2, 2004 6:48:24 GMT -5
you could have all the numbers in the same sprite from 0-9, then have a script like this: /* argument0 : the number argument1 : the sprite used argument2 : x position argument3 : y position */ var number; for (iii = 0; iii < string_length(argument0); iii += 1) { number = real(string_copy(string(argument0), iii + 1, 1)); draw_sprite(argument1, number, argument2 + (1+sprite_get_width(argument1)) * iii, argument3); }
It reads each individual number and then draws the image_single from the sprite you select. Knowing my luck it'l have a bug in it somewhere
|
|
|
Post by Xenith on May 2, 2004 13:36:42 GMT -5
i've often thought about that but how would i put a number into a string?
|
|
|
Post by Antman on May 2, 2004 16:18:08 GMT -5
Easy:
string(number)
E.g. string(245)
The code above accounts for numbers as well as strings (at least it does now ;D)
|
|