52

Cart #34135 | 2016-12-25 | Code ▽ | No License
52

This sample code shows how to add screenshake. It also shows how to fade an image to black using the palette function.

P#34136 2016-12-25 18:29 ( Edited 2017-03-14 09:31)

Love the camshake code, so easy to implement and to understand! Thanks man!

P#37842 2017-02-26 06:36 ( Edited 2017-02-26 11:36)

Thank you! Used your code for screen shake.

P#38244 2017-03-14 05:31 ( Edited 2017-03-14 09:31)
1

Thanks! I used the screen shake code.
I credited you in the source code~

P#79427 2020-07-16 18:24
1

I know this is old, but THANK YOU!

P#93152 2021-06-07 15:09

Also, thank you.

P#103211 2021-12-20 21:04

Hi,
thanks for this and for all the tutorials! I have been learning a lot and I'm having a great time with pico8!

I have been looking at the black magic line:
kmax=(p+(j*1.46))/22

And I replaced it with the following:
col_st={2,3,3,4,3,4,5,5,5,6,4,4,3,4,5}
kmax=p*col_st[j]/100

col_st contains the number of "steps" that each color has to take to go from the original color to black (0) and it is based on dpal={0,1,1,2,1,13,6,4,4,9,3,13,1,13,14}
Steps is inaccurate since the original color is counted so it is more like the states one color goes through, if this makes any sense :)
For exemple color 2 goes to 0 as follows: 2->1->0

now this:
kmax=p*col_st[j]/100
p/100 is our % fadeout, multiplied by col_st gives us the state we want this color to be

so with color 2 we have no change up to 33% fadeout, then it changes to color 1 up to 66% and after 66% it becomes black.

What do you think? Does this make any sense?

Bye!

P#107996 2022-03-03 23:06