Skip to content

Commit

Permalink
main
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushour0 committed Jul 22, 2021
1 parent 9051727 commit cdc327e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
3 changes: 0 additions & 3 deletions globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@

from Player import *

# Window Dimensions
WINDOW_DIMENSIONS = (700,399)
WINDOW_WIDTH,WINDOW_HEIGHT = WINDOW_DIMENSIONS
Binary file modified img/background_img.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/background_img.png
Binary file not shown.
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
# Set window name
pygame.display.set_caption("Stickman")

# Background image
background = pygame.image.load(background_img)
print(background.get_width(),background.get_height())

# Window Dimensions
WINDOW_DIMENSIONS = (background.get_width(),background.get_height())
WINDOW_WIDTH,WINDOW_HEIGHT = WINDOW_DIMENSIONS
# Create screen
flags = DOUBLEBUF
screen = pygame.display.set_mode(WINDOW_DIMENSIONS, flags, 16)

# Background image
background = pygame.image.load(background_img)
print(background.get_width(),background.get_height())

# Player declaration
player = Stickman_player(WINDOW_DIMENSIONS)
Expand Down
5 changes: 3 additions & 2 deletions src/Player.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def __init__(self,WINDOW_DIMENSIONS):

# Position of the character
self.x = WINDOW_DIMENSIONS[0]/2
self.y = WINDOW_DIMENSIONS[1]*15/16
self.y = WINDOW_DIMENSIONS[1]*7/8
self.default_y_location = self.y

# Standing image facing Left Direction
self.standing_imgL = [pygame.image.load(standing_imgL)]
Expand Down Expand Up @@ -121,7 +122,7 @@ def _jump(self):

# Movement in the vertical direction
if self._jump_frame_counter > len(self.jumping_imgsR)*(self._frames+4)/2:
self.y += self._vertical_jump_speed*2-1.5 if self.y+self._vertical_jump_speed<374.0625 else 0
self.y += self._vertical_jump_speed if self.y+self._vertical_jump_speed<self.default_y_location else 0
else:
self.y -= self._vertical_jump_speed

Expand Down

0 comments on commit cdc327e

Please sign in to comment.