Ch 12-Paddleball program from book (Sample Programs)

by kbauch, Thursday, January 29, 2015, 21:29 (1848 days ago)

I'm a noob and I have been reading the book, which I love btw. I have been playing around with the paddleball program and I can't get it to work properly. I noticed that it was trying to spriteload "green ball.png" which did not exist so I created and saved it to the proper directory. When I run it, the text output is correct but when I press enter to start it will just output "You bounced the ball 0 times". The paddle and the ball appear in the graphics output area but the paddle does not respond. I ran the debugger and it looks like the program never enters the while loop at line 27, instead it just goes right to the print statement on line 62. I have double checked the code and it looks correct. Just wondering if the program works for anyone else. Oh, I also commented out all of the wav statements to see if that had any effect, which it didn't.

Ch 12-Paddleball program from book

by cub256, Monday, February 02, 2015, 14:59 (1844 days ago) @ kbauch

...Just wondering if the program works for anyone else...

Yes it does, kbauch! I run BASIC256 on Windows 8. I had to set "pause .005" to slow it down.

It is nice to play, but much more fun is "breakout.kbs" from the "examples\sprites\" folder. This is pretty fast!

Cheers, cub256

P.S. I copied the program from the book's (2nd ed) online edittion and removed the line numbers. How did you do it? Maybe some typing error?

P.S.S. If you want to, try the BASIC256 examples from Rosetta Code, e.g. "99bottles", "game of life", "forest fire",...

P.P.P.S. I am a BASIC256 newbie, too. My longterm goal is to get the AI program "ELIZA" running with BASIC256. I loved it on my R.I.P. C64.

Very stange, but it helps!

by cub256, Monday, February 02, 2015, 21:00 (1844 days ago) @ cub256

Sometimes the ball moves very slow, stops when hitting the paddle and an error message appears. But it helps when I place something like 'wavplay "hit.wav"' at the start of the program:

# c12_sprite_paddleball.kbs
# paddleball game made with sprites
# sounds from

wavplay "hit.wav"

print "paddleball game"

Even more strange, when I comment it out

# wavplay "hit.wav"

it still works!!!???

RSS Feed of thread
powered by my little forum