Log In  

Hi all,

I'm trying to add a drop shadow effect to a couple of my sprites, like I've mocked up here:

I managed to get this working by using a load of pset() calls going down the edge of the card, and in the corner. It works well, but I've run into the issue of the shadow colour on the green (3). I found that using the dark blue (1) colour was a bit too dark, and that using the blue-green (131) colour was much nicer, but I can't seem to get it working with pset().

I looked around here and, if my understanding is correct, you can only have 16 active colours in a palette, which is why I thought to replace a colour that I'd never use, like yellow (10), with the blue-green. However, again, using pal() for this didn't seem to work with pset().

Any ideas on how I can get this working? I'm relatively new to messing around with palettes and setting pixels like this.


P#112832 2022-06-07 08:17

colors > 128 must be set globally (see the third parameter of pal - 1: screen palette).
doing pget/pset for such a moderate amount of pixels is ok.

P#112836 2022-06-07 10:03

are you calling pal(index,colour,1)? the last param is required for secret palette.

if it’s not that, show some of the code please!

P#112837 2022-06-07 10:03 ( Edited 2022-06-07 10:03)

I just tried this code

  pal(10, 131)
  pset(50, 50,10)

and it seems to work. What went wrong when you tried it?

P#112838 2022-06-07 10:11

yeah, so I guess a basic program would be:


When I do this in the code editor, it doesn't work (the pixel is yellow still), but if I do this in the console, it works fine.

P#112839 2022-06-07 10:18

kimiyoribaka: that is strange, secret colours only work with screen palette (third param=1)

cpuSonicatt: not clear what you’re reporting; can you share your cart?

P#112841 2022-06-07 11:30

The cart with the two lines of code...

Cart #yehosiginu-0 | 2022-06-07 | Code ▽ | Embed ▽ | No License

against when I run those two lines individually in the console.

P#112843 2022-06-07 12:10

you are not defining a _draw function, so your two lines of code run then the program immediately stops and exits to the command prompt. the custom palette is lost then!

P#112850 2022-06-07 14:57

Ohhhh! Gotcha.

It's all working now. I realised I had been calling pal() a couple times afterwards, in order to reset the palette so I could draw the right colours on the cards (symbols on the royals/non-royals for example). So I've got my own function to reset and add the blue-green back in:

function sp()

...called within the _draw().

There's almost certainly a better way to do that, but I'm glad this is working now. :)

Thank you, merwok!

P#112854 2022-06-07 15:48

[Please log in to post a comment]