Well since i tend to frequent this forum a little too much, i thought I might condence two posts into one. Unless a moderator feels that I need to split them.
Question 1:
I'm using alot of code to simply draw rotated rectangles. Would it be faster to draw rotated pixmaps? I'm trying to challange myself to make a game without using extenal graphics.
I was thinking of making an image from scratch and saving it to a pixmap and rotating it for the shot graphics. I suppose I might also use a drawrect command with rotation taken into account. If you have played Gun Ranger X, then you know that there can be many shots onscreen at once. I'm looking for small improvments here and there, I noticed that my draw rect command it quite time consuming.
here is the code:
Question 2:
In my game you set the color selection. It uses three colors each made of RGB components.
the vars are:
global red_1#
global green_1#
global blue_1#
global red_2#
global green_2#
global blue_2#
global red_3#
global green_3#
global blue_3#
Basicaly, I need to save these to an external file so the player can keep their palette. No encryption is necessary. I need two functions i guess, one to update and save the file, and one to load and set the values from the file.
I hope someone can help me here. Thanks in advance.
Question 1:
I'm using alot of code to simply draw rotated rectangles. Would it be faster to draw rotated pixmaps? I'm trying to challange myself to make a game without using extenal graphics.
I was thinking of making an image from scratch and saving it to a pixmap and rotating it for the shot graphics. I suppose I might also use a drawrect command with rotation taken into account. If you have played Gun Ranger X, then you know that there can be many shots onscreen at once. I'm looking for small improvments here and there, I noticed that my draw rect command it quite time consuming.
here is the code:
Function draw_rect_filled(x#,y#,direction#,length#,width#) Local x1#=(x+Cos(direction)*width/2)-Cos(direction+90)*length/2 Local y1#=(y+Sin(direction)*width/2)-Sin(direction+90)*length/2 Local x2#=(x+Cos(direction)*width/2)+Cos(direction+90)*length/2 Local y2#=(y+Sin(direction)*width/2)+Sin(direction+90)*length/2 Local x3#=(x+Cos(direction)*-width/2)-Cos(direction+90)*length/2 Local y3#=(y+Sin(direction)*-width/2)-Sin(direction+90)*length/2 Local x4#=(x+Cos(direction)*-width/2)+Cos(direction+90)*length/2 Local y4#=(y+Sin(direction)*-width/2)+Sin(direction+90)*length/2 Local temp_array#[]=[x1,y1,x2,y2,x4,y4,x3,y3] DrawPoly(temp_array) End Function
Question 2:
In my game you set the color selection. It uses three colors each made of RGB components.
the vars are:
global red_1#
global green_1#
global blue_1#
global red_2#
global green_2#
global blue_2#
global red_3#
global green_3#
global blue_3#
Basicaly, I need to save these to an external file so the player can keep their palette. No encryption is necessary. I need two functions i guess, one to update and save the file, and one to load and set the values from the file.
I hope someone can help me here. Thanks in advance.