Log In  

Cart #pipes-0 | 2024-03-19 | Embed ▽ | License: CC4-BY-NC-SA
7

I made a pipes screensaver, inspired by the classic 3D Pipes Screensaver.

A pipe of a random color is created on the somewhere on the edge of the screen. It will expand outwards from its starting point, choosing to go straight, left, or right. The pipe will stop when it goes out of bounds, and a new pipe will be created.

I am not saving information about the pipes manually. I just draw the current pipe, and never cls. All the old pipes stay on screen and the new ones are drawn above. Previously, I saved all of the pipe connections and colors in a 30*17*6 table which was redrawn every frame, but then I realized that I could get rid of that by just removing cls. So instead of storing and drawing up to 3060 sprites every frame, instead I only store and draw one.

I only have 3 pipe sprites for each color: a vertical pipe, a horizontal pipe, and a bend pipe. The bend pipe is flipped based on what direction it needs to be. There is a visual bug when flipping a pipe vertically on the bottom row (y = 256) that causes it to become misaligned with the rest. I think it's a bug with the sprite flipping so there's no way I can fix it. (Well, there is a way I can fix it, and it's called quadruple the number of bend sprites. But I'm not doing that.)

(Edit: The sprite flipping issue was fixed in 0.1.0c!)

The pipe only expands once every 8 frames. I think at full speed it goes too fast to watch it.

P#143829 2024-03-19 14:17 ( Edited 2024-03-24 21:39)


[Please log in to post a comment]