Jump to content

Help on Breakout-style game


Recommended Posts

I've been working all night to get this thing to work, and it won't work properly. If you watch the demo, the ball (which is missile1) won't get rid of the pfblocks right. (never mind the name, it's actually Breakout.) Help!



Your ball is 2 pixels by 2 pixels, so it is made up of 4 pixels any of which can be detected as colliding with the PF graphics. Your mathematical check after the fact only looks at one of the 4 pixels that may have collided. So if the pixel that actually collided is not the pixel you are checking, then you get the behavior you are seeing.


A hardware collision does not guarantee a block was hit. You may wish to change which of the 4 pixels you check depending on the direction the ball is traveling. Map that pixel to the screen PD coordinates and then read that PF block to make sure it is still on. If it isn't on, then one of the ignorable pixels of the ball is what caused the hardware collision detection.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

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