Example #1
0
def game_intro():
    screen.fill(RGB_BLACK)  #DRAWS MENU
    pygame.display.update()
    sound1.sound.set_volume(0)
    pygame.time.wait(100)
    sound2.sound.play()
    text = """[i] Initializing ...
[i] Entering ghost mode ...

done ..."""
    Intro(screen, text).run()
    Intro(screen, "End.", False).run()
Example #2
0
 def showIntro(self):
     myintro = Intro()
     mytextlist = ['Welcome to PyDF',
                   'd + mouse for digging',
                   'h + mouse for channeling',
                   'i + mouse to designate item dump',
                   'o + mouse selects items for dumping',
                   'k + arrows to inspect tile content',
                   's to save or l to load map from disk',
                   'arrow keys to move the viewport around',
                   'shift + < or > goes UP and DOWN Z levels',
                   'shift + arrow keys to move 10 tiles at a time',
                   'spacebar unpauses the game or pauses',
                   'Esc quits',
                   '',
                   'Press any key to continue']
     hoffset = self.tw
     voffset = self.tw * 2
     for item in mytextlist:
         myintro.drawText(item, self.screen, hoffset, voffset)
         voffset += self.tw * 2
                     
     pygame.display.update()
     myintro.waitForKey()
     self.intro = False
Example #3
0
def startup_screen(ai_settings, game_stats, screen):
    """Display the startup menu on the screen, return False if the user wishes to quit,
    True if they are ready to play"""
    menu = Intro(ai_settings, game_stats, screen)
    play_button = Button(ai_settings, screen, 'Play Game', y_factor=0.70)
    hs_button = Button(ai_settings, screen, 'High Scores', y_factor=0.80)
    intro = True

    while intro:
        play_button.alter_text_color(*pygame.mouse.get_pos())
        hs_button.alter_text_color(*pygame.mouse.get_pos())
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return False
            elif event.type == pygame.MOUSEBUTTONDOWN:
                click_x, click_y = pygame.mouse.get_pos()
                game_stats.game_active = play_button.check_button(
                    click_x, click_y)
                intro = not game_stats.game_active
                if hs_button.check_button(click_x, click_y):
                    ret_hs = high_score_screen(ai_settings, game_stats, screen)
                    if not ret_hs:
                        return False
        screen.fill(ai_settings.bg_color)
        menu.show_menu()
        hs_button.draw_button()
        play_button.draw_button()
        pygame.display.flip()

    return True
def opening_screen(ai_settings, game_stats, screen):
    """Display the menu in the beginning"""

    # Set up screen attributes
    menu = Intro(ai_settings, game_stats, screen)
    play_button = Button(ai_settings, screen, 'Play Game', y_factor=0.70)
    hs_button = Button(ai_settings, screen, 'High Scores', y_factor=0.80)
    intro = True

    # Manages the key presses of the game
    while intro:
        for events in pygame.event.get():
            if events.type == pygame.QUIT:
                return False
            elif events.type == pygame.MOUSEBUTTONDOWN:
                click_x, click_y = pygame.mouse.get_pos()
                game_stats.game_active = play_button.check_button(click_x, click_y)
                intro = not game_stats.game_active
                if hs_button.check_button(click_x, click_y):
                    ret_hs = high_score_screen(ai_settings, screen)
                    if not ret_hs:
                        return False

        screen.fill(ai_settings.bg_color)
        # Allow the menu to display on the top layer
        menu.show_menu()
        # Draw the button on the main screen
        hs_button.draw_button()
        play_button.draw_button()

        # Display past
        pygame.display.flip()

    return True
Example #5
0
 def __init__(self):
     self.screen = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT))
     pygame.display.set_caption('Screaming Bird')
     self.pipegap = 120
     self.intro = Intro(self.screen)
     self.highScore = HighScore(self.screen)
     self.settings = Setting(self.screen)
