PSET
pset
= "pixel set"
pset( x, y, [color] )
x | the distance from the left side of the screen. |
y | the distance from the top side of the screen. |
color | (optional) a color number |
This function will draw a single pixel to the (x,y) coordinate specified. You can specify the color as a number (0-15) according to the palette. The default color is the current draw color (last color set by either color()
function or by a drawing function's color argument).
Example:
pset(10,20,8) --draw at (10,20), a red pixel
pset(20,30) --draw at (20,30), still red
color(12) --set draw color to #12, blue
pset(30,40) --draw at (30,40), a blue pixel
circ(40,50,5,10) --draw circle at (40,50) with radius of 5, and #10 yellow
pset(40,50) --draw pixel at center of circle, still yellow
As you can see, you can specify the draw color multiple ways. In the first example we use the argument in the pset
function the first line and the same color is carried over to the second pset
. In the second example, we set the color first with the color
function which is also carried over to pset
. And in the third example, we use the color argument of the circle
function which is carried over to pset
.
Images in this Guide by NerdyTeachers is licensed under CC BY-SA 4.0
1046
3 Oct 2023