This is the first thing I felt was worth sharing. It makes some cute little circles do fun things! It has a variety of settings to play with in the code (I'm not sure you can play with them on here, but since its just waves copy and paste works rly easily). clicking z just shows the color numbers that was more for dev than anything to get the rainbow right.
I hope you like it :D
Code:
--moving circles based on waves --khol feb 2025 function _init() pal({[0]=0,2,136,8,137,9,10,138,11,139,12,140,1,129,130,7},1) valid_colors={} for i=1,14 do add(valid_colors,i) end camera(-63,-64) --controls----------------- text=false -- z button --------------------------- col_mode=false -- fun colors speed=-0.005 size=30 -- circle size scale=30 -- from center num_objects = 6 --------------------------- objects = {} for i=1,num_objects do if col_mode do temp_col = (valid_colors[(i-1)% #valid_colors +1]) else temp_col = 15 end local obj= { angle = (i-1)*(1/num_objects), speed = speed, col = temp_col } add(objects, obj) end end function _draw() cls() for obj in all(objects) do local x = 0 + cos(obj.angle)*scale local y = 0 + sin(obj.angle)*scale circ(x,y,size,obj.col) if text do local tx = 0 + cos(obj.angle)*(scale+15) local ty = 0 + sin(obj.angle)*(scale+15) print(obj.col,tx,ty) end end end function _update() for obj in all(objects) do obj.angle = obj.angle + obj.speed end if (btnp(4)) do text = not text end end function rotate_point(px,py,ox,oy,angle) local cos_a = cos(angle) local sin_a = sin(angle) local dx = px-ox local dy = py-oy local nx = ox + cos_a*dx - sin_a*dy local ny = oy + sin_a*dx + cos_a*dy return nx,ny end |



This reminds me of the intro screens of KUMA COMPUTERS games on the amstrad CPC 464.

The logic is similar : some math drawings and rainbow based animation.
Big difference is the CPC had nowhere near enough CPU to do a full screen redraw each frame, and drew the 1st frame line by line over maybe 10 seconds, then would fake animate the whole screen by doing hardware palette color cycling.



Very neat hue!
Color 15 is an unused white, but if I add more colors to make it a full palette, will the beautiful gradation be maintained?
[Please log in to post a comment]