SOLVED Flare direction follow up

JacktheLR

Member
I tried using draw_surface_ext for this but it has brought up a new problem that has yet to be addressed. The flare is not centered on my character and whenever I try to center it with draw_sprite or draw_surface_ext, the former cuts off the sprite from completely showing while the latter skews it out of position whenever I go on walls and ceilings. What can I do to fix this?

Code is
if key_b {
sprp = boost;
if (!surface_exists(flare)){flare = surface_create(124, 103);}
surface_set_target(flare);
draw_sprite(Boost, image_i, 80, 76);
surface_reset_target();
draw_surface_ext(flare,x-0,y-0,1,1,angle,c_white,1)

}
}
 

Ommn

Member
We really hope that you have attached a video or picture of the problem

try this:
GML:
if key_b {
sprp = boost;
if (!surface_exists(flare)){
flare=surface_create(124, 103);}
surface_set_target(flare);
draw_sprite(Boost, image_i, 80, 76);
surface_reset_target();
}
draw_surface_ext(flare,x-0,y-0,1,1,angle,c_white,1)
}
 

JacktheLR

Member
We really hope that you have attached a video or picture of the problem

try this:
GML:
if key_b {
sprp = boost;
if (!surface_exists(flare)){
flare=surface_create(124, 103);}
surface_set_target(flare);
draw_sprite(Boost, image_i, 80, 76);
surface_reset_target();
}
draw_surface_ext(flare,x-0,y-0,1,1,angle,c_white,1)
}
This did not work. This produced an error saying the code was trying to use a non-existing surface. When I adjust the draw_sprite value, the boost remains under my character or cut off like in the first two pictures. When I adjust the draw surface_ext, the flare gets offset when going on different surfaces like in the last two pictures.
 

Attachments

Ommn

Member
I don't understand why you don't draw sprite directly without using a surface

use draw_sprite_ext and make the angle change according to the angle of the character.

Usually the surface is used if you are going to draw a lot of sprites or a lot of geometric shapes, but in your case I think you should draw only one sprite!! So there is no need to use the surface.

Don't forget to set the offset point of the picture to center.
 

JacktheLR

Member
I don't understand why you don't draw sprite directly without using a surface

use draw_sprite_ext and make the angle change according to the angle of the character.

Usually the surface is used if you are going to draw a lot of sprites or a lot of geometric shapes, but in your case I think you should draw only one sprite!! So there is no need to use the surface.

Don't forget to set the offset point of the picture to center.
That worked! Thank you! And I am sorry about this. I'm new to GameMaker and I probably made this process more complicated than it actually was.
 
Top