Last active
January 3, 2016 17:59
-
-
Save ZachMassia/8499592 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Traceback (most recent call last): | |
File "/home/zach/dev/python/scripting/lab2/part1.py", line 161, in <module> | |
app.run() | |
File "/home/zach/dev/python/scripting/lab2/basic_game/app.py", line 41, in run | |
self.game.update(self.clock.get_time()) | |
File "/home/zach/dev/python/scripting/lab2/part1.py", line 36, in update | |
[m.update(dt) for m in self.marios.values()] | |
File "/home/zach/dev/python/scripting/lab2/part1.py", line 36, in <listcomp> | |
[m.update(dt) for m in self.marios.values()] | |
TypeError: Argument must be a dict with rectstyle keys. |
This file contains hidden or 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
import pygame | |
class Mario(object): | |
def __init__(self): | |
self.on_collision = lambda x: None | |
self.rect = pygame.Rect | |
self.enemies = dict() # format: { string: pygame.Rect } | |
def check_collisions(self): | |
cs = self.rect.collidedict(self.enemies) | |
if cs: | |
{self.on_collision(c) for c in cs} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment