Made gun scale and center on vertical axis now, made a variable gun width and height once near start so we don't need to keep retyping the same 5 mile long bullshit
This commit is contained in:
19
__init__.py
19
__init__.py
@ -48,11 +48,18 @@ class Game:
|
|||||||
self.spinInc = 0
|
self.spinInc = 0
|
||||||
|
|
||||||
#render variables
|
#render variables
|
||||||
self.screenMid = self.size[0]/2
|
self.gunw=self.gun[0][0].size[0] #calculates width of gun anim
|
||||||
self.gunScale = self.size[1]/1080
|
self.gunh=self.gun[0][0].size[1] #calculates height of gun anim
|
||||||
self.gunMid = self.screenMid-(self.gun[0][0].size[0]*self.gunScale/2)
|
#NOTE: Brosef, istg you better not make the gun webm
|
||||||
# TODO
|
# change sizes mid file, or so help me
|
||||||
# Make the gun scale based on width of screen as well as height
|
|
||||||
|
self.screenMidx = self.size[0]/2 #calculates horizontal midpoint of screen
|
||||||
|
self.screenMidy = self.size[1]/2 #calculates verticle midpoint of screen
|
||||||
|
|
||||||
|
self.gunScale = min(self.size[1]/self.gunh,self.size[0]/self.gunw) #calculates how to scale the gun so that it stays on the screen
|
||||||
|
|
||||||
|
self.gunMidx = self.screenMidx-(self.gunw*self.gunScale/2) #gun midpoint on the x axis
|
||||||
|
self.gunMidy = self.screenMidy-(self.gunh*self.gunScale/2) #gun midpoint on the y axis
|
||||||
|
|
||||||
def fire(self):#LETS GO GAMBLING
|
def fire(self):#LETS GO GAMBLING
|
||||||
if randint(1,6) == 6:
|
if randint(1,6) == 6:
|
||||||
@ -99,7 +106,7 @@ class Game:
|
|||||||
|
|
||||||
#screen code
|
#screen code
|
||||||
self.surface.fill("black")
|
self.surface.fill("black")
|
||||||
self.surface.blit(pygame.transform.scale_by(self.gun[self.spinInc][0],self.gunScale),(self.gunMid,0))#draw the gun
|
self.surface.blit(pygame.transform.scale_by(self.gun[self.spinInc][0],self.gunScale),(self.gunMidx,self.gunMidy))#draw the gun
|
||||||
#screen.blit(pygame.transform.scale_by(MainSurface,1),(0,yOffset))#renders the main surface to the screen, while also scaling it for the required display resolution
|
#screen.blit(pygame.transform.scale_by(MainSurface,1),(0,yOffset))#renders the main surface to the screen, while also scaling it for the required display resolution
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
|
|||||||
Reference in New Issue
Block a user