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.


    Kill all Aliens!

    Pythonista
    game scene
    3
    9
    6139
    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.
    • Bjucha
      Bjucha last edited by

      Hello. Just added my space shooter game if any of you are interested in testing it.

      https://github.com/bjucha81/KillAllAliens

      It's far from completed but it has a boss now

      Things in need of improvement and bugs

      • Boss only moves when beeing hit ( wanted it to move all the time
      • Enemy lasers do not always need to hit the ship ( if they are really close it considered a hit)
      • Distance to Boss needs to reset when boss is killed so distance to next boss is displayed)
      • PowerUps!!!
      • Alot more but these are the things im working on now

      Please leave feedback for improvments Im only doing this because it's fun and I want to learn

      1 Reply Last reply Reply Quote 1
      • Bjucha
        Bjucha last edited by

        Hello again!

        I have created a gist and updated the game now there are powerups that when the player collect will make it shoot green twin lasers

        Still haven't fixed so they shoot for a period of time, so for now they only fire once
        If anybody has any idea for how to make them better please let me know

        Here is the url: link text

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

          Hello again!

          Game update:

          • Power-up works fine now (They do not work on bosses)
          • Added second boss
          • Fixed some issues with enemy lasers and boss lasers
          • Added score (Just for fun)

          Link to game: https://gist.github.com/bjucha81/c4d369fc53e8a31ede218a5476116fa2

          ToDo:

          • Add new enemies
          • Add final boss or more bosses
          • more power-ups
          • Start up screen/ end screen
          1 Reply Last reply Reply Quote 1
          • Bjucha
            Bjucha last edited by ccc

            Hi everybody.

            I have a problem with a function and Im wondering if anybody can help me with it
            I have create "Bombs" that explode if you shot them, however my issue is that I would like the ship to die if it touches the explosion and I thought that it should look something like this for it to work:

            def bomb_gone(self, bomb):																									
            		explode = SpriteNode('shp:Explosion00', parent=self)
            		explode.scale = 0.5
            		explode.position = bomb.position
            		if self.ship.position == explode.frame:
            			exit()	
            		explode.run_action(A.move_by(10, 10, 1.6, TIMING_EASE_OUT))
            		explode.run_action(A.sequence(A.wait(1), A.remove()))		
            		bomb.remove_from_parent()
            

            as you can see if the ships and explode occupies the same frame the game is over, but it does not work, it works if the "bomb" has not exploded and I fly right into it but not if they explode, any suggestions?

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

              if self.ship.position == explode.frame:

              • Position is a point
              • Frame is a rect
              • I would have written:
                • if self.ship.position in explode.frame:
              Bjucha 1 Reply Last reply Reply Quote 0
              • Bjucha
                Bjucha @ccc last edited by

                @ccc thanks for the help, but I stll don't get it to work maybe I have forgotten something else. Anyhow thank you for your help will look through it all again

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

                  Your code only checks the first time, not while the explosion moves. Is that what you wanted?

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

                    Also, really what you want is if the two frames intersect --@ccc's code only checks the position, which might be the center, or corner, so probably isnt what you want

                    rect offers an intersect method:

                    if self.ship.frame.intersects(explode.frame)

                    which would check if the bounding boxes intersect. note that this might be "unfair", since if you have a round explosion, and round ship, this test would pass when the corners touch, not the circles. I forget if shapenodes or textures have an intersect method...

                    It might be better to use a circular distance check, which would let the explostion intersect slightly.

                    abs(self.ship.position-explode) < (explode.width + self.ship.width)/2.

                    you could play with a scale factor multilier on the right, to get something that looks/feels right.

                    Bjucha 1 Reply Last reply Reply Quote 1
                    • Bjucha
                      Bjucha @JonB last edited by

                      @JonB yes, I want the ship to "die" if it touches the explosion, gonna try your solution when I get home, thank you

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