Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sprite animation

  • Loading branch information...
commit f24de7e372783c7ae4901501eea7631a5bae5d37 1 parent e2a70cb
@sockser sockser authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 Player.py
View
11 Player.py
@@ -64,23 +64,30 @@ def updateVector(self,x,y):
self.vector.y = self.vector.y / (sqrt((self.vector.x*self.vector.x)+(self.vector.y*self.vector.y)))
def updatePlayerPos(self,x,y):
- self.image = (self.image + 1) % 8
+ #self.image = (self.image + 1) % 8
x = int(x)
y = int(y)
if self.x + x < 1252 and self.x + x > -5:
self.x += x
self.rect = self.rect.move(x,0)
+ if(x < 0):
+ self.updatePlayerSprite(0, 8)
+ if(x > 0):
+ self.updatePlayerSprite(8, 8)
if self.y + y < 600 and self.y + y > 0:
self.y += y
self.rect = self.rect.move(0,y)
if self.y + y > 600:
self.rect = self.rect.move(0,600-self.y)
self.y = 600
+ if(self.y < 600):
+ self.updatePlayerSprite(16,1)
def updatePlayerSprite(self, framestart, totalframes):
- self.framenumber += 0.5
+ self.framenumber += 0.33
if(self.framenumber > framestart + totalframes or self.framenumber < framestart):
self.framenumber = framestart
+ print self.image
self.image = (int(self.framenumber)) % totalframes + framestart
def updateArrowPos(self):
Please sign in to comment.
Something went wrong with that request. Please try again.