def run(): "Función principal del programa." dir = director.Director() scene = presents_scene.PresentsScene(dir, 0) dir.change_scene(scene) dir.loop()
def main(): dir = director.Director() scene1 = sceneHome.SceneHome(dir) dir.change_scene(scene1) scene2 = sceneGame.SceneGame(dir) dir.loop()
def __init__(self) -> None: pyxel.init(120, 120, caption="Rogue like", fps=60) pyxel.image(0).load(0, 0, "resource/character.png") pyxel.image(1).load(0, 0, "resource/mapchip.png") self.director = director.Director() #self.director.set_scene(game_scene.GameScene(self.director)) self.director.set_scene(TitleScene(self.director))
def __init__(self): self.level = None self.difficulty = 4 self.points = 0 self.director = director.Director(self, { 'title' : 'Ninth Kind', 'show_fps' : False}) self.music = data.load_sound('intro.ogg') self.channel = None
import director alto = 400 ancho = 600 direct = director.Director('Nave Alien', (ancho, alto)) direct.agregarEscena('Nivel1') direct.ejecutar('Nivel1')
import pygame class TestTextScene(scene.Scene): """Un escena de prueba para el modulo de fuentes.""" def __init__(self, director): scene.Scene.__init__(self, director) self.font = utils.load_font("FreeSans.ttf", 30) self.message, rect = utils.render_text("Una linea\nDos\nTres", self.font) def on_update(self): pass def on_draw(self, screen): screen.blit(self.message, (200, 200)) pass def on_event(self, event): if event.type == pygame.QUIT: self.director.quit() elif event.type == pygame.KEYDOWN: self.director.quit() if __name__ == '__main__': dir = director.Director() scene = TestTextScene(dir) dir.change_scene(scene) dir.loop()
def setUp(self): self.nm = director.Director(TESTER, DESCR, EMAIL)
def __init__(self, images, screen, clock, iFace, FX, iH, titleScreen, SFX, myWorldBall, loadTicker=None, loadHero=None, loadWorld=None, loadDirector=None): self.Display = display.Display(screen, images) self.FX = FX self.SFX = SFX if loadTicker is None: self.Ticker = ticker.Ticker() else: self.Ticker = loadTicker if loadDirector is None: self.Director = director.Director() else: self.Director = loadDirector self.myMenu = menu.menu(screen, iH, self.Display, iFace, FX, SFX) #self.levelDepth = levelDepth self.inputHandler = iH FX.displayLoadingMessage(titleScreen, 'Loading world...') # myWorldBall is the game world which always is loaded # loadWorld is the levels which have been generated ingame and saved self.myMap = None if loadWorld is None: self.myWorld = world.World('game', myWorldBall) self.myMap = self.myWorld.initialMap self.myWorld.currentMap = self.myMap (x, y) = self.myMap.heroStart self.myHero = hero.hero(loadHero, (x * const.blocksize, y * const.blocksize)) else: self.myWorld = world.World('game', myWorldBall, loadWorld) self.myMap = self.myWorld.currentMap self.myHero = hero.hero(loadHero) FX.displayLoadingMessage(titleScreen, 'Loading game engine...') self.NPCs = [] self.screen = screen self.gameBoard = pygame.Surface([300, 300]) #self.gameBoard = self.gameBoard.convert(32) #this is true while player is in a particular game self.gameOn = True self.DIM = const.DIM self.myInterface = iFace self.addShops() self.addNPCs(self.myMap) self.myBattle = battle.battle(self.screen, iH, self.myMenu) self.clock = clock self.inputHandler = iH self.state = 'overworld' self.won = False
First, a few handler functions are defined. Then, those functions are passed to the Dispatcher and registered at their respective places. Then, the bot is started and runs until we press Ctrl-C on the command line. Usage: Basic Echobot example, repeats messages. Press Ctrl-C on the command line or send a signal to the process to stop the bot. """ from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from logger import * import urllib.request as req import director import argparse dire = director.Director() # Define a few command handlers. These usually take the two arguments bot and # update. Error handlers also receive the raised TelegramError object in error. def start(bot, update): update.message.reply_text('Hi!') def help(bot, update): update.message.reply_text('Help!') def echo(bot, update): update.message.reply_text(update.message.text) print(update.message.text)