This was a challenge on the Facebook C64/C128 programmers group:
Create a sprite with a frame. Bounce a pixel within the sprite's frame. Bounce the sprite on the screen.
I thought an X16 version would be a fun task. The challenge was specifically to do it entirely in BASIC on the C64 using an expanded sprite (double-width, double-height) in a program with the smallest memory footprint (my X16 version takes up 244 bytes, but you get to stare at a screen doing nothing for many seconds while it initializes the sprite bitmap dynamically).
Since a square sprite makes for a boring bounce along a line between opposite corners, I made the ball bounce within a 48x42 rectangle inside the 64x64 sprite (to match an expanded sprite on the C64).
Try It Now!
Bouncing ball within a bouncing frame
-
- Posts: 23
- Joined: Sat Nov 26, 2022 6:24 pm
Bouncing ball within a bouncing frame
- Attachments
-
METABOUNCE.PRG
- (254 Bytes) Downloaded 45 times
- ahenry3068
- Posts: 1201
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Bouncing ball within a bouncing frame
Had to do my Own versionMarkTheStrange wrote: ↑Wed Feb 19, 2025 10:22 pm This was a challenge on the Facebook C64/C128 programmers group:
Create a sprite with a frame. Bounce a pixel within the sprite's frame. Bounce the sprite on the screen.
I thought an X16 version would be a fun task. The challenge was specifically to do it entirely in BASIC on the C64 using an expanded sprite (double-width, double-height) in a program with the smallest memory footprint (my X16 version takes up 244 bytes, but you get to stare at a screen doing nothing for many seconds while it initializes the sprite bitmap dynamically).
Since a square sprite makes for a boring bounce along a line between opposite corners, I made the ball bounce within a 48x42 rectangle inside the 64x64 sprite (to match an expanded sprite on the C64). Screenshot 2025-02-19 at 17.14.51.png
Try It Now!

Try It Now!
- Attachments
-
BOUNCE.PRG
- (4.76 KiB) Downloaded 27 times
-
BOUNCE.BAS
- (5.61 KiB) Downloaded 12 times
-
- Posts: 23
- Joined: Sat Nov 26, 2022 6:24 pm
Re: Bouncing ball within a bouncing frame
Well, that's much fancier. Change the frame to a gilded picture frame and it will fit right in.

- ahenry3068
- Posts: 1201
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Bouncing ball within a bouncing frame
That's doable... I will see.MarkTheStrange wrote: ↑Fri Feb 21, 2025 3:39 pmWell, that's much fancier. Change the frame to a gilded picture frame and it will fit right in.![]()
Re: Bouncing ball within a bouncing frame
Looks like Robin saw the challenge too. [yt]https://www.youtube.com/watch?v=zwTA7xi0QD0[/yt]
- ahenry3068
- Posts: 1201
- Joined: Tue Apr 04, 2023 9:57 pm
Bouncing ball With some Physics
- Attachments
-
BOUNCE.PRG
- (4.8 KiB) Downloaded 22 times
-
BOUNCE.BAS
- (5.72 KiB) Downloaded 10 times
- desertfish
- Posts: 1125
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Bouncing ball within a bouncing frame
There's some weird physics going on with the ball though. It changes course sometimes even when it is not actually touching the sides of the box.
- ahenry3068
- Posts: 1201
- Joined: Tue Apr 04, 2023 9:57 pm
New Physics.
Well this is Not real physicsdesertfish wrote: ↑Fri Feb 21, 2025 9:50 pm There's some weird physics going on with the ball though. It changes course sometimes even when it is not actually touching the sides of the box.
But REAL PHYSICS would eventually stop the animation with friction !!!!
I thinks this looks a bit more Realistic to the Eye.
Try It Now!
- Attachments
-
BOUNCE4.PRG
- (4.85 KiB) Downloaded 7 times
-
BOUNCE4.BAS
- (5.87 KiB) Downloaded 1 time