add beta sprite rotation
This commit is contained in:
parent
5d08b887f3
commit
c2778d8b6d
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 556 B |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 580 B |
@ -20,8 +20,8 @@ clock=pygame.time.Clock()
|
||||
|
||||
# initialize two players
|
||||
|
||||
events.players.append(Player('asd', 50, 50, 5))
|
||||
events.players.append(Player('qwe', 100, 100, 5))
|
||||
events.players.append(Player('asd', 400, 100, 5))
|
||||
events.players.append(Player('qwe', 400, 500, 5))
|
||||
all_sprites.add(events.players)
|
||||
|
||||
events.running=True
|
||||
|
@ -41,21 +41,29 @@ class Player(pygame.sprite.Sprite):
|
||||
self.colliding=False
|
||||
|
||||
def moveup(self):
|
||||
if self.facing!=0:
|
||||
self.image=pygame.transform.rotate(self.image, (self.facing*90))
|
||||
self.facing=0
|
||||
self.acc.y=-1.5
|
||||
self.acc.x=0
|
||||
|
||||
def movedown(self):
|
||||
if self.facing!=2:
|
||||
self.image=pygame.transform.rotate(self.image, (self.facing*90))
|
||||
self.facing=2
|
||||
self.acc.y=1.5
|
||||
self.acc.x=0
|
||||
|
||||
def moveright(self):
|
||||
if self.facing!=1:
|
||||
self.image=pygame.transform.rotate(self.image, (self.facing*90))
|
||||
self.facing=1
|
||||
self.acc.x=1.5
|
||||
self.acc.y=0
|
||||
|
||||
def moveleft(self):
|
||||
if self.facing!=3:
|
||||
self.image=pygame.transform.rotate(self.image, (self.facing*90))
|
||||
self.facing=3
|
||||
self.acc.x=-1.5
|
||||
self.acc.y=0
|
||||
|
Loading…
Reference in New Issue
Block a user