Example #6
0
    def showIntro(self):
        intro = Intro()
        text_list = [
            "Welcome to PyDF",
            "d + mouse for digging",
            "h + mouse for channeling",
            "i + mouse to designate item dump",
            "o + mouse selects items for dumping",
            "k + arrows to inspect tile content",
            "s to save or l to load map from disk",
            "arrow keys to move the viewport around",
            "shift + < or > goes UP and DOWN Z levels",
            "shift + arrow keys to move 10 tiles at a time",
            "spacebar unpauses the game or pauses",
            "Esc quits",
            "",
            "Press any key to continue",
        ]
        hoffset = self.tw
        voffset = self.tw * 2
        for item in text_list:
            intro.drawText(item, self.screen, hoffset, voffset)
            voffset += self.tw * 2

        pygame.display.update()
        intro.waitForKey()
        self.intro = False
Example #7
0
    def run(self):
        menu = Menu(self.screen)
        hs_screen = HighScoreScreen(self.screen, self.score_keeper)
        intro_seq = Intro(self.screen)
        e_loop = EventLoop(
            loop_running=True,
            actions={pygame.MOUSEBUTTONDOWN: menu.check_buttons})

        while e_loop.loop_running:
            self.clock.tick(60)  # 60 fps limit
            e_loop.check_events()
            self.screen.fill(PacManPortalGame.BLACK_BG)
            if not menu.hs_screen:
                intro_seq.update()  # display intro/menu
                intro_seq.blit()
                menu.update()
                menu.blit()
            else:
                hs_screen.blit()  # display highs score screen
                hs_screen.check_done()
            if menu.ready_to_play:
                pygame.mixer.music.stop()  # stop menu music
                self.play_game()  # player selected play, so run game
                for g in self.ghosts:
                    g.reset_speed()
                menu.ready_to_play = False
                self.score_keeper.save_high_scores(
                )  # save high scores only on complete play
                hs_screen.prep_images()  # update high scores page
                hs_screen.position()
            elif not pygame.mixer.music.get_busy():
                pygame.mixer.music.play(-1)  # music loop
            pygame.display.flip()
Example #8
0
File: game.py Project: Nando96/pac
    def play(self):
        menu = Menu(self.screen)
        hs_screen = HighScoreScreen(self.screen, self.score_keeper)
        intro_seq = Intro(self.screen)
        loop = Events(runs=True, actions={pygame.MOUSEBUTTONDOWN: menu.check})

        while loop.runs:
            self.clock.tick(60)
            loop.check_events()
            self.screen.fill((0, 0, 0))
            if not menu.hs_screen:
                intro_seq.update()
                intro_seq.blit()
                menu.update()
                menu.blit()
            else:
                hs_screen.blit()
                hs_screen.check_done()
            if menu.ready_to_play:
                pygame.mixer.music.stop()
                pygame.mixer.music.load('sounds/waka.wav')
                pygame.mixer.music.play()
                self.play_game()
                menu.ready_to_play = False
                self.score_keeper.save_high_scores()
                hs_screen.prep_images()
                hs_screen.position()
            elif not pygame.mixer.music.get_busy():
                pygame.mixer.music.play(-1)
            pygame.display.flip()
Example #9
0
    def __init__(self, game_opts):
        # part of the borg pattern
        self.__dict__ = self.__shared_state

        ## the game scenes/levels
        self.scenes = FSM()

        # initialise a sample level
        # TODO: find a way of applying lazy initialisation
        # on level creation - a level should be created only
        # right before executed
        # flev = LevelFactory().create_level(
        #     constants.SCENES['level_one'],
        #     game_opts)
        flev = LevelFactory().create_level(constants.SCENES['level_one'])

        # set and group the scenes
        scenes = (Intro(game_opts), Menu(game_opts), flev)

        # add the scenes to the state machine
        for s in scenes:
            self.scenes.add_state(s)

        # enable the default state
        self.scenes.active_state = scenes[0]
Example #10
0
def main():
    pygame.init()

    size = width, height = 720, 700
    black = (0, 0, 0)
    screen = pygame.display.set_mode(size)

    running = True

    bd = Board(3)
    intro = Intro()
    game = Game(0)  # 0 -> intro menu, 1 ->game

    while running:

        screen.fill(black)

        for event in pygame.event.get():

            if event.type == pygame.QUIT:  #exit condition
                running = False
            # check for mouse positions for intro menu
            if game.state == 0:
                if event.type == pygame.MOUSEBUTTONDOWN:
                    pos = pygame.mouse.get_pos()
                    if intro.start_btn.is_clicked(pos):
                        game.state = 1  #starts the game

            # check for mouse positions for the main game
            if game.state == 1:
                if event.type == pygame.MOUSEBUTTONDOWN:
                    initial_pos = pygame.mouse.get_pos()
                    tile = bd.get_selected_tile(initial_pos)

                    if bd.solve_btn.is_clicked(initial_pos):
                        bd.is_solving = True
                        bd.solve_puzzle()

                if event.type == pygame.MOUSEBUTTONUP:
                    if tile != None:
                        final_pos = pygame.mouse.get_pos()
                        direction = bd.drag_direction(initial_pos, final_pos)
                        bd.move_tile(tile, direction)

        if game.state == 0:
            intro.draw(screen)
        else:
            if bd.is_solving == True:
                bd.walk_path(bd.solving_path)
                bd.draw(screen)
                time.sleep(0.3)  # solving speed
            else:
                bd.draw(screen)

        pygame.display.update()

    pygame.display.quit()
    pygame.quit()
Example #11
0
def IntroStart(ParentMenu):
    #Deletes previous MainMenu instance to avoid redundancy
    del(ParentMenu)
    global CurrentIntro

    #Starts Intro loop in file menu.py
    CurrentIntro = Intro()
    CurrentIntro.auto()
    GameStart(CurrentIntro)
Example #12
0
def intro(status):
    """
    Introduction Scene
    :param status: A boolean ready to capture User Event
    :return: Updated Status Param
    """
    current = Intro()
    if current.status:
        status = current.status
    return status
Example #13
0
def main():
	#pygame init
	pygame.mixer.pre_init(SAMPLE_RATE, BIT, CHANNELS, BUFFER_SIZE)
	pygame.init()
	pygame.display.set_mode((WIDTH, HEIGHT))
	pygame.display.set_caption('PyTone')

	#make background
	background = Gradient((WIDTH, HEIGHT), GRAD_START, GRAD_END)

	#path to medias
	path = 'media/'

	pygame.display.set_icon(pygame.image.load(path + 'petrol.png'))

	#intro duration in milliseconds
	duration = 4000

	#states
	intro = Intro(background, path, duration)
	menu = Menu(background, path)
	game = Game(background, path)
	instructions = Instructions(background, path)

	intro.run()

	#storing return value from menu
	running = True
	while running:
		option = menu.run()
		if option == NEW_GAME:
			option = game.run()

		elif option == INSTRUCTIONS:
			instructions.run()
		elif option == PRACTICE:
			#intro.run()
			game.set_practise(True)
			game.run()
			game.set_practise(False)

		#no elif here to make different states be able to quit as well
		if option == pygame.locals.QUIT:
			pygame.quit()
			running = False
 def submit(self, action):
     if action == "startgame":
         self.next = Intro()
         self.pause()
         self.quit()
     elif action == "continue":
         self.next = ContMapSelect()
         self.pause()
         self.quit()
     elif action == "custom":
         self.next = MapSelect("custom_maps")
         self.pause()
         self.quit()
     elif action == "editor":
         self.next = Editor()
         self.pause()
         self.quit()
     elif action == "exit":
         self.quit()
Example #15
0
    def __init__(self):
        smach.StateMachine.__init__(self, outcomes=['finished', 'failed'])

        with self:

            smach.StateMachine.add('SELECT_SCENARIO',
                                   SelectScenario(),
                                   transitions={
                                       'pause': 'SELECT_SCENARIO',
                                       'intro': 'INTRO',
                                       'roses': 'ROSES',
                                       'ball': 'BALL',
                                       'failed': 'failed'
                                   })

            smach.StateMachine.add('SELECT_PAUSE',
                                   SelectPause(),
                                   transitions={
                                       'succeeded': 'SELECT_SCENARIO',
                                       'failed': 'failed'
                                   })

            smach.StateMachine.add('INTRO',
                                   Intro(),
                                   transitions={
                                       'finished': 'SELECT_PAUSE',
                                       'failed': 'failed'
                                   })

            smach.StateMachine.add('ROSES',
                                   Roses(),
                                   transitions={
                                       'finished': 'SELECT_SCENARIO',
                                       'failed': 'failed'
                                   })

            smach.StateMachine.add('BALL',
                                   BallHandling(),
                                   transitions={
                                       'finished': 'SELECT_SCENARIO',
                                       'failed': 'failed'
                                   })
Example #16
0
 def handle_event(self, event):
     if event.type == KEYDOWN and event.key == K_ESCAPE:
         self.game.change_scene(Intro(self.game, True))
     elif event.type == KEYDOWN and event.key == K_F10:
         self.levelFinished()
     elif event.type is MOUSEMOTION:
         pass
     elif event.type is MOUSEBUTTONDOWN:
         if event.button <> 1:
             return
         self.picker.set_position(event.pos)
         self.root_node.accept(self.picker)
         if len(self.picker.hits) > 0:
             for hit in self.picker.hits:
                 return
         else:
             h = rectaHandler(self)
             npos = self.worldPosFromMouse(event.pos)
             if self.isValid(npos):
                 self.push_handler(h(npos))
Example #17
0
    def __init__(self):
        pygame.init()
        self.settings = Settings()
        self.settings.reset()
        self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
        self.intro = Intro(self.screen, self.settings)
        self.menu = Menu(self.screen, self.settings)
        pygame.display.set_caption("Pacman Portal")

        self.maze = Maze(self.screen, mazefile='pacmap.txt')

        self.pacman = Pacman(self.screen)

        self.dashboard = Dashboard(self.screen)

        self.portal_enter = Portal("Enter", self.screen, self.settings)
        self.portal_exit = Portal("Exit", self.screen, self.settings)

        scoresheet = open('scoresheet.txt', 'r')
        self.settings.score_high = int(scoresheet.read())
    def __init__(self, game_opts):
        super(GameManager, self).__init__()

        self.scenes = FSM()

        # TODO: find a way of applying lazy initialisation
        # on level creation - a level should be created only
        # right before executed
        # flev = LevelFactory().create_level(
        #     constants.SCENES['level_one'],
        #     game_opts)
        flev = LevelFactory().create_level(constants.SCENES['level_one'])

        # set and group the scenes
        scenes = (Intro(game_opts), Menu(game_opts), flev)

        # add the scenes to the state machine
        for s in scenes:
            self.scenes.add_state(s)

        # enable the default state
        self.scenes.active_state = scenes[0]
Example #19
0
def startup_screen(config, game_stats, screen):
    """Display an introductory startup screen for the game, return False if the user wishes to quit,
    True if the user is ready to play"""
    title_screen = Intro(config, game_stats, screen)
    title_screen.prep_image()
    button = Button(config, screen, 'Play')
    intro = True

    while intro:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return False
            elif event.type == pygame.MOUSEBUTTONDOWN:
                click_x, click_y = pygame.mouse.get_pos()
                game_stats.game_active = button.check_button(click_x, click_y)
                intro = not game_stats.game_active
        screen.fill(config.bg_color)
        title_screen.show_menu()
        button.draw_button()
        pygame.display.flip()

    return True
Example #20
0
File: main.py Project: kenny8/siege
# создание поля
gf.create_fleet_enemy(background, enemy_group, stats.level)
gf.create_fleet(width_background, height_background, wall_group_up, wall_group_down, ground_group, ladder_group,
                door_group, end_group, traider_group, Wall(False).rect.h)
for sprite in wall_group_up:
    nn = sprite.rect.y
    break
player = Player(screen, screen_rect.centerx, nn)
player_group.add(player)
play_button = Button(screen, "Play", screen_rect.centerx - 100, screen_rect.centery, (100, 150, 50))
game_over_button = Button(screen, "New", screen_rect.centerx - 100, screen_rect.centery, (100, 150, 50))
quit_button = Button(screen, "quit", screen_rect.centerx - 100, screen_rect.centery + 70, (100, 150, 50))
return_intro_button = Button(screen, "return intro", screen_rect.centerx - 100, screen_rect.centery + 130,
                             (100, 150, 50))
camera = Camera()
intro = Intro(screen, stats)
shop = Shop(screen, stats)
help_image = gf.load_image('help.png')
while stats.game_active:
    # действия с квавиатуры и мыши
    gf.key_evens(screen, player, bullets, ladder_group, door_group, play_button, game_over_button, camera, stats, intro,
                 background, end_group, enemy_group, wall_group_down, wall_group_up, ground_group, quit_button,
                 return_intro_button, traider_group, shop)
    if stats.game_intro:
        # интро игры
        intro.blit()
    else:
        if stats.game_return:
            # переход через интро
            gf.new_fleet(screen, background, end_group, enemy_group, wall_group_down, wall_group_up, ladder_group,
                         ground_group, door_group, stats, player, camera, traider_group)
Example #21
0
import sys
from time import sleep
from open_file import OpenFile
import webbrowser
from git_upload import Upload
from create_file import CreateFile

print("""
||||||||  ||||      ||  ||||||||       ||||||||
||        || ||     ||  ||      ||   ||        ||
||||||||  ||  ||    ||  ||       ||  ||        ||
||        ||    ||  ||  ||      ||   ||        ||
||||||||  ||      ||||  ||||||||       ||||||||
""")

intro = Intro('https://api.jsonbin.io/b/5c26fbae412d482eae5706fc')
intro.show_details()
web_data = 'https://api.jsonbin.io/b/5c26bd046265442e46fe1f1c/3'
app_data = 'https://api.jsonbin.io/b/5c2ea1c57b31f426f8508620/5'
installer = Installer()
upload = Upload()

def endo():
    command = input()
    command = command.lower()
    if (command[:14]) == 'create project':
        website_name = command[17:]
        upload.repository_name = website_name
        data = GetData(web_data)
        if hasattr(data, 'is_loaded') and data.is_loaded == True:
            installer.run_installer(data.json_data, website_name)
Example #22
0
 def update_event(self, event):
     if event.type == KEYDOWN or event.type == MOUSEBUTTONDOWN:
         self.game.change_scene(Intro(self.game, True))
Example #23
0
import smtplib
from intro import Intro

Intr = Intro()


def send_mail(df, mail):
    port = 587  # For starttls

    # Create a secure SSL context
    s = smtplib.SMTP('smtp.gmail.com', port)

    # start TLS for security
    s.starttls()

    # Authentication
    s.login("email", "pass")

    # message to be sent
    message = df

    try:
        # sending the mail
        s.sendmail("*****@*****.**",
                   mail, str(message))
    except:
        Intr.Warnings(cmd=Intr.WRONG_EMAIL)
    finally:
        s.quit()
Example #24
0
def main():
    Intro()
Example #25
0
 def update_event(self, event):
     if event.type == KEYDOWN and event.key == K_ESCAPE:
         self.game.change_scene(Intro(self.game, True))
     elif event.type == KEYDOWN:
         self.game.change_scene(self.nextScene(self.game))
from images import Images
from maps import*
from intro import Intro
from item import*
import turtle
import math
import random
import time
import winsound

for image in Images:
    turtle.register_shape(image)

#intro screen
#------------------------------
Intro()

#main screen 
#------------------------------

wn = turtle.Screen()
wn.bgcolor("black")
wn.title("7 Dungeons Deep (7DD)")
wn.setup(1900,930)
wn.bgpic(".\\art\\background.gif")
wn.tracer(0)

particles = []

for i in range(15):
        particles.append(Particle("circle", "red", 0, 0))
Example #27
0
    def __init__(self, game):

        Scene.__init__(self, game)
        import sound

        self.root_node.background_color = (0, 0, 0, 0)
        am = self.actionManager = Manager()

        luz = self.create_image("dad.png")
        luz.translate = Point3(60, -10, 0)
        luz.scale = (12, 4.5, 0)

        dad_hi = self.createDad()
        dad_hi.translate = Point3(150, -150, 0)

        script = [
            ("- hey...", 800),
            ("where am I?", 1800),
            ("this is not home!", 2000),
            ("my teleport spell must have failed", 2000),
            ("lets try again...", 2000),
            (" ", 2000),
            ("ouch!", 1700),
            ("this didn't work", 2000),
            ("I'll get help from above", 2300),
            ("I'm going up!", 2000),
        ]

        offset = 0
        lines = []
        for line, duration in script:
            l = self.create_line(line)
            lines.append((l, offset, duration))
            offset += duration

        nube = [self.create_image("nube%i.png" % i) for i in range(1, 6)]
        [setattr(n, "translate", Point3(150, -150, 0)) for n in nube]

        dad = self.create_image("dad.gif")
        dad.translate = Point3(-350, -150, 0)

        self.accept()
        dad_hi.disable()
        luz.disable()
        [n.disable() for n in nube]
        [n.disable() for (n, a, x) in lines]

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        am.do(
            None,
            delay(20000) + call(lambda: musique("grossini talking 1.ogg")) +
            delay(10600) + call(lambda: musique("grossini talking 2.ogg")))
        am.do(
            dad,
            goto(Point3(150, -150, 0), duration=5000) +
            call(lambda: luz.enable()) +
            call(lambda: sound.playSoundFile("farol.wav", 1)) + delay(1500) +
            call(lambda: musique("Applause.wav")) + delay(2500) +
            call(lambda: dad.disable()) + call(lambda: dad_hi.enable()) +
            delay(6000) + call(lambda: sound.playSoundFile("MagiaOK.wav", 1)) +
            call(lambda: dad_hi.disable()) + delay(3000) +
            call(lambda: luz.disable()) +
            call(lambda: sound.playSoundFile("farol.wav", 1)))

        for (line, start, duration) in lines:
            am.do(
                line,
                delay(20000) + delay(start) + call(enable(line)) +
                delay(duration) + call(disable(line)))
        am.do(
            None,
            delay(20000 + 4 * 2000) +
            call(lambda: sound.playSoundFile("tomato.wav", 1)))
        am.do(
            None,
            delay(20000 + 5 * 2000) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (1, 1, 1, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (0, 0, 0, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (1, 1, 1, 0))) + delay(100) +
            call(lambda: setattr(self.root_node, "background_color",
                                 (0, 0, 0, 0))) + delay(100))

        am.do(
            None,
            delay(20000 + duration + start) +
            call(lambda: self.game.change_scene(Intro(self.game, False))))

        def enable(what):
            def doit():
                what.enable()

            return doit

        def disable(what):
            def doit():
                what.disable()

            return doit

        for i, n in enumerate(nube):
            am.do(
                n,
                delay(15500) + delay(400 * i) + call(enable(n)) + delay(400) +
                call(disable(n)))