Implemented extra animations
This commit is contained in:
4
game.py
4
game.py
@ -48,6 +48,8 @@ class Game(gameUtils.Game):
|
|||||||
|
|
||||||
self.gun = self.createAnimObj('gun', './assets/gun-base.png')
|
self.gun = self.createAnimObj('gun', './assets/gun-base.png')
|
||||||
self.gun.addAnimation(gameUtils.AnimationHandler('spin', './assets/gun-spin.webp', 60))
|
self.gun.addAnimation(gameUtils.AnimationHandler('spin', './assets/gun-spin.webp', 60))
|
||||||
|
self.gun.addAnimation(gameUtils.AnimationHandler('blank', './assets/gun-blank.webp', 60))
|
||||||
|
self.gun.addAnimation(gameUtils.AnimationHandler('fire', './assets/gun-fire.webp', 60))
|
||||||
|
|
||||||
self.shockScale = 0 #controls shock level sent to PDO (on a scale of 0 to 1)
|
self.shockScale = 0 #controls shock level sent to PDO (on a scale of 0 to 1)
|
||||||
|
|
||||||
@ -92,12 +94,14 @@ class Game(gameUtils.Game):
|
|||||||
def fire(self):#LETS GO GAMBLING
|
def fire(self):#LETS GO GAMBLING
|
||||||
if random.randint(1,6) == 6:
|
if random.randint(1,6) == 6:
|
||||||
self.playSound(self.gunShot)
|
self.playSound(self.gunShot)
|
||||||
|
self.gun.playAnim('fire')
|
||||||
self.currentlyPlaying.punish(self.shockScale)
|
self.currentlyPlaying.punish(self.shockScale)
|
||||||
print(f'{self.currentlyPlaying.name} is fucking dead.')
|
print(f'{self.currentlyPlaying.name} is fucking dead.')
|
||||||
return 0.04
|
return 0.04
|
||||||
#remember to add shock
|
#remember to add shock
|
||||||
else:
|
else:
|
||||||
self.playSound(self.gunBlank)
|
self.playSound(self.gunBlank)
|
||||||
|
self.gun.playAnim('blank')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def onEvent(self, event):
|
def onEvent(self, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user