Jump to content
  • entries
  • comments
  • views

Follow the bouncing ball

Sign in to follow this  



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).

Sign in to follow this  


Recommended Comments

There are no comments to display.

Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...