Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pygame get rect

# get_rect() method is applied to Surfaces creating a rectangle of its shape.
import pygame as pg
surf_img = pg.image.load("some_image.png")
surf_img_rect = surf_image.get_rect(topleft=(x_coordinate,y_coordinate))

##  in which topleft sets the position where the rect is placed.
##  you can also use the following parameters as position arguments: 
##	bottomleft = (x,y)
##  center = (x,y) 	
##  topleft = (x,y)
 
PREVIOUS NEXT
Tagged: #pygame #rect
ADD COMMENT
Topic
Name
4+7 =