F
Forestherd
Guest
Hello!
I am making a platforming game that has a hook. The games sprites are all enlarged twofold, to make movement more fluid. This however means that if i use any draw function like draw_line, the line will not be pixelated like the rest of the game, which looks very out of place.
To combat this, I tried to make a script that draws the line on a surface 2 times smaller than the game itself, and then strech it out over the actual game, thus making thel ine pixelated. It worked fine on my other computer, but when I launch the project on another computer, it almost seems like the game never deletes the stuff it drew in the previous step.
Here is what it looks visualy:
Also, here is the script for drawing the pixelated line. The 4 first arguments define where to draw the line and the last one defines the scale - how many times larger the pixels in game are:
Also, as a added question I wanted to know - how fast are surfaces? Is it even practical to achive these pixelated lines by creating and deleting a surface every step that I want this line draw?
Thank you for taking the time to read through my problem!
I am making a platforming game that has a hook. The games sprites are all enlarged twofold, to make movement more fluid. This however means that if i use any draw function like draw_line, the line will not be pixelated like the rest of the game, which looks very out of place.
To combat this, I tried to make a script that draws the line on a surface 2 times smaller than the game itself, and then strech it out over the actual game, thus making thel ine pixelated. It worked fine on my other computer, but when I launch the project on another computer, it almost seems like the game never deletes the stuff it drew in the previous step.
Here is what it looks visualy:
Also, here is the script for drawing the pixelated line. The 4 first arguments define where to draw the line and the last one defines the scale - how many times larger the pixels in game are:
Code:
///draw_line_pix(x1,y1,x2,y2,scale);
var scale = argument4 //How big the pixels are in the game
var x1 = round(argument0/scale)*scale
var y1 = round(argument1/scale)*scale
var x2 = round(argument2/scale)*scale
var y2 = round(argument3/scale)*scale
var temp_surf = surface_create(room_width/scale,room_height/scale)
surface_set_target(temp_surf)
draw_line(x1/scale,y1/scale,x2/scale,y2/scale)
surface_reset_target()
draw_surface_stretched(temp_surf,0,0,room_width,room_height)
surface_free(temp_surf)
Thank you for taking the time to read through my problem!
Last edited by a moderator: