-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
307 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset version="1.5" tiledversion="1.6.0" name="IceTileset" tilewidth="16" tileheight="16" tilecount="720" columns="40"> | ||
<image source="IceTileset.png" trans="000000" width="640" height="288"/> | ||
</tileset> |
File renamed without changes
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset version="1.5" tiledversion="1.6.0" name="RPG Nature Tileset Autumn" tilewidth="16" tileheight="16" tilecount="540" columns="30"> | ||
<image source="RPG Nature Tileset Autumn.png" trans="000000" width="480" height="288"/> | ||
</tileset> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset version="1.5" tiledversion="1.6.0" name="RPG Nature Tileset" tilewidth="16" tileheight="16" tilecount="720" columns="40"> | ||
<image source="RPG Nature Tileset.png" trans="000000" width="641" height="288"/> | ||
</tileset> |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pygame | ||
|
||
|
||
class Player(pygame.sprite.Sprite): | ||
def __init__(self, x, y): | ||
super().__init__() | ||
self.sprite_sheet = pygame.image.load("Assets/Player.png") | ||
self.image = self.get_image(0, 0) | ||
self.rect = self.image.get_rect() | ||
self.position = [x, y] | ||
self.speed = 2 | ||
self.images = { | ||
'down': self.get_image(0, 0), | ||
'up': self.get_image(0, 96), | ||
'left': self.get_image(0, 32), | ||
'right': self.get_image(0, 64) | ||
} | ||
|
||
def update(self): | ||
self.rect.topleft = self.position | ||
|
||
def get_image(self, x, y): | ||
image = pygame.Surface([32, 32]) | ||
image.blit(self.sprite_sheet, (0, 0), (x, y, 32, 32)) | ||
image.set_colorkey([0, 0, 0]) | ||
return image | ||
|
||
def change_image(self, name): | ||
self.image = self.images[name] | ||
|
||
def move_up(self): | ||
self.position[1] -= self.speed | ||
|
||
def move_down(self): | ||
self.position[1] += self.speed | ||
|
||
def move_left(self): | ||
self.position[0] -= self.speed | ||
|
||
def move_right(self): | ||
self.position[0] += self.speed |