Compare commits
3 Commits
5a62ca10d0
...
e5b8316409
| Author | SHA1 | Date | |
|---|---|---|---|
| e5b8316409 | |||
| 45123c39b6 | |||
| e932c88cc3 |
BIN
assets/gun-blank.webp
Normal file
BIN
assets/gun-blank.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 174 KiB |
BIN
assets/gun-fire.webp
Normal file
BIN
assets/gun-fire.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 MiB After Width: | Height: | Size: 259 KiB |
5
game.py
5
game.py
@ -20,7 +20,6 @@ class Game(gameUtils.Game):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# TODO: Utilise self.pm (the player manager)
|
# TODO: Utilise self.pm (the player manager)
|
||||||
# TODO: Add animations for blank firing and real firing
|
|
||||||
# TODO: Utilise the following new sounds:
|
# TODO: Utilise the following new sounds:
|
||||||
# gun-load: Should be played at the beginning of the game,
|
# gun-load: Should be played at the beginning of the game,
|
||||||
# and should have an animation accompanying it.
|
# and should have an animation accompanying it.
|
||||||
@ -48,6 +47,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 +93,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