python Programming Glossary: self.rect
Add scrolling to a platformer in pygame http://stackoverflow.com/questions/14354171/add-scrolling-to-a-platformer-in-pygame 32 32 self.image.fill Color #0000FF self.image.convert self.rect Rect x y 32 32 def update self up down left right running platforms.. not left or right self.xvel 0 # increment in x direction self.rect.left self.xvel # do x axis collisions self.collide self.xvel.. self.xvel 0 platforms # increment in y direction self.rect.top self.yvel # assuming we're in the air self.onGround False..
pygame - KEYDOWN event - line not updating position http://stackoverflow.com/questions/14580935/pygame-keydown-event-line-not-updating-position self pos size color xmax xmin self.pos pos self.size size self.rect pygame.Rect pos size self.health 100 self.color color self.angle.. self surface global C pygame.draw.rect surface self.color self.rect c angle self.rect.midleft self.rect.center 20 radians self.angle.. C pygame.draw.rect surface self.color self.rect c angle self.rect.midleft self.rect.center 20 radians self.angle if c C and c..
Render anti-aliased text on transparent surface in pygame http://stackoverflow.com/questions/15488293/render-anti-aliased-text-on-transparent-surface-in-pygame self.font.render self._text self.aa self.color_fg self.rect self.image.get_rect def draw self # Call this do draw always.. is None self._render self.screen.blit self.image self.rect @property def text self return self._text @text.setter def text..
Managing Groups in pygame http://stackoverflow.com/questions/17551395/managing-groups-in-pygame 0 0 self.image ENEMY pygame.sprite.Sprite.__init__ self self.rect self.image.get_rect self.rect.left self.rect.top location self.rect.right.. self self.rect self.image.get_rect self.rect.left self.rect.top location self.rect.right self.rect.bottom.. self self.rect self.image.get_rect self.rect.left self.rect.top location self.rect.right self.rect.bottom location self.rect.center..
Pygame- window and sprite class - python http://stackoverflow.com/questions/19936347/pygame-window-and-sprite-class-python width height self.background pygame.Surface width height self.rect self.foreground.get_rect def clear self self.foreground.blit.. # In rect you have sprite position and size # You can use self.rect.x self.rect.y self.rect.width self.rect.height # and self.rect.center.. have sprite position and size # You can use self.rect.x self.rect.y self.rect.width self.rect.height # and self.rect.center self.rect.centerx..
Space invaders project http://stackoverflow.com/questions/19966094/space-invaders-project self.image pygame.transform.scale self.image 100 50 self.rect self.image.get_rect # put ship bottom center x self.rect.bottom.. self.rect self.image.get_rect # put ship bottom center x self.rect.bottom screen_rect.bottom self.rect.centerx screen_rect.centerx.. ship bottom center x self.rect.bottom screen_rect.bottom self.rect.centerx screen_rect.centerx self.move_x 0 self.shots self.shots_count..
|