-
Notifications
You must be signed in to change notification settings - Fork 1
rect
Kyuchumimo edited this page Jul 9, 2022
·
8 revisions
rect x y w h color
- x, y : coordinates of the top left corner of the rectangle
- w : the width the rectangle in pixels
- h : the height of the rectangle in pixels
- color : the index of the color in the palette that will be used to fill the rectangle
This function draws a filled rectangle at the specified position.
See also:
- rectb - draw only the border of the rectangle
_TIC["PALETTE"] = [[0x14,0x0c,0x1c], [0x44,0x24,0x34], [0x30,0x34,0x6d], [0x4e,0x4a,0x4e], [0x85,0x4c,0x30], [0x34,0x65,0x24], [0xd0,0x46,0x48], [0x75,0x71,0x61], [0x59,0x7d,0xce], [0xd2,0x7d,0x2c], [0x85,0x95,0xa1], [0x6d,0xaa,0x2c], [0xd2,0xaa,0x99], [0x6d,0xc2,0xca], [0xda,0xd4,0x5e], [0xde,0xee,0xd6]] #DB16
# rect demo
x=120
y=68
dx=7
dy=4
col=1
cls()
def TIC():
#Update x/y
x=x+dx
y=y+dy
#Check screen walls
if x>240-6 or x<0:
dx=-dx
col=col%15+1
if y>136-6 or y<0:
dy=-dy
col=col%15+1
#Draw rectangle
rect (x,y,6,6,col)