Jump to content

Photo

atari2600land's Blog - Follow the bouncing ball


No replies to this topic

#1 RSS Bot OFFLINE  

RSS Bot

    Quadrunner

  • 9,304 posts

Posted Sat Mar 16, 2019 3:23 PM

For the past couple of hours and last night before I went to sleep, I was trying to get the ball bouncing around the screen in my new JezzBall-inspired game. You'd think such a thing would be relatively easy, but no. It came down to this. When the ball hits the border, it either goes two ways. For 4 borders, 2 x 4 =8. I needed 8 different lines of code to write in case the ball hits the wall. Since the ball is moving diagonally, it was a little harder. But I remembered some code from earlier about converting playfield positions to playfield block coordinates. This proved beneficial to me.
 
But still it took me a few more hours. Sometimes the ball moved out of the playfield and off the screen, ignoring the walls as if they weren't there. And then I noticed the cause. I don't know why, but whenever the cursor to make the lines was moving at the right side of the screen next to the right wall, it happened. So I had to change the way I was moving my cursor. It took a few hours to get the correct block coordinates as well. I also had to make it so the ball didn't actually touch the walls in order for the death (which happens when the line touches the ball while it was being drawn) to happen.
 
So now I'm fairly happy with what I have so far. I don't know why such a simple concept had to take two days (or 300+ lines of code).



http://atariage.com/forums/blog/168/entry-15623-follow-the-bouncing-ball/




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users