Skip to content

Instantly share code, notes, and snippets.

@Exodus111
Last active August 29, 2015 13:56
Show Gist options
  • Save Exodus111/8931537 to your computer and use it in GitHub Desktop.
Save Exodus111/8931537 to your computer and use it in GitHub Desktop.
def move_2(self):
if self.arrows[0]: #Up
self.movement(self.dir.y, -self.speed, "Up")
if self.arrows[1]: #Left
self.movement(self.dir.x, -self.speed, "Left")
if self.arrows[2]: #Down
self.movement(self.dir.y, self.speed, "Down")
if self.arrows[3]: #Right
self.movement(self.dir.x, self.speed, "Right")
def movement(self, coord, speed, direction):
coord = speed
self.pos += self.dir
self.rect.center = self.pos.inttup()
self.collision.player_collision(self, direction)
coord = 0
def move_1(self):
if self.arrows[0]: #Up
self.dir.y = -self.speed
self.pos += self.dir
self.rect.center = self.pos.inttup()
self.collision.player_collision(self, "Up")
self.dir.y = 0
if self.arrows[1]: #Left
self.dir.x = -self.speed
self.pos += self.dir
self.rect.center = self.pos.inttup()
self.collision.player_collision(self, "Left")
self.dir.x = 0
if self.arrows[2]: #Down
self.dir.y = self.speed
self.pos += self.dir
self.rect.center = self.pos.inttup()
self.collision.player_collision(self, "Down")
self.dir.y = 0
if self.arrows[3]: #Right
self.dir.x = self.speed
self.pos += self.dir
self.rect.center = self.pos.inttup()
self.collision.player_collision(self, "Right")
self.dir.x = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment