Merge branch 'windows'
made project run on windows, and capped framerate
This commit is contained in:
commit
fa110a5425
2 changed files with 6 additions and 2 deletions
1
build.bat
Normal file
1
build.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pyinstaller cli.py -y -n "rise to fall" --add-data="src\levels\testlevel.json;levels" --icon="src\icon.ico"
|
|
@ -18,7 +18,7 @@ class Camera(object):
|
||||||
"""
|
"""
|
||||||
This function translates the given coordinate to give a camera pan effect
|
This function translates the given coordinate to give a camera pan effect
|
||||||
"""
|
"""
|
||||||
return (pos[0]-self.x,pos[1]-self.y)
|
return (int(pos[0]-self.x),int(pos[1]-self.y))
|
||||||
|
|
||||||
def outOfBounds(self, pos):
|
def outOfBounds(self, pos):
|
||||||
"""
|
"""
|
||||||
|
@ -283,7 +283,7 @@ class Mouse(Thing):
|
||||||
"""
|
"""
|
||||||
mouse = pygame.mouse.get_pos() # get mouse position
|
mouse = pygame.mouse.get_pos() # get mouse position
|
||||||
self.setPosList(mouse) # go to mouse
|
self.setPosList(mouse) # go to mouse
|
||||||
pygame.draw.circle(self._game._screen,(0,0,0,1),self._body.position,6) # draw black circle to represent mouse
|
pygame.draw.circle(self._game._screen,(0,0,0,1),(int(self._body.position[0]),int(self._body.position[1])),6)
|
||||||
|
|
||||||
class RiseToFall(object):
|
class RiseToFall(object):
|
||||||
"""
|
"""
|
||||||
|
@ -300,6 +300,8 @@ class RiseToFall(object):
|
||||||
pygame.init()
|
pygame.init()
|
||||||
self._screen = pygame.display.set_mode(self.windowSize, pygame.RESIZABLE) # set window size and enable resizing
|
self._screen = pygame.display.set_mode(self.windowSize, pygame.RESIZABLE) # set window size and enable resizing
|
||||||
|
|
||||||
|
self.clock = pygame.time.Clock()
|
||||||
|
|
||||||
# set caption
|
# set caption
|
||||||
pygame.display.set_caption("rise to fall")
|
pygame.display.set_caption("rise to fall")
|
||||||
|
|
||||||
|
@ -372,6 +374,7 @@ class RiseToFall(object):
|
||||||
self._drawEntities() # draw entities
|
self._drawEntities() # draw entities
|
||||||
pygame.display.flip() # write to screen
|
pygame.display.flip() # write to screen
|
||||||
self._space.step(0.02) # increment simulation
|
self._space.step(0.02) # increment simulation
|
||||||
|
self.clock.tick(60)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # run game if called directly
|
if __name__ == "__main__": # run game if called directly
|
||||||
|
|
Loading…
Reference in a new issue