omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Breakout Clone

    Pythonista
    3
    8
    3417
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Sebastian
      Sebastian last edited by

      Here's what I've been working on these past few days. The collision handling is kind of buggy though. If anyone have any suggestions on how to handle the "ball -> block" collision let me know :)
      PS: Only tested on iPad

      https://gist.github.com/SebastianJarsve/5305895

      1 Reply Last reply Reply Quote 0
      • Cubbarooney104
        Cubbarooney104 last edited by

        How about naming this one Drillball? The reason is if you manage to hit the boxes in just the right way, your ball becomes a drill and plows through the entire column!

        Here is a little diagram:
        <pre>

        ### ()

        # # # |

        # # # --->

        # #

          ()
           |
        

        </pre>
        Related is the following problem:
        <pre>

        ###

        # # # #

        ### ---> ### ()

        ### () ### /

        # # # \ #

        ###

        </pre>

        To sum it all up, if the border in between two boxes is hit, both boxes are hit. Also, if the ball is traveling vertically (and I assume horizontally) the ball will not bounce off.

        I think this a glitch report :D
        Cubbarooney

        1 Reply Last reply Reply Quote 0
        • Sebastian
          Sebastian last edited by

          I believe I fixed it :) Before, I always reversed the ball's velocity when the ball hit the block and if the ball was hitting two blocks at the same time it leveled out and went strait through. The change I did was that if the ball hits the bottom of the rect for instance, the y-velocity will change to <PRE>-abs(velocity.y)</PRE> If it hits the top then the y-velocity will be <PRE>abs(velocity.y)</PRE>

          1 Reply Last reply Reply Quote 0
          • eliskan175
            eliskan175 last edited by

            Very nice. I did however notice my ball keeps getting lost off screen.

            edit: nevermind I think that was because when I copied the raw code from gisthub it had a couple glitches and I thought they were == and I guess they were <= ... that fixed the problem. My bad haha

            Not sure why iPad has such a hard time copying the data from gisthub raw.. shows up fine on my PC: https://gist.github.com/SebastianJarsve/5305895/raw/774772b56e810362d7a331587b1d0b352a38187a/Breakout_Clone.py

            1 Reply Last reply Reply Quote 0
            • Sebastian
              Sebastian last edited by

              I've also had problems copying raw code from a gist. Especially if it has any ">" or "<" in it. Glad you got it working ;)

              1 Reply Last reply Reply Quote 0
              • Cubbarooney104
                Cubbarooney104 last edited by

                XD Just noticed that the formatting on my other post was a little... off. Woops, but I think you got the idea.

                Cubbarooney

                1 Reply Last reply Reply Quote 0
                • eliskan175
                  eliskan175 last edited by

                  Breakout is fun, and I love how you used gravity for the player, now you need to set up a new twist! Like special physics for the ball, powerups, or maybe the blocks could fight back or move, etc.

                  1 Reply Last reply Reply Quote 0
                  • Sebastian
                    Sebastian last edited by

                    I've already created solid blocks, but I just haven't used them in any of the levels yet :P Maybe I'll add some more levels with some of the solid blocks, and add some powerups later on :)

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Powered by NodeBB Forums | Contributors