Ejemplo n.º 1
0
 def __init__(self):
     self.matrix = g.Graphics.creatematrix(
         [Obj.Obj(0, 0, g.Graphics.drawrect(100, 50, 1, " "))], self.matrix)
     #this is the room switcher
     #room_i 1-3 is title screen
     #room_i 1(n) is in the village
     #room_i 2(n) is the outskirts
     #room_i 3(n) is the forest
     #room_i 4(n) is the Castle / City
     #room_i 10(n) is for the Maps
     #room_i every room that doesn't exist in the if statement is ending the game
     while (self.run):
         if (self.player.room_i == 1):
             room = titlescreen.Titlescreen(self.player, self.matrix, 3)
             self.player = room.player
             del room
         elif (self.player.room_i == 2):
             room = titlescreen.Intro(self.player, self.matrix)
             self.player = room.player
         elif (self.player.room_i == 3):
             room = titlescreen.Loadingscreen(self.player, self.matrix, 3)
             self.player = room.player
             del room
         elif (self.player.room_i >= 10 and self.player.room_i < 20):
             room = village.Village(self.player, 10, 19)
             self.player = room.player
             del room
         elif (self.player.room_i >= 20 and self.player.room_i < 30):
             room = outskirts.Greenfield(self.player, 20, 29)
             self.player = room.player
             del room
         else:
             self.run = False
Ejemplo n.º 2
0
    def __init__(self, player):
        self.end = py.image.load('images/final.png').convert()
        config.flaga = False
        config.actual_level = 1
        board.clear()
        config.clearBackground()
        config.screen.blit(self.end, (0, 0))

        text = config.font.render("Your score: " + str(player.score), True,
                                  (255, 0, 1), (0, 0, 0))
        textrect = text.get_rect()
        textrect.center = (380, 200)
        config.screen.blit(text, textrect)

        py.display.flip()

        self.running = True

        while self.running:
            for event in py.event.get():
                if event.type == py.KEYDOWN:
                    if event.key == py.K_RETURN:
                        py.display.set_mode((1024, 768))
                        py.mixer.init()
                        py.mixer.music.load('sounds/title.wav')
                        py.mixer.music.play(-1)
                        py.mixer.music.set_volume(config.volume)
                        titlescreen.Titlescreen()
                        self.running = False
Ejemplo n.º 3
0
    def __init__(self):
        config.actual_level = 1
        py.display.set_mode((1024, 768))
        config.clearBackground()
        config.screen.blit(config.again, (0, 0))

        self.running = True

        self.button_choosen_id = 0
        self.button_choosen = {0: 'images/again.png', 1: 'images/do_menu.png'}

        img = py.image.load('images/again.png').convert()
        config.screen.blit(img, (0, 0))
        py.display.flip()

        while self.running:
            for event in py.event.get():
                if event.type == py.KEYDOWN:
                    if event.key == py.K_DOWN:
                        self.button_choosen_id += 1
                        if self.button_choosen_id == 2:
                            self.button_choosen_id -= 2
                        imagePath = self.button_choosen[self.button_choosen_id]
                        img = py.image.load(imagePath).convert()
                        config.screen.blit(img, (0, 0))
                        py.display.flip()
                        py.display.update()

                    if event.key == py.K_UP:
                        self.button_choosen_id -= 1
                        if self.button_choosen_id < 0:
                            self.button_choosen_id += 2
                        imagePath = self.button_choosen[self.button_choosen_id]
                        img = py.image.load(imagePath).convert()
                        config.screen.blit(img, (0, 0))
                        py.display.flip()
                        py.display.update()

                    if event.key == py.K_RETURN:
                        if self.button_choosen_id == 0:
                            play.Play(1)
                            self.running = False

                        if self.button_choosen_id == 1:
                            py.mixer.init()
                            py.mixer.music.load('sounds/title.wav')
                            py.mixer.music.play(-1)
                            py.mixer.music.set_volume(config.volume)
                            titlescreen.Titlescreen()
                            self.running = False
Ejemplo n.º 4
0
    def __init__(self):
        self.running = True

        imagePath = 'images/instructions.png'
        img = py.image.load(imagePath).convert()
        config.screen.blit(img, (0, 0))
        py.display.flip()

        while self.running:

            for events in py.event.get():
                if events.type == py.KEYDOWN:
                    if events.key == py.K_RETURN:
                        titlescreen.Titlescreen()
                        self.running = False
Ejemplo n.º 5
0
    def __init__(self):

        self.running = True
        self.file = open('highscores.txt', "r").read().split('\n')

        imagePath = 'images/highscores.png'
        img = py.image.load(imagePath).convert()
        config.screen.blit(img, (0, 0))
        py.display.flip()

        self.i = 0

        lista = []

        for x in self.file:
            if os.stat("highscores.txt").st_size == 0:
                break
            if x == '':
                self.file.remove(x)
                continue
            x = int(x)
            lista.append(x)
        lista.sort()
        lista.reverse()

        for line in lista[:5]:
            line = str(line)
            text = config.font.render(line, True, (255, 245, 1), (81, 81, 81))
            textRect = text.get_rect()
            textRect.center = (300, 390 + self.i)
            self.i += 50

            config.screen.blit(text, textRect)
            py.display.update()

        while self.running:

            for events in py.event.get():
                if events.type == py.KEYDOWN:
                    if events.key == py.K_RETURN:
                        h = titlescreen.Titlescreen()
                        self.running = False
Ejemplo n.º 6
0
"""
Project : Bomberman Bot with Machine Learning
Olin College Software Design Final Orject,  Spring 2017
This entire code was written by the original author, Rickyc (Github user)
No edits were done by the members of Team AFK
"""

import titlescreen, sys

if __name__ == "__main__":
    t = titlescreen.Titlescreen()
Ejemplo n.º 7
0
                        type=int,
                        default=1,
                        help='Choose the number of epochs')
    parser.add_argument('--isLoad',
                        action="store_true",
                        default=False,
                        help='Load Model')
    parser.add_argument('--isSave',
                        action="store_true",
                        default=False,
                        help='Store Model')
    parser.add_argument('--graphics',
                        action="store_true",
                        default=False,
                        help='Which Algorithm to Use')
    parser.add_argument('--isTest',
                        action="store_true",
                        default=False,
                        help='Testing Phase')
    parser.add_argument('--eps',
                        type=float,
                        default=0.5,
                        help='Epsilon for E-Greedy strategy')
    args = parser.parse_args()
    # print args.eps
    import titlescreen

    t = titlescreen.Titlescreen(args.algorithm, args.epochs, args.isLoad,
                                args.isSave, args.graphics, args.eps,
                                args.isTest)
Ejemplo n.º 8
0
"""

Nelson Su and Louis Jiazhi
ICS4U
BOMBERMAN GAME

"""

#run this file to start program
import titlescreen, sys

if __name__ == "__main__":
    t = titlescreen.Titlescreen()  #goes to titlescreen.py