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
P#17618 2015-12-09 04:48 ( Edited 2016-02-28 16:07)

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.

P#17622 2015-12-09 05:38 ( Edited 2015-12-09 10:46)

^ 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

P#17630 2015-12-09 11:22 ( Edited 2015-12-09 16:25)

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?

P#19004 2016-02-28 07:18 ( Edited 2016-02-28 12:18)
P#19005 2016-02-28 08:13 ( Edited 2016-02-28 13:13)

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

P#19011 2016-02-28 11:07 ( Edited 2016-02-28 16:07)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 11:12:05 | 0.014s | Q:26