Example #1
0
    @property
    def image(self):
        return self.images[self.fuel]

    def push(self, direction, pusher=None):
        if isinstance(pusher, Recycle):
            self.fuel += 1
            self.world.score += self.world.combo**2 * 50
            self.world.combo += 1
            if self.fuel == len(self.images):
                self.world.replace(self, Neutralize(self.world))
            self.world.remove(pusher)

class Recycle(subjunctive.entity.Entity):
    image = subjunctive.resource.image('images/recycle.png')
    pushable = True

if __name__ == '__main__':
    world = Planet()
    cursor = Cursor(world, name="John Smith")
    world.setup(cursor)

    def move_cursor(direction):
        world.tick(cursor)
        previous_combo = world.combo
        cursor.move(direction, orient=True)
        if world.combo == previous_combo:
            world.combo = 1
    subjunctive.run(world, on_direction=move_cursor)
Example #2
0
                    num_steps+=1
                    x-=1
                    spaces[x, y] = True
        if old_num_steps != num_steps:
            s.clear()
        elif len(s) == 4:
            keepgoing =  False
            
        
        if num_steps>(width*height-20):
            keepgoing = False
 
    return spaces
        
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    args = parser.parse_args()

    grid = Grid(10, 10)
    world = World(grid)
    d = generate_level(10, 10)
    for (x, y), value in d.items():
        if not value:
            world.place(Block(world), grid.Location(x, y))
    #player = Player(world)
    #world.setup(player)

    #def move_player(direction):
        #player.move(direction, orient=True)
    subjunctive.run(world)
Example #3
0
import argparse

import subjunctive

class Player(subjunctive.entity.Entity):
    pass

class World(subjunctive.world.World):
    tile_size = (16, 16)
    window_caption = "Floorpaint"

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("level_file")
    args = parser.parse_args()

    world = World.load(args.level_file, 'levels/definitions.txt')
    player = Player(world)
    world.place(player, world.center)

    def move_player(direction):
        player.move(direction, orient=True)
    subjunctive.run(world, on_direction=move_player)
Example #4
0
        if isinstance(pusher, Recycle):
            self.fuel += 1
            self.world.score += self.world.combo**2 * 50
            self.world.combo += 1
            if self.fuel == len(self.images):
                self.world.replace(self, Neutralize(self.world))
            self.world.remove(pusher)

class Recycle(subjunctive.entity.Entity):
    image = subjunctive.resource.image('images/recycle.png')
    pushable = True

if __name__ == '__main__':
    ts = TitleScreen()
    subjunctive.scheduler.call(ts.show_continue, after='3s')
    subjunctive.run(ts, on_select=subjunctive.exit)

    while True:
        world = Planet()
        cursor = Cursor(world, name="John Smith")
        world.setup(cursor)

        def move_cursor(direction):
            world.tick(cursor)
            previous_combo = world.combo
            cursor.move(direction, orient=True)
            if world.combo == previous_combo:
                world.combo = 1

        try:
            subjunctive.run(world, on_direction=move_cursor)