Skip to content

Commit

Permalink
reynaldo attacks now a 3 bullet burst
Browse files Browse the repository at this point in the history
  • Loading branch information
will-a committed May 23, 2018
1 parent 4f011e3 commit 183cdb4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion players/Reynaldo.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import pygame, math
from players.Player import Player
from src.Cooldown import Cooldown
from src.Attack import Attack


class Reynaldo(Player):

def __init__(self, x, y, handler):
health = 100
damage = 10
damage = 20
winQuote = "Pog Champerino!!!!"
loseQuote = "I was lagging!"
name = "Reynaldo"
Expand All @@ -18,6 +19,11 @@ def __init__(self, x, y, handler):
super().__init__(health, damage, winQuote, loseQuote, name, x, y, movespeed, handler.getPlatformArray(),
handler.getAttackList(), handler, defense)

self.ranged_cooldown = Cooldown(1.5)
self.ranged_count = 0
self.ranged_active = False
self.start_tick = 0

self.special_sprite = pygame.image.load("media/Players/Reynaldo/ReynaldoSpecial.png").convert_alpha()
self.special_sprite_rect = self.special_sprite.get_rect()
self.special_active = False
Expand All @@ -30,6 +36,11 @@ def __init__(self, x, y, handler):
self.special_hit = False
self.start_direction = 0

def attack(self, screen):
print("BOOM")
if self.ranged_cooldown.isDone():
self.ranged_active = True

def special(self):
if self.special_cooldown.isDone():
self.special_active = True # A BIG OLD BOOMERANG AHRI Q THAT DOESNT DO DAMAGE ON THE WAY OUT BUT A LOTTA DAMAGE ON THE WAY BACK
Expand All @@ -46,6 +57,21 @@ def update(self, screen):

screen.blit(self.sprite, [self.rect.x, self.rect.y])

if self.ranged_cooldown.isDone() and self.ranged_active:
if self.ranged_count == 0:
self.start_tick = self.handler.getTick()
self.ranged_count += 1
print(self.handler.getTick() - self.start_tick)
if (self.handler.getTick() - self.start_tick) % 5 == 0:
self.handler.getAttackList().add(Attack(self, self.damage, self.handler))
if (self.handler.getTick() - self.start_tick) == 10:
self.ranged_cooldown.update()

if not self.ranged_cooldown.isDone():
self.ranged_cooldown.update()
self.ranged_count = 0
self.ranged_active = False

if self.special_active:
if self.special_count == 0:
self.start_pos = [self.rect.x, self.rect.y]
Expand Down
2 changes: 1 addition & 1 deletion user/preferences.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"music": true, "sfx": true}
{"music": false, "sfx": true}

0 comments on commit 183cdb4

Please sign in to comment.