I have got a rectangle drawn on the screen but need help. When I move it left to right it gets bigger. I want it to stay the same size and just move. Can someone please help me with my code
x=1
x1=5
y=2
y1=2
speed=2
function _init()
cls()
end
function _update60()
if btn(0) then x=x-speed end
if btn(1) then x=x+speed end
end
function _draw()
cls()
rect(x,y,x1,y1,8)
end



X1 and Y1 are coordinates on the screen for the bottom-right corner, not the width or height of the rectangle.
You might not want to have two different variables for a fixed size rectangle.
Try something like this maybe.
rect( x, y, x+width, y+height, color) |
Width and height could be a number instead of a variable if the rectangle never changes size.
I hope this helps.
[Please log in to post a comment]