def update( delta ): global scrollX global scrollY PC.markDirty() scrollX += (rightDown - leftDown) * 2 scrollY += (downDown - upDown) * 2 map.update(delta, scrollX, scrollY)
def draw(): # clear the screen PC.setColour(255, 255, 255, 255) PC.fillRect(0, 0, 800, 600) # draw the player player.draw() # draw the things for t in things: t.draw()
def update(delta): # Tell the engine that we need to call the draw function PC.markDirty() # update the player player.update(delta) # update the things for t in things: t.update(delta)
def draw(): # clear the screen PC.setColour( 255, 255, 255, 255 ) PC.fillRect( 0, 0, 800, 600 ) # draw the player player.draw() # draw the things for t in things: t.draw()
def update( delta ): # Tell the engine that we need to call the draw function PC.markDirty() # update the player player.update( delta ) # update the things for t in things: t.update( delta )
def draw(self): if self.definition.has_key("image"): print "image tiles not yet supported" elif self.definition.has_key("color"): PC.setColour( TileColors[self.definition["color"]]["red"], TileColors[self.definition["color"]]["green"], TileColors[self.definition["color"]]["blue"], 255, ) PC.fillRect(self.x, self.y, self.s, self.s) else: print "tile must have color or image attribute"
def draw(): # set the game font PC.setFont(gameFont) # make a white screen to initialize the framebuffer PC.setColour(255, 255, 255, 255) PC.fillRect(0, 0, screenWidth, screenHeight); # draw the player player.draw() # display the player's angle for debugging purposes PC.setColour(0, 0, 0, 255) PC.drawString(str(player.angle), 5, 25)
def draw(self): # to make this a little more interesting we'll tint it and spin it around PC.setColourize(1) # enable tinting PC.setColour(255, 45, 45, 127) # tint red and semi transparent PC.drawImageRotF(self.image, self.x - self.width * 0.5, self.y - self.height * 0.5, self.a) # draw rotated image PC.setColourize(0) # disable tinting
def update( delta ): PC.markDirty()
def draw(self): # call the draw function. This version takes floating point arguments so the object moves smoothly, rather than jumping one pixel at a time # we offset by the width and the height so that the image is drawn with self.x and self.y at its middle. PC.drawImageF(self.image, self.x - self.width * 0.5, self.y - self.height * 0.5)
def update(delta): PC.markDirty()
def update( delta ): PC.markDirty() player.update(delta)
def draw(self): PC.drawImageRotF(self.image, self.x - self.width * 0.5, self.y - self.height * 0.5,self.angle - math.pi / 2)
def draw( self ): # to make this a little more interesting we'll tint it and spin it around PC.setColourize( 1 ) # enable tinting PC.setColour( 255, 45, 45, 127 ) # tint red and semi transparent PC.drawImageRotF( self.image, self.x - self.width * 0.5, self.y - self.height * 0.5, self.a ) # draw rotated image PC.setColourize( 0 ) # disable tinting
def draw( self ): # call the draw function. This version takes floating point arguments so the object moves smoothly, rather than jumping one pixel at a time # we offset by the width and the height so that the image is drawn with self.x and self.y at its middle. PC.drawImageF( self.image, self.x - self.width * 0.5, self.y - self.height * 0.5 )
def draw(): PC.setColour(255, 255, 255, 255) PC.fillRect(0, 0, 800, 600) map.draw()