N
NodziGames
Guest
So I'm making a CCG, and instead of putting the name on a card, I use draw_text_transformed so that I don't have to create a separate sprite for each one. It also works with scaling, so that I can resize the card without problems. This is my current code: (All in the draw event)
//Draws The Card, which consists of 3 sprites, spr_base is the bottom, spr_face is the character on the card, and spr_overlay is the rarity indicator. Scale is 1 at this stage
draw_sprite_ext(spr_base, 0, x, y, scale, scale, angle, c_white, 1);
draw_sprite_ext(spr_face, 0, x, y, scale, scale, angle, c_white, 1);
draw_sprite_ext(spr_overlay, 0, x, y, scale, scale, angle, c_white, 1);
//Draw Name
draw_set_font(fnt_main);
draw_set_color(c_black);
draw_set_halign(fa_right)
draw_text_transformed(x + (300 * scale) - (27 * scale), y - (400 * scale) + (28 * scale), name, scale, scale, angle);
draw_set_color(c_white);
draw_text_transformed(x + (300 * scale) - (27 * scale) + 2, y - (400 * scale) + (26 * scale), name, scale, scale, angle);
The sprite is 600 x 800 in size, so the 300*scale moves the point to the right since the origin of the card sprite is in the center. the 27 * scale is just the offset so that it's not printed completely on the side.
The attached images gives you an idea with what I'm struggling with.
I'd greatly appreciate any maths expert to help me out! As a matter of fact, whoever can solve this for me gets 5 free Steam Keys for "Gal-X-E"
Good day!
//Draws The Card, which consists of 3 sprites, spr_base is the bottom, spr_face is the character on the card, and spr_overlay is the rarity indicator. Scale is 1 at this stage
draw_sprite_ext(spr_base, 0, x, y, scale, scale, angle, c_white, 1);
draw_sprite_ext(spr_face, 0, x, y, scale, scale, angle, c_white, 1);
draw_sprite_ext(spr_overlay, 0, x, y, scale, scale, angle, c_white, 1);
//Draw Name
draw_set_font(fnt_main);
draw_set_color(c_black);
draw_set_halign(fa_right)
draw_text_transformed(x + (300 * scale) - (27 * scale), y - (400 * scale) + (28 * scale), name, scale, scale, angle);
draw_set_color(c_white);
draw_text_transformed(x + (300 * scale) - (27 * scale) + 2, y - (400 * scale) + (26 * scale), name, scale, scale, angle);
The sprite is 600 x 800 in size, so the 300*scale moves the point to the right since the origin of the card sprite is in the center. the 27 * scale is just the offset so that it's not printed completely on the side.
The attached images gives you an idea with what I'm struggling with.
I'd greatly appreciate any maths expert to help me out! As a matter of fact, whoever can solve this for me gets 5 free Steam Keys for "Gal-X-E"
Good day!