The game is ready for upload

Welcome to the final chapter of this pygame project where we have finally concluded the pygame project which has been ongoing for some time already. In this chapter I have just made a slight modification on the overlap class by reducing the points the player can get when the player missile hits the larger enemy ship.

from pygame.locals import *

class Overlap(object):

    def __init__(self):
        pass # nothing here

    # is player and enemy, player missile, enemy missile overlap
    def isOverlap(self, player, em, ex, score, gm):

        self.checkOverlap(em.enemy_list, player, ex, gm, score, em.width, em.height, em.enemy_missile_manager.width, em.enemy_missile_manager.height, None)

        if(gm.level_manager.get_level() == 3):
            self.checkOverlap(em.horizontal_enemy_list, player, ex, gm, score, em.width1, em.height1, em.enemy_missile_manager.width, em.enemy_missile_manager.height, gm.level_manager.get_level())

    def checkOverlap(self, e_list, player, ex, gm, score, width, height, m_width, m_height, level):

        self.player_rect = Rect(player.pos.x, player.pos.y, player.width, player.height)

        for i in range(len(e_list)):  # is player collides with enemy

            self.em_rect = Rect(e_list[i].x, e_list[i].y, width, height)
            if (self.player_rect.colliderect(self.em_rect)):
                e_list[i].on = False
                if (e_list[i].hit == False):
                    ex.create_explosion(player.pos.x + 2, player.pos.y + 2)
                    e_list[i].hit = True
                    gm.state = gm.OVER
                    gm.setup(gm.level_manager.get_level())

        for i in range(len(e_list)):  # is enemy missile hits player

            for j in range(len(e_list[i].missile_list)):
                self.em_rect = Rect(e_list[i].missile_list[j].x, e_list[i].missile_list[j].y,
                                    m_width, m_height)
                if (self.player_rect.colliderect(self.em_rect)):
                    e_list[i].missile_list[j].on = False
                    ex.create_explosion(player.pos.x + 2, player.pos.y + 2)
                    score.set_score(-1)
                    if (score.power_y > 100):
                        gm.state = gm.OVER
                        gm.setup(gm.level_manager.get_level())

        for i in range(len(e_list)):  # is player missile hits enemy

            self.em_rect = Rect(e_list[i].x, e_list[i].y, width, height)

            for j in range(len(player.getMissileManager().missile_list)):

                self.mm_rect = Rect(player.getMissileManager().missile_list[j].x,
                                    player.getMissileManager().missile_list[j].y, player.getMissileManager().width,
                                    player.getMissileManager().height)

                if (self.em_rect.colliderect(self.mm_rect)):
                    e_list[i].on = False
                    player.getMissileManager().missile_list[j].on = False
                    if (e_list[i].hit == False):
                        ex.create_explosion(e_list[i].x, e_list[i].y + 2)
                        e_list[i].hit = True

                        if(level == 3):
                            score.set_score(2)
                        else:
                            score.set_score(1)
                        if (score.score >= gm.level_manager.get_level() * 30):
                            gm.level_manager.increase_level()

With that we have concluded this final chapter of our pygame project development tutorial and are now ready to start a brand new one a few days from now. This project which we have finished will be uploaded to the online gaming site where you will be able to download the game setup file for your windows os, at the moment this game is built only for the windows os user but if you have followed my previous tutorials on this project then you will be able to easily recreate this game for Linux and osx as well. I will tidy up the game code and recreate the game graphics before uploading this game to any online gaming site, this will be the last chapter regarding this project but need not worry because while I continue developing this game which only has three levels at the moment I will also start a brand new pygame project starting from the next chapter. I will let you guys know where am I uploading this latest project to in the coming article so you can download it to your windows os’s laptop and then play it.

Before we close this final chapter I would like to talk about my incoming development plan for a while. At the beginning I am planning to create a few games using python and the pygame framework, a few JavaFx games and a few android games using Java. But if you are also a Java developer then you should know that Java has gone through some changes lately, myself is a very careful person and I always think before I make any move which might bring me into trouble, thus I have decided to call off the plan to build desktop game based on JavaFx framework because the Java developer may need to pay the Java 11 license fee starting from the year 2019 and I am really not sure will that includes the JavaFx  as well as Java 8 or not. Although I will not use Java 11 but I am still afraid that even Java 8 will be included into the license fees category in the future so I will just stop all the JavaFx game development projects and then see what will come next. As for the android game, the Android Java version is based on Java 6 if I am not mistaken so it should have no impact at all to the Java developer. Thus here is the revised plan: 1) Create 5 python games 2) Create 5 android games (either using Java 6 or unity/c#). 3) Canceled the JavaFx game projects altogether. You might want to say that it is alright for the Java developer to use the open Java sdk to build the application but I don’t want to take any risk because of nobody knows what will happen to the open Java sdk as well in the future.

Alright, so much for that, it is time to get ready for our next pygame project!

Leave a Reply

Your email address will not be published. Required fields are marked *