Log In  

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

P#138553 2023-12-11 12:49

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)
P#138554 2023-12-11 13:51

@2bitchuck thank you

P#138555 2023-12-11 14:19

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

P#138556 2023-12-11 14:22 ( Edited 2023-12-11 14:32)

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.

P#138561 2023-12-11 15:44 ( Edited 2023-12-11 15:46)

@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.

P#138564 2023-12-11 16:58

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?

P#138572 2023-12-11 22:32

@jasondelaat I can't really clarify. Maybe run the code on your own? I'm not sure what's happening.

P#138598 2023-12-12 14:10
1

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.

P#138604 2023-12-12 16:37

@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

P#138605 2023-12-12 16:54 ( Edited 2023-12-12 17:36)

[Please log in to post a comment]