So I want to make a game that's satisfying to play with currently I have this:
function _init()
x=64
y=74
end
function _update()
if btn(⬆️) then y-=1
end
if btn(⬇️) then y+=1
end
if btn(➡️) then x+=1
end
if btn(⬅️) then x-=1
end
end
function _draw()
rectfill
spr(1,x,y)
print("blue square")
end
I'm not sure how to do the rectfill and fill it with color 2. I want to fill the background and maybe make z and x do something
The RECTFILL function takes parameters corresponding to the top left and bottom right corner of the rectangle, plus the color you want. So to RECTFILL the whole background with color 2, you can do this:
RECTFILL(0,0,128,128,2) |
In this case, (0,0) is the x,y of the top left corner and (128,128) is the x,y of the bottom right corner - since the screen is 128x128, this will cover the whole screen.
You can also just use CLS for this though if you only need this to create a background color:
CLS(2) |
Oh wait I noticed that it doesnt do the satisfying thing with background and w/o the blue square code ._.
edit: how does the satisfying thing work and how do I make it work with a background and w/o blue square code
If you just want the whole screen a single colour you can do that with cls(n)
at the top of your _draw()
function wheren
is the number for the colour you want.
Edit: oops! Should have read the thread first.
@jasondelaat Yeah but the problem I'm having now is it doesn't do the satisfying thing with a background and w/o blue square text and I don't know why.
Can you clarify what you mean by "the satisfying thing"?
What exactly are you trying to do? And if what you're trying to do isn't what's happening, what's happening instead?
@jasondelaat I can't really clarify. Maybe run the code on your own? I'm not sure what's happening.
I've run the code. I know what it does. But without knowing what you expect it to do I can't really help you.
"The satisfying thing" doesn't really tell me much I'm afraid.
@jasondelaat So by "the satisfying thing" I mean the wiggles it does and it cutting off at the bottom. I've added more as well, and I'm trying to make the border and the inside change colors to the sides of the screen.
Edit: I added this and it isn't doing what I want.
if btn(4) then pal(12,2)
end
if btn(4) then pal(2,8)
end
if btn(4) then pal(8,12)
end
if btn(5) then pal(5,2)
end
if btn(5) then pal(2,8)
end
if btn(5) then pal(8,12)
end
if btn(5) then pal(12,5)
end
Yes I know, very messy
[Please log in to post a comment]