Skip to content

Commit

Permalink
Added animation looping system.
Browse files Browse the repository at this point in the history
  • Loading branch information
probably-nothing committed Feb 1, 2019
1 parent 7ab2867 commit 3a67e8a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Engine/Entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def __init__(self):
self.height = None
self.image = None

self.animated = False
self.animationDelay = None
self.animationCounter = 0

def isTouching(self, entity):
"""Checks if an entity is in contact with another"""
if not isinstance(entity, Entity):
Expand Down Expand Up @@ -37,6 +41,13 @@ def getImage(self, scale):

return self.image.scaled(scale)

def animationLoop(self):
if self.animationCounter == self.animationDelay:
self.image.nextImage()
self.animationCounter = 0
self.animationCounter += 1


class ActiveEntity(Entity):
"""A type of entity that allows for movement within the world."""

Expand Down

0 comments on commit 3a67e8a

Please sign in to comment.