Page 1 of 1

How to set color for rectangles in graphics mode in x16 basic?

Posted: Tue Jan 09, 2024 9:10 pm
by KaiLikesToCode
I have some code to draw a grid of rects:

Code: Select all

start:
	screen 128
	goto loop
	
loop:
	for i=1 to 5
	for j=1 to 5
	color rnd(1)*15
	rect i*25,j*25,i+15, j+15
	next j
	next i
	goto loop
But using the color command seems to not change the color of the rect color in graphics mode.

Re: How to set color for rectangles in graphics mode in x16 basic?

Posted: Wed Jan 10, 2024 12:45 am
by ahenry3068
KaiLikesToCode wrote: Tue Jan 09, 2024 9:10 pm I have some code to draw a grid of rects:

Code: Select all

start:
	screen 128
	goto loop
	
loop:
	for i=1 to 5
	for j=1 to 5
	color rnd(1)*15
	rect i*25,j*25,i+15, j+15
	next j
	next i
	goto loop
But using the color command seems to not change the color of the rect color in graphics mode.
Color only changes the text mode, also it is limited to the values 0-15.

You want a 5th parameter after RECT as the color. so RECT X1,Y1,X2,Y2, COLOR. And it can be between 0 and 255.

Heres the default colors. You can change them(palette manipulation) but play with the defaults before you worry about that.
VERASCRN.png
VERASCRN.png (18.07 KiB) Viewed 13382 times