def __init__(self, width, height): super().__init__(width, height) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT, BLOCK_SIZE) self.world.player.turn = 0 self.player_right_sprite = ModelSprite('images/Gunner_right.png', model=self.world.player) self.player_left_sprite = ModelSprite('images/Gunner_left.png', model=self.world.player) self.bullet_sprite = BulletSprite() self.slime_sprite = SlimeSprite() self.kingslime_sprite = KingslimeSprite() self.checkpoint_sprite = CheckpointSprite() ## if self.world.currentmap == 0: ## self.background = arcade.Sprite("images/background1.jpg") ## if self.world.currentmap == 1: ## self.background = arcade.Sprite("images/background2.png") ## if self.world.currentmap == 2: ## self.background = arcade.Sprite("images/background3.jpg") ## if self.world.currentmap == 3: ## self.background = arcade.Sprite("images/background4.png") ## self.stage_drawer = StageDrawer(self.world.stage)
def __init__(self, width, height): super().__init__(width, height) self.world = World(width, height) arcade.set_background_color(arcade.color.DARK_SLATE_GRAY) self.timer_text = None self.background = arcade.load_texture("images/background.png") self.intro = arcade.load_texture("images/intro.png") self.score_text = None self.energy_text = None self.wall_1 = ModelSprite("images/wall_01.png", model=self.world.wall_1) self.wall_2 = ModelSprite("images/wall_02.png", model=self.world.wall_2) self.wall_3 = ModelSprite("images/wall_03.png", model=self.world.wall_3) self.wall_4 = ModelSprite("images/wall_04.png", model=self.world.wall_4) self.wall_5 = ModelSprite("images/wall_05.png", model=self.world.wall_5) self.wall_6 = ModelSprite("images/wall_06.png", model=self.world.wall_6) self.wall_7 = ModelSprite("images/wall_09.png", model=self.world.wall_7) self.wall_8 = ModelSprite("images/wall_10.png", model=self.world.wall_8) self.wall_9 = ModelSprite("images/wall_09.png", model=self.world.wall_9) self.wall_10 = ModelSprite("images/wall_10.png", model=self.world.wall_10)
def __init__(self, width, height): super().__init__(width, height) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.score = 0 self.wizard_sprite = ModelSprite('images/Wizard.png', model=self.world.player) self.start_game = ModelSprite('images/Start.jpg', model=self.world.start_game) self.end = ModelSprite('images/End.jpg', model=self.world.end) self.help_button = False self.background = ModelSprite('images/RealBack_1.jpg', model=self.world.background) self.heart = ModelSprite('images/heart.png', model=self.world.heart_life) self.another_heart = ModelSprite('images/heart.png', model=self.world.another_heart) self.fire_1 = ModelSprite('images/fire.png', model=self.world.fire_1) self.fire_2 = ModelSprite('images/fire.png', model=self.world.fire_2) self.fire_3 = ModelSprite('images/fire.png', model=self.world.fire_3) self.another_fire = ModelSprite('images/fire.png', model=self.world.another_fire) self.bonus = ModelSprite('images/Bonus.png', model=self.world.bonus) self.bonus_1 = ModelSprite('images/Bonus_1.png', model=self.world.bonus_1) self.bonus_2 = ModelSprite('images/Bonus_2.png', model=self.world.bonus_2) self.zombie = ModelSprite('images/Zombie.png', model=self.world.zombie) self.grim = ModelSprite('images/Ghost_1.png', model=self.world.grim) self.ghost = ModelSprite('images/Ghost_2.png', model=self.world.ghost) self.witch = ModelSprite('images/Witch.png', model=self.world.witch) self.TinkerBell = ModelSprite('images/Tinker_Bell.png', model=self.world.TinkerBell) self.Ariel = ModelSprite('images/Royal_3.png', model=self.world.Ariel) self.help = ModelSprite('images/Help.jpg', model=self.world.help)
def test_agent_move_south(self): world = World(10, 5) agent = Agent(0) agent.direction = Direction.SOUTH agent.move = True world.agents[(0, 4)] = agent self.assertEqual(world.agents[(0, 4)], agent, '(0) world incorrectly set agent position') world.update() self.assertTrue((0, 4) not in world.agents, 'agent not moved from previous location') self.assertEqual(world.agents[(0, 3)], agent, '(1) world incorrectly updated to move agent South') world.update() self.assertEqual(world.agents[(0, 2)], agent, '(2) world incorrectly updated to move agent South') world.update() self.assertEqual(world.agents[(0, 1)], agent, '(3) world incorrectly updated to move agent South') world.update() self.assertEqual(world.agents[(0, 0)], agent, '(4) world incorrectly updated to move agent South') world.update() self.assertEqual( world.agents[(0, 4)], agent, '(5) world incorrectly updated to move agent South (wrap)') self.assertEqual(len(world.agents), 1, 'World has incorrect number of agents')
def on_mouse_release(self, x, y, button, modifiers): if const.GAME_STATE != 1: self.world = World() self.worldRenderer = WorldRenderer(self.world) const.GAME_STATE = 1 else: self.world.on_mouse_release(x, y, button)
def test_agent_move_east(self): world = World(5, 10) agent = Agent(0) agent.direction = Direction.EAST agent.move = True world.agents[(0, 0)] = agent self.assertEqual(world.agents[(0, 0)], agent, '(0) world incorrectly set agent position') world.update() self.assertTrue((0, 0) not in world.agents, 'agent not moved from previous location') self.assertEqual(world.agents[(1, 0)], agent, '(1) world incorrectly updated to move agent East') world.update() self.assertEqual(world.agents[(2, 0)], agent, '(2) world incorrectly updated to move agent East') world.update() self.assertEqual(world.agents[(3, 0)], agent, '(3) world incorrectly updated to move agent East') world.update() self.assertEqual(world.agents[(4, 0)], agent, '(4) world incorrectly updated to move agent East') world.update() self.assertEqual( world.agents[(0, 0)], agent, '(5) world incorrectly updated to move agent East (wrap)') self.assertEqual(len(world.agents), 1, 'World has incorrect number of agents')
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.WHITE) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.spot_sprite = ModelSprite('pacman.png', model=self.world.spot)
def start(self): self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.offset = 0 self.credit_offset = 0 self.check_credit = False self.arrows = [] self.fires = [] self.numArrow = 5 self.bottomFires = [] self.background = arcade.load_texture( ".././images/Back ground/sky.jpg") for i in range(self.numArrow): self.arrows.append(ArrowSprite(model=self.world.arrow[i])) self.arrow_sprite = self.arrows for n in range(self.world.fireNumbers): self.fires.append(FireSprite(model=self.world.fire[n])) self.fire_sprite = self.fires for i in range(10): self.bottomFires.append(BottomFire(model=self.world.bottomfire[i])) self.bottomfires_sprite = self.bottomFires self.player_sprite = PlayerSprite(model=self.world.player)
def CreateWorld(): if 'file' not in request.files: return Response('no file found', status=400) file = request.files['file'] if not allowed_file(file.filename): return Response('invalid file type', status=400) try: campaignName = Campaign.query.get( request.form['campaign_id']).name.replace(' ', '_') newWorld = World( request.form['name'] or None, f'/mediafiles/campaigns/{campaignName}/{secure_filename(file.filename)}', request.form['center_lat'], request.form['center_lng'], request.form['radius'], request.form['campaign_id'] or None) db.session.add(newWorld) db.session.commit() os.makedirs( f'/usr/src/app/mediafiles/campaigns/{campaignName}/{newWorld.name.replace(" ", "_")}', exist_ok=True) file.save(f'/usr/src/app{newWorld.image}') data = jsonify(newWorld.to_dict()) data.status_code = 201 return data except (IntegrityError, AttributeError) as error: return Response(error.args[0], status=400)
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.snake_sprite = SnakeSprite(self.world.snake) self.heart_sprite = ModelSprite('images/heart.png', model=self.world.heart)
def setup(self): self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.coin = arcade.load_texture('pic/coin.png') self.skull = arcade.load_texture('pic/skull-model.png') self.walk = arcade.load_texture('pic/sandHalf.png') self.panda_sprite = self.panda() self.backsprite = self.back()
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.world = World(width, height) self.ship_sprite = ModelSprite('img/ship.png', model=self.world.ship)
def setup(self): arcade.set_background_color(arcade.color.BLACK) self.total_time = 0.0 self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.knife_sprite = ModelSprite('images/knife.png', model=self.world.knife) self.knife_sprite2 = ModelSprite('images/knife.png', model=self.world.knife2) self.knife_sprite3 = ModelSprite('images/knife.png', model=self.world.knife3) self.knife_sprite4 = ModelSprite('images/knife.png', model=self.world.knife4) self.knife_sprite5 = ModelSprite('images/knife.png', model=self.world.knife5) self.knife_sprite6 = ModelSprite('images/knife.png', model=self.world.knife6) self.knife_sprite7 = ModelSprite('images/knife.png', model=self.world.knife7) self.knife_sprite8 = ModelSprite('images/knife.png', model=self.world.knife8) self.knife_sprite9 = ModelSprite('images/knife.png', model=self.world.knife9) self.knife_sprite10 = ModelSprite('images/knife.png', model=self.world.knife10) self.target_sprite = ModelSprite('images/target.png', model=self.world.target)
def setUp(self): app = create_app(test_config) with app.app_context(): db.drop_all() db.create_all() self.app = app.test_client() self.app_context = app.app_context() self.app_context.push() guild = Guild('Flames of Exile') db.session.add(guild) db.session.commit() foe_guild = db.session.query(Guild).filter_by( name='Flames of Exile').first() admin = User('DiscordBot', sha256_crypt.encrypt('admin'), foe_guild.id, User.Role.ADMIN) admin.discord_confirmed = True db.session.add(admin) db.session.commit() campaign = Campaign('campaign_name', '/mediafiles/campaigns/campaign.png', True) db.session.add(campaign) db.session.commit() world = World('world_name', '/mediafiles/campaigns/campaign_name/world.png', 1, 1, 1, 1) db.session.add(world) db.session.commit() pin = Pin(1, 1, Pin.Symbol.ANIMAL, Pin.Resource.WOLF, 1, 1, '', 1, 1, 'notes', 1, 1) db.session.add(pin) db.session.commit() edit = Edit("", 1, 1) db.session.add(edit) db.session.commit() event = Event('event', 'game', datetime.datetime.now().isoformat(), 'note') db.session.add(event) db.session.commit() self.DEFAULT_GUILD = guild self.DEFAULT_USER = admin self.DEFAULT_CAMPAIGN = campaign self.DEFAULT_WORLD = world self.DEFAULT_PIN = pin self.DEFAULT_TOKEN = f'Bearer {self.login("DiscordBot", "admin").get_json()["token"]}' self.DEFAULT_EVENT = event self.maxDiff = None self.assertEqual(app.debug, False)
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.ship_sprite = arcade.Sprite('images/ship.png') self.world = World(width, height)
def __init__(self, width, height): super().__init__(width, height, "TaLaLap") self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.coin_list = self.world.coin_list self.plus_dam = arcade.Sprite("images/DoubleDam.png", scale=0.7) self.double_dam = arcade.Sprite("images/DoubleDamT.png", scale=0.7) self.plus_dam.set_position(SCREEN_WIDTH - 40, SCREEN_HEIGHT - 385) self.double_dam.set_position(SCREEN_WIDTH - 100, SCREEN_HEIGHT - 385)
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.GRAY) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.dot_sprite = ModelSprite('images/dot.png', model=self.world.dot)
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.world = World(width, height) #new object เป็นobject class World self.ship_sprite = ModelSprite('images/ship.png', model=self.world.ship) self.gold_sprite = ModelSprite('images/gold.png', model=self.world.gold)
def setup(self, width, height): arcade.set_background_color(arcade.color.BLACK) self.world = World(width, height) self.background_texture = arcade.load_texture('images/background.png') self.dragon_sprite = ModelSprite('images/dragon.png', model=self.world.dragon) self.man_texture = arcade.load_texture('images/man.png') self.steak_texture = arcade.load_texture('images/steak.png') self.fire_texture = arcade.load_texture('images/fire.png')
def start(self): self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.dot_sprite = ModelSprite('images/1.png', model=self.world.player) self.pillar_pair_sprites = [ PillarPairSprite(model=self.world.pillar_pairs[0]), PillarPairSprite(model=self.world.pillar_pairs[1]) ]
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.WHITE) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.pacman_sprite = ModelSprite('images/pacman.png', model=self.world.pacman) self.maze_drawer = MazeDrawer(self.world.maze)
def __init__(self, width, height): super().__init__(width, height) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) arcade.set_background_color(arcade.color.WHITE_SMOKE) self.pan = ModelSprite('images/handpan3.png', model=self.world.pan) self.circle = ModelSprite('images/cir.png', model=self.world.circle) self.spoon = ModelSprite('images/spoon.png', model=self.world.spoon)
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.world = World(width, height) self.ship_sprite = ModelSprite('image/ship',model=self.world.ship) self.gold_sprite = ModelSprite('image/gold.png',model=self.world.gold) self.asteroid_sprites = [] for asteroid in self.world.asteroids: self.asteroid_sprites.append(ModelSprite('image/ship',scale=0.5,model=asteroid))
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.WHITE) self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.dot_sprite = ModelSprite('images/dot.png', model=self.world.player) self.pillar_pair_sprite = PillarPairSprite( model=self.world.pillar_pair)
def game_setup(self, width, height): self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.background_sprite = ModelSprite("images/Background.png", model=self.world.background) self.background_sprite2 = ModelSprite("images/Background.png", model=self.world.background2) self.car_sprite = ModelSprite(self.cartexture, model=self.world.car) self.enemylist = [] self.fpscounter = Fpscounter() self.set_update_rate(1/70)
def init_world(): """Make a new world for this session and save it. We save and load the world as pickles (it's a hackathon!).""" world_id = uuid.uuid4() print("Initialising world %s" % world_id) random.seed(time.time()) solar_generation = pd.read_pickle("march9-9to16-8by8.pickle").forecast stations = init_charging_stations() world = World(solar_generation, stations) session["world_id"] = world_id save_world(world)
def __init__(self, width, height): super().__init__(width, height) self.world = World() self.worldRenderer = WorldRenderer(self.world) self.src = [ "images/start.fw.png", "images/board.fw.png", "images/win.fw.png", "images/lose.fw.png" ] self.texture = [] for src in self.src: self.texture.append(arcade.load_texture(src))
def restart(self): self.car_list = [] self.world = World(SCREEN_WIDTH, SCREEN_HEIGHT) self.background = arcade.load_texture("Wallpaper2.jpg") self.spot_sprite = Spot(100, 50, angle=0) self.spot_sprite.add_texture('car_move.png') self.world.add_car(self.spot_sprite) park_car_list = ['parking_car1.png', 'parking_car2.png'] for i in self.world.car_park: self.car_list.append( ModelSprite(random.choice(park_car_list), model=i))
def __init__(self, width, height): super().__init__(width, height) arcade.set_background_color(arcade.color.BLACK) self.world = World(width, height) self.player_sprite = ModelSprite('images/jar1.png', model=self.world.player) self.background = arcade.load_texture("images/background.jpg") self.bullet_sprites = [] self.current_state = GAME_MENU
def test_agent_collisions2(self): world = World(5, 5) # agent moving north agentN = Agent(0) agentN.direction = Direction.NORTH agentN.move = True # agent moving south agentS = Agent(1) agentS.direction = Direction.SOUTH agentS.move = True # agent moving east agentE = Agent(2) agentE.direction = Direction.EAST agentE.move = True # agent moving west agentW = Agent(3) agentW.direction = Direction.WEST agentW.move = True # setup world.agents[(2, 0)] = agentN world.agents[(2, 4)] = agentS world.agents[(1, 1)] = agentE world.agents[(3, 1)] = agentW # update & test world.update() self.assertEqual(world.agents[(2, 1)], agentN, '(1) world incorrectly updated north agent') self.assertEqual(world.agents[(2, 3)], agentS, '(1) world incorrectly updated south agent') self.assertEqual(world.agents[(1, 1)], agentE, '(1) world incorrectly updated east agent') self.assertEqual(world.agents[(3, 1)], agentW, '(1) world incorrectly updated west agent') world.update() self.assertEqual(world.agents[(2, 2)], agentN, '(2) world incorrectly updated north agent') self.assertEqual(world.agents[(2, 3)], agentS, '(2) world incorrectly updated south agent') self.assertEqual(world.agents[(2, 1)], agentE, '(2) world incorrectly updated east agent') self.assertEqual(world.agents[(3, 1)], agentW, '(2) world incorrectly updated west agent') world.update() self.assertEqual(world.agents[(2, 2)], agentN, '(3) world incorrectly updated north agent') self.assertEqual(world.agents[(2, 3)], agentS, '(3) world incorrectly updated south agent') self.assertEqual(world.agents[(2, 1)], agentE, '(3) world incorrectly updated east agent') self.assertEqual(world.agents[(3, 1)], agentW, '(3) world incorrectly updated west agent') self.assertEqual(len(world.agents), 4, 'World has incorrect number of agents')