Log In  

Hello all.
I'm probably missing something really important but I'm trying to put a gradient sky on my game.
I spotted some code I thought would do the trick in another thread.

poke(0x5f5f,0x3c) -- 0x3c is the colour of the blue sky to be replaced.

It's supposed to do a sunset gradient-styled sky, but I only get this:

Editing the colours in the table result in the same!

Ideally, I'd like it different shades of blue as in the other example, but I'll cross that bridge later.

Can someone please help out with what I'm doing wrong?

Thanks in advance

P#133412 2023-08-22 20:47 ( Edited 2023-08-22 21:51)

Looking through the code, I assess that one of the criticals is to understand what exactly pal(table, [palette]) means.

According to the Manual, the palette value in pal() can be 0,1 or 2. To change the color the program drawn, we usually take the palette value as 0.

Plus, palette value 2 is only fit for fillp(),which may not often be used in platformers.

So, maybe you can try replace the middle code:





For further information, see here.

P#133437 2023-08-23 18:48 ( Edited 2023-08-23 18:52)

Sadly, that didn't work, thePixelXb_

It resulted in all the background tiles having their colours changed to a pale brown colour.

Thanks for the reply though.

P#133439 2023-08-23 19:06

It might help if you posted a cart so we can see the rest of your code.

If I take your code and put it in an empty cart, it draws the same gradient as in https://www.lexaloffle.com/bbs/?tid=38565

Cart #bosrumujo-0 | 2023-08-24 | Code ▽ | Embed ▽ | No License

Maybe something else in your cartridge is interfering? Have you modified your cartridge's palette?

P#133448 2023-08-24 01:06

I've tried to embed my cart. I hoper it works.

I thought I'd added the gradient code in the wrong place (while it drew the screen) so I moved it it the _init as in the demo that worked. I still have the same issue.

The demo worked as a stand alone cart though, so there's obviously something in my game that's messing things up.

Cart #benhwijo-0 | 2023-08-24 | Code ▽ | Embed ▽ | No License

P#133483 2023-08-24 20:32

I found the reason for my problem.
I was changing the palette to show the black outlines round the sprites.

I've no idea how to fix it, but at least I know what the problem is now.

P#133523 2023-08-25 19:33

Happy now.
Thanks for the hints, guys.
It was the palette change that was at fault.

P#133524 2023-08-25 19:42

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-12-09 20:51:06 | 0.012s | Q:22