Log In  


Cart #17617 | 2015-12-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

The palette cycling happens once and then stops, I tried using palt(), but this doesn't appear to reset the cycle. Any pointers would be appreciated!

Here's the code I'm using.

function _update()
	p+=1
 if p>15 then
 	p=1
 end
end

function _draw()
  pal(p,p-1,1)
end
1


Hello there.

With your code, once you've made it through all the colours once, you're then making the same changes again, so no change is apparent.

I'm wondering if you meant to do something more like this?

Cart #17620 | 2015-12-09 | Code ▽ | Embed ▽ | No License

function _update()
	p+=1
end

function _draw()
 for x=0,15 do
  pal(x,(x+p)%16,1)
 end
end

This will keep looping over all the palette entries every frame.


^ You don't actually need to use modulo (%) with pal() since the function already handles that internally.
It's absolutely good practice to do it, but it's good to know you can skip it if you really really need those 2 tokens for whatever reason :P


Hi, i tried Solar's palette cycling on a thing, and it turns out that when recording a gif, the palette cycling isn't recorded... Am i the only one or is it some bug?



I hadn't seen that post, sorry and thank you. :)



[Please log in to post a comment]