def createPlayer(self): viewPort = self.viewPort images = self.images # How big the player starts off. playerStartPos = Point(viewPort.halfWidth, viewPort.halfHeight) # Sets up the movement style of the player. # playerBounds = gd.RectangleBoundary( Rectangle( Point( 0, 220 ), Point( 900, 550 ) ) ) playerBounds = gd.CollisionBoundary() moveStyle = gd.KeyMovementStyle(boundaryStyle=playerBounds) moveStyle.setMoveRate(MOVERATE) moveStyle.setBounceRates(BOUNCERATE, BOUNCEHEIGHT) leftImages = go.ImageAnimation( [images.Jimmy_Pixel_RightL, images.Jimmy_Pixel_Right_WalkL]) rightImages = go.ImageAnimation( [images.Jimmy_Pixel_RightR, images.Jimmy_Pixel_Right_WalkR]) playerImages = go.ImageCollection(left=leftImages, right=rightImages) collisionSpec = go.CollisionSpecification(width=0.38, left=0.32) return go.Player(playerStartPos, moveStyle, size=JIMSIZE, ratio=1.0, image=playerImages, name='Jimmy Pixel', collisionSpecification=collisionSpec)
def __init__(self, viewPort): # set up generic game one time set up super().__init__('Sheriff Quest', 'Sheriff Quest Icon', viewPort) # game one time setup # self.setDrawOrder( 'Player' ) self.setCursor() viewPort.loadMusic('Gun.ogg') viewPort.setCameraMovementStyle( game_dynamics.KeyMovementStyle(moveRate=Vector(20, 12)))
def __init__(self, viewPort): # Set up generic game one time set up. super().__init__('Candy Seller', 'gameiconc', viewPort) # Game one time setup. # self.setDrawOrder( 'BackGround', 'Shop', 'Arrow', 'Bush', 'Coin', 'Player', 'Monster', 'Score' ) self.setCursor() viewPort.loadMusic('Money Ping.ogg') viewPort.setCameraMovementStyle( game_dynamics.KeyMovementStyle(moveRate=Vector(20, 12)))
def __init__(self, viewPort): # Set up generic game one time set up. super().__init__('Jimmy Pixel', 'Jimmy Pixel Right', viewPort, useAlpha=True) # Game one time setup. # self.setDrawOrder( 'Border', 'BackGround', 'Digspot', 'GhostSprite', 'Sprite', 'Player', 'Fog' ) self.setCursor() self.setAllowDrag() viewPort.loadMusic('Dungeon of Pixels.mp3') viewPort.setCameraMovementStyle( gd.KeyMovementStyle(moveRate=Vector(20, 20))) viewPort.setCameraSlack(90)
def createPlayer(self): viewPort = self.viewPort images = self.images # How big the player starts off. playerStartPos = Point(viewPort.halfWidth, viewPort.halfHeight) # Sets up the movement style of the player. # playerBounds = game_dynamics.RectangleBoundary( Rectangle( Point( 0, 220 ), Point( 900, 550 ) ) ) playerBounds = game_dynamics.CollisionBoundary() moveStyle = game_dynamics.KeyMovementStyle(boundaryStyle=playerBounds) moveStyle.setMoveRate(MOVERATE) moveStyle.setBounceRates(BOUNCERATE, BOUNCEHEIGHT) playerImages = go.ImageCollection(left=images.manL, right=images.manR) return go.Player(playerStartPos, moveStyle, size=MANSIZE, ratio=1.0, image=playerImages)