Made gun scale to screen height and centre itself horizontally

Doesn't scale based on width yet though
This commit is contained in:
2025-06-16 20:57:10 +01:00
parent 06ed8a8dde
commit 68b5bc96b3

View File

@ -33,6 +33,13 @@ class Game:
self.spinning = False
self.spinInc = 0
#render variables
self.screenMid = self.size[0]/2
self.gunScale = self.size[1]/1080
self.gunMid = self.screenMid-(self.gun[0][0].size[0]*self.gunScale/2)
# TODO
# Make the gun scale based on width of screen as well as height
def fire(self):#LETS GO GAMBLING
if randint(1,6) == 6:
self.playSound(self.gunShot)
@ -80,7 +87,7 @@ class Game:
#screen code
self.surface.fill("black")
self.surface.blit(self.gun[self.spinInc][0],(0,0))#draw the gun
self.surface.blit(pygame.transform.scale_by(self.gun[self.spinInc][0],self.gunScale),(self.gunMid,0))#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
# TODO: