S
Spongyoshi
Guest
Okay so I tried my hands on the "draw" event because I wanted a score to show up but wasn't a fan of just having it in black arial so I wanted to have custom sprites to display the score instead!
However, what I through was a normal task is more complicated than I thought! I hardly can find help online on that matter but I could find a video to assist me:
(And I could check how functions works in GM as a bonus ^^)
But sadly, it didn't worked as the sprite just looped thought it's sub-images instead of just showing my score!
If you have any better way or can find any error in my code, please let me know as soon as possible, any help is appreciated!
However, what I through was a normal task is more complicated than I thought! I hardly can find help online on that matter but I could find a video to assist me:
But sadly, it didn't worked as the sprite just looped thought it's sub-images instead of just showing my score!
If you have any better way or can find any error in my code, please let me know as soon as possible, any help is appreciated!
Code:
drawNumb(view_xview + 25, view_yview + 25, string(Mario_SkiAcrobatique.MesPoints.value), chiffres)
Code:
var _sprite, _fontLayout, _x, _y, _string, i, _offsetX, _offsetY;
_x = argument0;
_y = argument1;
_string = argument2;
_sprite = argument3;
_fontLayout = "0123456789/";
if(!variable_global_exists("_charMap"))
{
for(i = 0; i <= 255; i+=1)
global._charMap[i] = -1;
for(i = 1; i <= string_length(_fontLayout); i+=1)
global._charMap[ord(string_char_at(_fontLayout, i))] = i;
}
_offsetX = 0;
_offsetY = 0;
for(i = 1; i <= string_length(_string); i+=1)
{
var c;
c = ord(string_char_at(_string, i));
if(global.charMap[c] != -1)
draw_sprite(_sprite, global._charMap[c]-1, _x + _offsetX, _y + _offsetY);
_offsetX += sprite_get_width(_sprite);
}