BlueBot5000
Member
As i finally finish signposts for my game (here is the video i was learning from)
i was stumbled with only 1 HUGE problem some of my text hud variables move...EVERY SINGLE TIME...and it doesn't please me i tried finding the problem for 1 day and a half
maybe some variables were being shared it didn't seem like it maybe some LOCAL variables were being shared that still didn't seem like it maybe global variables were doing something!?
this problem has been driving me CRAZY some help WOULD BE VEEERRRYYY HELPFUL
objDataController (this carry's the players score and how much air they have left for underwater exploration)
CREATE EVENT
DRAW GUI
PRESS R EVENT
objText
CREATE EVENT
STEP EVENT
DRAW EVENT
DrawSetText THE FUNCTION!
i was stumbled with only 1 HUGE problem some of my text hud variables move...EVERY SINGLE TIME...and it doesn't please me i tried finding the problem for 1 day and a half
maybe some variables were being shared it didn't seem like it maybe some LOCAL variables were being shared that still didn't seem like it maybe global variables were doing something!?
this problem has been driving me CRAZY some help WOULD BE VEEERRRYYY HELPFUL
objDataController (this carry's the players score and how much air they have left for underwater exploration)
CREATE EVENT
Code:
/// @description Keep Control of Variables
draw_set_color(c_black);
draw_set_font(SCORE_FONT);
global.Score = 0;
global.HP = 100;
global.HPmax = global.HP;
healthbar_width = 248;
healthbar_height = 36;
healthbar_x = x - 77;
healthbar_y = y - 400;
Code:
/// @description Health Bar + Score
if instance_exists(entityPlayer)
{
{
draw_sprite(sprHealthBarBaraka,0,88,50);
draw_sprite_stretched(sprHealthBarBaraka,0,88,50,(global.HP/global.HPmax) * healthbar_width,healthbar_height);
draw_sprite(sprHealthBarBorder,0,88,50);
}
draw_rectangle_color(0,108,258,133,c_black,c_black,c_black,c_black,false);
draw_set_font(SCORE_FONT);
//draw_text_outlined(x, y, outline color, string color, string)
var xx,yy;
xx = 254;
yy = 150;
//Outline
draw_set_color(c_black);
draw_text(xx+1,yy+1,string(global.Score));
draw_text(xx-1,yy-1,string(global.Score));
draw_text(xx,yy+1,string(global.Score));
draw_text(xx+1,yy,string(global.Score));
draw_text(xx,yy-1,string(global.Score));
draw_text(xx-1,yy,string(global.Score));
draw_text(xx-1,yy+1,string(global.Score));
draw_text(xx+1,yy-1,string(global.Score));
//Text
draw_set_color(c_white);
draw_text(xx,yy,string(global.Score));
}
Code:
//Just Guess What This Does It's Just WWAAYYY Too Obvious
CREATE EVENT
Code:
/// @description Variables
spd = 0.25;
letters = 0;
text = "IF YOU LOOK TO YOUR LEFT YOU CAN SEE\n WATER TO YOUR FAR RIGHT YOU\n WILL FIND A SIGN!";
length = string_length(text);
text_current = "";
w = 0;
h = 0;
border = 10;
Code:
/// @description Progress Text
letters += spd;
text_current = string_copy(text,1,(letters));
draw_set_font(SIGN_FONT);
if (h == 0) h = string_height(text);
w = string_width(text_current);
//Destory When Done
if (letters >= length) && (keyboard_check_pressed(vk_up))
{
instance_destroy();
with (objCamera) follow = entityPlayer;
}
Code:
/// @description Draw Our Text And Speech Box's
var halfw = w * 0.5;
//Draw The Box
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_roundrect_ext(x-halfw-border,y-h-(border*2),x+halfw+border,y,15,15,false);
draw_sprite(sprSignMarker,0,x,y);
draw_set_alpha(1);
//Draw Text
DrawSetText(c_white,SIGN_FONT,fa_center,fa_top);
draw_text(x,y-h-border,text_current);
Code:
function DrawSetText()
{
/// @desc DrawSetText(colour,font,halign,valign)
/// @arg colour
/// @arg font
/// @arg halign
/// @arg valign
// Allows one line setup of major text drawing vars.
// Requiring all prevents silly coders from forgetting one
// And therefore creating a dumb dependency on other event calls.
// (Then wondering why their text changes later in development.)
draw_set_colour(argument0);
draw_set_font(argument1);
draw_set_halign(argument2);
draw_set_valign(argument3);
}