Skip to content

Instantly share code, notes, and snippets.

@jarnoh
Created February 1, 2025 11:26
Show Gist options
  • Save jarnoh/40b386cd24b1fd411041a82342deb1a0 to your computer and use it in GitHub Desktop.
Save jarnoh/40b386cd24b1fd411041a82342deb1a0 to your computer and use it in GitHub Desktop.
eight raster bars for copper showdown
local num_frames = 128
local copper_lists_builder = CopperListsBuilder.new()
for frame=1,num_frames do
local colors = {}
function rasterbar(y)
for i=0,15 do
colors[y+i]=i*0x111
colors[y+31-i]=i*0x111
end
colors[y]=0
colors[y+32]=0
end
for n=1,8 do
y=math.floor((math.sin(n*0.25 + frame/num_frames * math.pi * 2)+1)*(180)*0.5+32)
rasterbar(y)
end
local copper_list_builder = CopperListBuilder:new()
copper_list_builder:add_label("frame_" .. frame - 1)
local cc=0
for y=0,255 do
if colors[y] and colors[y]~=cc then
cc=colors[y]
copper_list_builder:push(y*256+0x11, 0xfffe)
copper_list_builder:push(COLOR00, cc)
end
end
local next_copper_list_label = "frame_" .. frame % num_frames
copper_list_builder:push(0x80, next_copper_list_label .. "%h", 0x82, next_copper_list_label .. "%l")
copper_lists_builder:push_copper_list_builder(copper_list_builder)
end
return copper_lists_builder:build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment