Exemplo n.º 1
0
def main(mainpath):

    # Initialise pygame
    pygame.init()
    pygame.mixer.init()
    pygame.mouse.set_visible(False)
    
    # start up director
    framerate = 30
    screen_res = (850,480)
    window_title = "Waverider"
    dir = GameDirector(window_title, screen_res, framerate)
    
    # Load resources
    resources.init(mainpath,screen_res)
    
    # Load game scenes
    titlescreen = game.TitleScreen(dir, screen_res)
    dir.addscene('titlescreen', titlescreen)
    maingame = game.MainGame(dir, screen_res)
    dir.addscene('maingame', maingame)
    
    # start up director
    dir.change_scene('titlescreen', [])
    #dir.change_scene('maingame', [])
    dir.loop()
def main(mainpath):

    # Initialise pygame
    pygame.init()
    pygame.mixer.init()

    # start up director
    framerate = 30
    screen_res = (800, 600)
    window_title = "Pyweek27: Breakout Blue (Team Chimera)"
    dir = GameDirector(window_title, screen_res, framerate)

    # Load resources
    resources.init(mainpath, screen_res)

    # Load game scenes
    maingame = game.MainGame(dir, screen_res)
    maingame.savepath = os.path.join(mainpath, 'data', 'saved_progress.txt')
    dir.addscene('maingame', maingame)

    pausescene = game.PauseScreen(dir, screen_res)
    dir.addscene('pausescene', pausescene)
    maingame.h_pausescene = pausescene
    pausescene.h_maingame = maingame

    titlescene = game.TitleScreen(dir, screen_res)
    titlescene.savepath = os.path.join(mainpath, 'data', 'saved_progress.txt')
    titlescene.h_maingame = maingame
    dir.addscene('titlescene', titlescene)

    cutscene = game.CutScene(dir, screen_res)
    dir.addscene('cutscene', cutscene)

    # start up director
    #dir.change_scene('maingame', [True, 'testbig003'])
    #dir.change_scene('maingame', [True, 'level3'])
    #dir.change_scene('titlescene', [])
    dir.change_scene('cutscene', ['team_chimera', 'none', 'titlescene', []])
    #dir.change_scene('cutscene', ['news002','tense_chase','titlescene',[]])
    dir.loop()
Exemplo n.º 3
0
import coloredlogs, logging
import config
import resources
import database
import antiflood

from telegram.ext import Filters

import transcriberbot
from transcriberbot import TranscriberBot

coloredlogs.install(
    level='DEBUG',
    fmt=
    '%(asctime)s - %(name)s - %(levelname)s - %(filename)s [%(funcName)s:%(lineno)d] - %(message)s'
)
logger = logging.getLogger(__name__)

if __name__ == '__main__':
    config.init('../config')
    resources.init("../values")
    antiflood.init()
    transcriberbot.init()
    database.init_schema(config.get_config_prop("app")["database"])

    TranscriberBot.get().start(config.get_config_prop("telegram")["token"])
Exemplo n.º 4
0
def start():
    global scroller
    global game
    global collision_map

    resources.init()

    #Setup the game
    #The scene structure is like this:
    #Scene
    #  ScrollingManager
    #    ScrollingLayer
    #      Batch
    #    TileMap
    #  Layer
    #    Controls
    #    Gui

    scroller = cocos.layer.ScrollingManager()
    scrolling_layer = cocos.layer.ScrollableLayer()
    scroller.s_layer = scrolling_layer  # TODO: Ugh it reeks of nastiness
    layer = cocos.layer.Layer()
    game = Game()

    lvl = level.BasicLevel()
    game.set_level(lvl)
    audio.play_music()

    #load game data
    entity.load_data()

    batch = cocos.batch.BatchNode()
    game.sprite_batch = batch
    scrolling_layer.add(batch)

    #load the map
    background, collision_map = tilemap.init()
    scroller.add(background, z=-2)
    scroller.add(collision_map, z=-1)
    scroller.add(scrolling_layer)

    #initalize the pathfinding map
    collision.init_collision(collision_map)

    #initalize the general collision system
    grid = collision.get_map_grid()
    for x, i in enumerate(grid):
        for y, tile in enumerate(i):
            if tile:
                # TODO: non-static tile width/height
                scale = 64.0 / constants.PIXEL_TO_METER
                body = game.collision_world.CreateStaticBody(
                    position=(x * scale, y * scale),
                    userData = {"type": "wall",
                                "friendly": False,
                                "mask_collision": 0b110,
                                "mask_event": 0b000}
                )
                body.CreatePolygonFixture(box=(scale/2.0, scale/2.0))

    #add an enemy for testing purposes
    #enemy = entity.get_entity_type("basicenemy")()
    #enemy.position = Vector2(100, 100)
    #enemy.movement_speed = 0.35
    #game.spawn(enemy)

    #Setup controls
    import interface.controls  # TODO: Add init functions for modules so late import isnt needed

    interface.gui.init()  # TODO: Figure out why it has to go here instead of earlier

    c = interface.controls.init()
    layer.add(c)

    scrolling_layer.schedule(game.update)
    #scrolling_layer.schedule(game.update_render)

    #Load the gui
    game.gui = interface.gui.Gui()  # TODO: would be better to have this is instance in the interface package
    layer.add(game.gui)
    game.gui.log.add_message("Welcome to RPGame.")
    return game, layer, scroller
Exemplo n.º 5
0
import discord
from discord.ext import commands
import resources
from settings import botToken

initial_extensions = [
    'cogs.' + name for name in
    ['owner', 'match-result-posting', 'error-reporting', 'twitch-pickem']
]

if __name__ == '__main__':
    resources.init()
    bot = commands.Bot(command_prefix='!')
    for extension in initial_extensions:
        bot.load_extension(extension)
        print(f'Loaded \'{extension}\'')

    @bot.event
    async def on_ready():
        print(
            f'Logged in as: {bot.user.name} - {bot.user.id}\nVersion: {discord.__version__}'
        )

    @bot.event
    async def on_error(event, *args, **kwargs):
        """Handle these types of errors in the error-handling cog if the cog is loaded."""
        try:
            cog = bot.cogs['ErrorReportingCog']
            await cog.on_error(event, *args, **kwargs)
        except KeyError:
            return
Exemplo n.º 6
0
def on_init():
    resources.init()