-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CoinBrick entity and add to Level 1-1.
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from copy import copy | ||
|
||
from entities.EntityBase import EntityBase | ||
from entities.Item import Item | ||
|
||
|
||
class CoinBrick(EntityBase): | ||
def __init__(self, screen, spriteCollection, x, y, sound, dashboard, gravity=0): | ||
super(CoinBrick, self).__init__(x, y, gravity) | ||
self.screen = screen | ||
self.spriteCollection = spriteCollection | ||
self.image = self.spriteCollection.get("bricks").image | ||
self.type = "Block" | ||
self.triggered = False | ||
self.sound = sound | ||
self.dashboard = dashboard | ||
self.item = Item(spriteCollection, screen, self.rect.x, self.rect.y) | ||
|
||
def update(self, cam): | ||
if not self.alive or self.triggered: | ||
self.image = self.spriteCollection.get("empty").image | ||
self.item.spawnCoin(cam, self.sound, self.dashboard) | ||
self.screen.blit( | ||
self.spriteCollection.get("sky").image, | ||
(self.rect.x + cam.x, self.rect.y + 2), | ||
) | ||
self.screen.blit(self.image, (self.rect.x + cam.x, self.rect.y - 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,9 @@ | |
[42,5], | ||
[56,2] | ||
], | ||
"coinBrick":[ | ||
[37,9] | ||
], | ||
"coin":[ | ||
[21,8], | ||
[22,8], | ||
|