Erayd
Member
So I'm setting up buttons that render on the GUI layer in the bottom two corners of the screen. I set the GUI width and height to not exceed the black bars around the game screen. Basically the whole button is just a rendering of a sprite at a spot on the GUI layer which looks nice. Everything to this point has been great, here's where it gets weird and stops making sense to me.
The goal is to make another object to put in the background at about the same size and shape as the two buttons, which moves along with the buttons. Then I can use this new object in my position_meeting method to check if the user just touched it. I do this because if I were to draw the object normally then I get "laggy" buttons when I move which is just bad.
I've done this before in other games, but THIS time, just by putting in a step event in to the background object and then putting in the relocation code for the movements, causes my entire GUI layer to become distorted. Basically everything gets taller. I don't even have to put the object in the room, it doesn't even have a sprite or any draw events, but somehow by commenting out the x and y movement code, the GUI goes back to normal.
Any thoughts? I'm at a loss right now, a good nights sleep just might be the only answer to this. Also if anyone has an easier way to add buttons that look nice in screen and that can just be easily clicked, let me know, cause this was sucks.
Draw GUI Event inside of obj_GameState
Step event inside obj_Attack
The goal is to make another object to put in the background at about the same size and shape as the two buttons, which moves along with the buttons. Then I can use this new object in my position_meeting method to check if the user just touched it. I do this because if I were to draw the object normally then I get "laggy" buttons when I move which is just bad.
I've done this before in other games, but THIS time, just by putting in a step event in to the background object and then putting in the relocation code for the movements, causes my entire GUI layer to become distorted. Basically everything gets taller. I don't even have to put the object in the room, it doesn't even have a sprite or any draw events, but somehow by commenting out the x and y movement code, the GUI goes back to normal.
Any thoughts? I'm at a loss right now, a good nights sleep just might be the only answer to this. Also if anyone has an easier way to add buttons that look nice in screen and that can just be easily clicked, let me know, cause this was sucks.
Draw GUI Event inside of obj_GameState
Code:
///Draw In-Game GUI
if(state == "game"){
for(i = 0; i < obj_Player.maxHp; i++){
if(obj_Player.hp - 1 >= i) draw_sprite_ext(spr_HPFull, 0, 20 + i*105, 10, 1, 1, 0, c_white, 1);
else draw_sprite_ext(spr_HPEmp, 0, 20 + i*105, 10, 1, 1, 0, c_white, 1);
}
draw_sprite_ext(spr_Attack, 0, 0, display_get_gui_height() - 300, 1.5, 1.5, 0, c_white, 1);
draw_sprite_ext(spr_Attack, 0, display_get_gui_width(), display_get_gui_height() - 300, -1.5, 1.5, 0, c_white, 1);
}
Step event inside obj_Attack
Code:
///Movement
if(left){
x = view_xview;
y = view_yview;
}
if(right){
x = view_xview;
y = view_yview;
}
Last edited: