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.
pal({[0]=0x82,0x82,0x84,0x84,4,4,0x89,0x89,0x8e,0x8e,0x8f,0x8f,15,15,0x87,0x87},2)
memset(0x5f70,0xaa,16)
It's supposed to do a sunset gradient-styled sky, but I only get this: |



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:
pal({...},2) |
for
pal({...},0) |
.
For further information, see here.



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.




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
Maybe something else in your cartridge is interfering? Have you modified your cartridge's palette?



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.



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.



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

[Please log in to post a comment]