Пример #1
0
def create_sky(root, canvas):
    #傳入依序為(窗口,桌布,SE東南,窗口寬,窗口長,標籤)
    # sky_1.nw[0], sky_1.nw[1]為sky_1第一張圖左上的座標,分別為(0,-252)此為圖像座標
    sky_1 = sky.Sky(root, canvas, config.initial_anchor_sky_1,
                    config.initial_anchor_sky_x_1,
                    config.initial_anchor_sky_y_1, "Sky01")
    #傳入依序為(窗口,桌布,SW西南,窗口寬,窗口長,標籤)

    #獲取 sky_1.nw[0], sky_1.nw[1],轉為窗寬高,以SW判斷獲取座標,並與窗寬高進行運算得sky_2.nw
    #判斷sky_2圖片會高於sky_1
    sky_2 = sky.Sky(root, canvas, tkinter.SW, sky_1.nw[0], sky_1.nw[1],
                    "Sky02")
    print("SKY1:PlaneWarFare.py,22", sky_1.nw[0], sky_1.nw[1])
    print("PlaneWarFare.py,23", sky_2.nw[0], sky_2.nw[1])
    #繪製圖(放置圖片座標 窗寬,窗長,錨定SE東南,圖片地址,圖標籤(Sky01)
    tmp_canvas_img = canvas.create_image(sky_1.anchor_x,
                                         sky_1.anchor_y,
                                         anchor=sky_1.anchor,
                                         image=sky_1.bg_image,
                                         tags=sky_1.bg_image_tags)
    print("PlaneWarFare.py 29", sky_1.anchor_x, sky_1.anchor_y)
    #傳入已設置圖片至Move.py的set_canvas_image方法
    sky_1.set_canvas_image(tmp_canvas_img)
    #繪製圖(窗口寬高  sky_1.nw[0], sky_1.nw[1] ,SW西南,同樣圖址,Sky02)
    tmp_canvas_img = canvas.create_image(sky_2.anchor_x,
                                         sky_2.anchor_y,
                                         anchor=sky_2.anchor,
                                         image=sky_2.bg_image,
                                         tags=sky_2.bg_image_tags)
    print("PlaneWarFare.py 38", sky_2.anchor_x, sky_2.anchor_y)
    print("SKY2:PlaneWarFare.py,40", sky_2.nw[0], sky_2.nw[1])

    sky_2.set_canvas_image(tmp_canvas_img)
    print("PlaneWarFare.py 41", sky_1, sky_2)
    return [sky_1, sky_2]
Пример #2
0
def main():
    pygame.init()
    screen_dim = (1360, 768)
    display = pygame.display.set_mode(
        screen_dim,
        FULLSCREEN | HWSURFACE if not sys.gettrace() else HWSURFACE)
    pygame.mouse.set_cursor((8, 8), (0, 0), (0, 0, 0, 0, 0, 0, 0, 0),
                            (0, 0, 0, 0, 0, 0, 0, 0))
    uc = snake.Snake(screen_dim[0] / 3, screen_dim[1] / 2, screen_dim[0],
                     screen_dim[1])
    clock = pygame.time.Clock()
    scene = sky.Sky(screen_dim)
    p1 = player.Player()
    paused = False

    while True:
        paused = listen_keys(p1, paused)
        if paused:
            continue

        if len(scene.enemies) < 50 and random.randint(0, 160) == 0:
            scene.inc_enemies()

        if len(scene.bubbles) == 0 and random.randint(0, 160) == 0:
            scene.inc_bubbles()

        surface = pygame.Surface(screen_dim)

        if p1.turning_left():
            uc.go_left()
        if p1.turning_right():
            uc.go_right()
        if p1.firing():
            uc.fire()
        else:
            uc.stop_firing()

        scene.update(uc.x, uc.y)

        if scene.check_hit(uc):
            uc.hit()

        if scene.check_fed(uc):
            uc.fed()

        scene.draw_background(surface)

        if p1.firing():
            line_start, line_end = uc.draw(surface)
            scene.check_targets(line_start, line_end)
        else:
            uc.draw(surface)

        scene.draw_foreground(surface)

        display.blit(surface, (0, 0))
        pygame.display.flip()

        clock.tick(100)
Пример #3
0
 def __init__(self, width, height):
     self.mWidth = width
     self.mHeight = height
     self.mBlueSky = sky.Sky(self.mWidth, self.mHeight)
     self.mGround = ground.Ground(self.mWidth, self.mHeight)
     self.mMountain = mountain.Mountain(self.mWidth, self.mHeight)
     self.mMoon = moon.Moon(self.mWidth, self.mHeight)
     self.mWater = water.Water(self.mWidth, self.mHeight)
     self.mHouse = house.House(self.mWidth, self.mHeight)
     self.mCloud = cloud.Cloud(self.mWidth, self.mHeight)
     self.mBird = bird.Bird(self.mWidth, self.mHeight)
Пример #4
0
def create_sky(root, canvas):
    sky_1 = sky.Sky(root, canvas, config.initial_anchor_sky_1,
                    config.initial_anchor_sky_x_1,
                    config.initial_anchor_sky_y_1, "Sky01")

    sky_2 = sky.Sky(root, canvas, tkinter.SW, sky_1.nw[0], sky_1.nw[1],
                    "Sky02")

    tmp_canvas_img = canvas.create_image(sky_1.anchor_x,
                                         sky_1.anchor_y,
                                         anchor=sky_1.anchor,
                                         image=sky_1.bg_image,
                                         tags=sky_1.bg_image_tags)
    sky_1.set_canvas_image(tmp_canvas_img)

    tmp_canvas_img = canvas.create_image(sky_2.anchor_x,
                                         sky_2.anchor_y,
                                         anchor=sky_2.anchor,
                                         image=sky_2.bg_image,
                                         tags=sky_2.bg_image_tags)
    sky_2.set_canvas_image(tmp_canvas_img)
    return [sky_1, sky_2]
Пример #5
0
  def StartTitleScreen(self):
    self.sky = sky.Sky(self, self.width)
    self.hill1 = hill.Hill(
      self, list(self.transition['hill1']), 0.8, 0.0, 8.0)
    self.hill2 = hill.Hill(
      self, list(self.transition['hill2']), 0.8, 0.0, 5.0)
    self.hill3 = hill.Hill(
      self, list(self.transition['hill3']), 0.6, 0.0, 2.0)
    self.grass = grass.Grass(self)

    self.AddDrawable(self.sky, 0)
    self.AddDrawable(self.hill1, 1.1)
    self.AddDrawable(self.hill2, 1.2)
    self.AddDrawable(self.hill3, 1.3)
    self.AddDrawable(self.grass, 3)

    self.flower = sapling.OldFlower(self, -0.6)
    self.AddDrawable(self.flower, 2)

    self.fader = fader.Fader(self, (0, 0, 0), 200, 500)
    self.AddDrawable(self.fader, 10)

    self.ground = None  # Created when the time comes.
Пример #6
0
 def __init__(self, width, height):
     self.mWidth = width
     self.mHeight = height
     self.mSky = sky.Sky(self.mWidth, self.mHeight)
     self.mSun = sun.Sun(0.67 * self.mWidth, 0.47 * self.mHeight,
                         (1. / 8.) * self.mHeight)
     outline = [(int(0 * self.mWidth), int(1 * self.mHeight)),
                (int(0 * self.mWidth), int((2 / 3) * self.mHeight)),
                (int(0.25 * self.mWidth), int((5 / 9) * self.mHeight)),
                (int(0.5 * self.mWidth), int((2 / 3) * self.mHeight)),
                (int((5 / 6) * self.mWidth), int((4 / 9) * self.mHeight)),
                (int(1 * self.mWidth), int((7 / 9) * self.mHeight)),
                (int(1 * self.mWidth), int(1 * self.mHeight))]
     self.mMountain = mountain.Mountain(outline)
     self.mCloud1 = cloud.Cloud(0.1 * self.mWidth, .43 * self.mHeight,
                                0.31 * self.mWidth, 0.20 * self.mHeight)
     self.mCloud1.darken()
     self.mCloud2 = cloud.Cloud(0.70 * self.mWidth, .10 * self.mHeight,
                                0.16 * self.mWidth, 0.10 * self.mHeight)
     self.mCloud3 = cloud.Cloud(0.55 * self.mWidth, .40 * self.mHeight,
                                0.40 * self.mWidth, 0.10 * self.mHeight)
     self.mCloud3.lighten()
     self.mSmallBird1 = small_bird.SmallBird(0.25 * self.mWidth,
                                             0.25 * self.mHeight,
                                             0.07 * self.mWidth,
                                             0.04 * self.mHeight)
     self.mSmallBird2 = small_bird.SmallBird(0.22 * self.mWidth,
                                             0.28 * self.mHeight,
                                             0.07 * self.mWidth,
                                             0.04 * self.mHeight)
     self.mSmallBird2.thicken()
     self.mSmallBird3 = small_bird.SmallBird(0.15 * self.mWidth,
                                             0.30 * self.mHeight,
                                             0.07 * self.mWidth,
                                             0.04 * self.mHeight)
     return
    def __init__(self,
                 log,
                 dir,
                 fgndDict=None,
                 nrealize=1,
                 nobs=1,
                 clcDet=1,
                 elv=None,
                 pwv=None,
                 specRes=1.e9,
                 foregrounds=False):
        self.log = log
        self.dir = dir
        self.configDir = dir + 'config/'
        self.name = dir.rstrip('/').split('/')[-1]

        #Store the program parameters
        params, vals = np.loadtxt(self.configDir + 'program.txt',
                                  unpack=True,
                                  usecols=[0, 2],
                                  dtype=np.str,
                                  delimiter='|')
        dict = {params[i].strip(): vals[i].strip() for i in range(len(params))}
        self.log.log(
            'Using program parameter file %s' %
            (self.configDir + 'program.txt'), 1)

        #Sample the program parameters
        def samp(param, pos=False, norm=False):
            if nrealize == 1: return param.getAvg()
            else: return param.sample(nsample=1, pos=pos, norm=norm)

        self.tobs = samp(pr.Parameter(dict['Observation Time'], un.yrToSec),
                         pos=True)
        self.fsky = samp(pr.Parameter(dict['Sky Fraction']),
                         pos=True,
                         norm=True)
        self.obsEff = samp(pr.Parameter(dict['Observation Efficiency']),
                           pos=True,
                           norm=True)
        self.netMgn = samp(pr.Parameter(dict['NET Margin']), pos=True)

        #Store sky object
        atmFile = sorted(gb.glob(self.configDir + '/atm*.txt'))
        if len(atmFile) == 0:
            atmFile = None
            self.log.log(
                "No custom atmosphere provided; using Atacama MERRA AM-simulated sky",
                1)
        elif len(atmFile) > 1:
            atmFile = None
            self.log.log(
                'More than one atm file found in %s; ignoring them all' %
                (self.configDir), 2)
        else:
            atmFile = atmFile[0]
            self.log.log("Using custom atmosphere defined in %s" % (atmFile),
                         2)
        self.sky = sk.Sky(self.log,
                          nrealize=1,
                          fgndDict=fgndDict,
                          atmFile=atmFile,
                          pwv=pwv,
                          generate=False,
                          foregrounds=foregrounds)

        #Store scan strategy object
        scanFile = sorted(gb.glob(self.configDir + '/elevation.txt'))
        if len(scanFile) == 0:
            scanDict = None
            self.log.log(
                "No scan strategy provided; using default elevation distribution",
                1)
        elif len(scanFile) > 1:
            scanDict = None
            self.log.log(
                'More than one scan strategy file found in %s; ignoring them all'
                % (self.configDir), 2)
        else:
            scanFile = scanFile[0]
            params, vals = np.loadtxt(scanFile,
                                      unpack=True,
                                      usecols=[0, 1],
                                      dtype=np.str,
                                      delimiter='|')
            scanDict = {
                params[i].strip(): vals[i].strip()
                for i in range(2, len(params))
            }
            self.log.log("Using scan strategy defined in %s" % (scanFile), 2)
        self.scn = sc.ScanStrategy(self.log, scanDict=scanDict, elv=elv)

        #Store camera objects
        cameraDirs = sorted(gb.glob(dir + '/*/'))
        cameraDirs = [x for x in cameraDirs if 'config' not in x]
        self.cameras = [
            cm.Camera(self.log,
                      dir,
                      self.sky,
                      self.scn,
                      nrealize=nrealize,
                      nobs=nobs,
                      clcDet=clcDet,
                      specRes=specRes) for dir in cameraDirs
        ]
Пример #8
0
 def generate(self):
     #Store sky and elevation objects
     self.log.log("Generating sky for telescope %s" % (self.name), 1)
     atmFile = sorted(gb.glob(os.path.join(self.configDir, 'atm*.txt')))
     if len(atmFile) == 0:
         self.atmFile = None
         self.log.log("No custom atmosphere provided.", 2)
         #Obtain site
         if self.params['Site'] == 'NA':
             self.log.log("No site provided", 0)
             sy.exit(1)
         #Obtain PWV
         if self.params['PWV'] == 'NA':
             self.params['PWV'] = None
             pwvFile = sorted(
                 gb.glob(os.path.join(self.configDir, 'pwv.txt')))
             if len(pwvFile) == 0:
                 self.log.log(
                     "No pwv distribution or value provided for telescope %s"
                     % (self.name), 0)
                 sy.exit(1)
             elif len(pwvFile) > 1:
                 self.log.log(
                     'More than one pwv distribution found for telescope %s'
                     % (self.name), 0)
                 sy.exit(1)
             else:
                 pwvFile = pwvFile[0]
                 params, vals = np.loadtxt(pwvFile,
                                           unpack=True,
                                           usecols=[0, 1],
                                           dtype=np.str,
                                           delimiter='|')
                 self.pwvDict = {
                     params[i].strip(): vals[i].strip()
                     for i in range(2, len(params))
                 }
                 self.log.log(
                     "Using pwv distribution defined in %s" % (pwvFile), 2)
         else:
             self.pwvDict = None
         #Obtain elevation
         if self.params['Elevation'] == 'NA':
             self.params['Elevation'] = None
             elvFile = sorted(
                 gb.glob(os.path.join(self.configDir, 'elevation.txt')))
             if len(elvFile) == 0:
                 self.log.log(
                     "No elevation distribution or value provided for telescope %s"
                     % (self.name), 0)
                 sy.exit(1)
             elif len(elvFile) > 1:
                 self.log.log(
                     'More than one elevation distribution found for telescope %s'
                     % (self.name), 0)
                 sy.exit(1)
             else:
                 elvFile = elvFile[0]
                 params, vals = np.loadtxt(elvFile,
                                           unpack=True,
                                           usecols=[0, 1],
                                           dtype=np.str,
                                           delimiter='|')
                 self.elvDict = {
                     params[i].strip(): vals[i].strip()
                     for i in range(2, len(params))
                 }
                 self.log.log(
                     "Using elevation distribution defined in %s" %
                     (elvFile), 2)
         else:
             self.elvDict = None
     elif len(atmFile) > 1:
         self.log.log(
             'More than one atmosphere file found for telescope %s' %
             (self.name), 0)
         sy.exit(1)
     else:
         self.atmFile = atmFile[0]
         self.params['Site'] = None
         self.params['Elevation'] = None
         self.params['PWV'] = None
         self.elvDict = None
         self.pwvDict = None
         self.log.log("Using custom atmosphere defined in %s" % (atmFile),
                      0)
     #Store sky object
     self.sky = sk.Sky(self.log,
                       nrealize=1,
                       fgndDict=self.fgndDict,
                       atmFile=self.atmFile,
                       site=self.params['Site'],
                       pwv=self.params['PWV'],
                       pwvDict=self.pwvDict,
                       foregrounds=self.fgnds)
     #Store scan strategy object
     self.log.log("Generating scan strategy for telescope %s" % (self.name),
                  1)
     self.scn = sc.ScanStrategy(self.log,
                                elv=self.params['Elevation'],
                                elvDict=self.elvDict)
     #Store camera objects
     self.log.log("Generating cameras for telescope %s" % (self.name), 1)
     cameraDirs = sorted(gb.glob(os.path.join(self.dir, '*' + os.sep)))
     cameraDirs = [x for x in cameraDirs if 'config' not in x]
     cameraNames = [
         cameraDir.split(os.sep)[-2] for cameraDir in cameraDirs
     ]
     self.cameras = {
         cameraNames[i]: cm.Camera(self.log,
                                   cameraDirs[i],
                                   self.sky,
                                   self.scn,
                                   nrealize=self.nrealize,
                                   nobs=self.nobs,
                                   clcDet=self.clcDet,
                                   specRes=self.specRes)
         for i in range(len(cameraNames))
     }
Пример #9
0
                # Be able to place different blocks depending on the number pressed
                if block_pick == 1: voxel = Voxel(position=self.position + mouse.normal,
                                                  texture=grass_texture)  # Place grass block
                if block_pick == 2: voxel = Voxel(position=self.position + mouse.normal,
                                                  texture=stone_texture)  # Place stone block
                if block_pick == 3: voxel = Voxel(position=self.position + mouse.normal,
                                                  texture=brick_texture)  # Place brick block
                if block_pick == 4: voxel = Voxel(position=self.position + mouse.normal,
                                                  texture=dirt_texture)  # Place dirt block
            if key == 'left mouse down':  # If left mouse button is pressed, destroy block
                punch_sound.play()
                while destroy(self) is True:
                    destroy(voxel)
            if key == 'space down':  # If space is pressed, jump one block
                player.y += 1
                invoke(setattr, player, 'y', player.y - 1)


# 4. Create default platform
for z in range(32):  # Creates 32 blocks on the z axis
    for x in range(32):  # Multiplies by 32 blocks on the x axis
        voxel = Voxel(position=(x, 0, z))  # Changes position of each block and creates 1024 blocks in total (32*32)

sky = sky.Sky()  # Maps the sky
hand = Hand()  # Maps the hand

player = Player()  # Maps the player to the 1st person view

# 3. Run program
app.run()
Пример #10
0
    def __init__(self, channelDict, camera, opticalChainFile, atmFile=None):
        #***** Private variables *****
        self.__mm = 1.e-03  #m from mm
        self.__GHz = 1.e+09  #GHz from Hz
        self.__aWrtHz = 1.e-18  #aW/rtHz from W/rtHz
        self.__pArtHz = 1.e-12  #pA/rtHz from A/rtHz
        self.__Hz = 1.e-09  #Hz from GHz
        self.__pW = 1.e-12  #pW from W
        self.__camera = camera
        self.__opticalChainFile = opticalChainFile
        self.__ph = ph.Physics()
        self.__sky = sky.Sky(atmFile)

        #***** Camera Parameters *****
        #Optical coupling to Focal Plane
        self.optCouple = self.__camera.opticalCouplingToFP
        #Detector F-number
        self.Fnumber = self.__camera.fnumber
        #Bath temperature
        self.Tb = self.__camera.Tb

        #***** Channel Parameters *****
        #Band ID
        self.bandID = self.__float(channelDict['BandID'])
        #Pixel ID
        self.pixelID = self.__float(channelDict['PixelID'])
        #Band Center
        self.bandCenter = self.__float(channelDict['BandCenter'], self.__GHz)
        #Fractional Bandwidth
        self.fbw = self.__float(channelDict['FBW'])
        #Pixel Size
        self.pixSize = self.__float(channelDict['PixSize'], self.__mm)
        #Number of detectors
        self.numDet = self.__float(channelDict['NumDet'])
        #Number of pixels
        self.numPix = self.numDet / 2.
        #Waist factor
        self.wf = self.__float(channelDict['WaistFact'])
        #Detector efficiency
        self.detEff = self.__float(channelDict['DetEff'])
        #Psat
        self.psat = self.__float(channelDict['Psat'], self.__pW)
        #Psat Factor
        self.psatFact = self.__float(channelDict['PsatFact'])
        #Thermal Carrier Index
        self.n = self.__float(channelDict['CarrierIndex'])
        #Transition temperature
        self.Tc = self.__float(channelDict['TransTemp'])
        if self.Tc == 'NA':
            self.TcFrac = self.__float(channelDict['TcFrac'])
            self.Tc = self.Tb * self.TcFrac
        #Photon bunching factor
        self.bunchFact = self.__float(channelDict['BunchFactor'])
        #Detector yield
        self.detYield = self.__float(channelDict['Yield'])
        #Noise equivalent current
        self.nei = self.__float(channelDict['NEI'], self.__pArtHz)
        #Number of modes
        self.nModes = self.__float(channelDict['nModes'])
        #Bolometer resistance
        self.boloR = self.__float(channelDict['boloR'])

        #***** Optical Chain *****
        self.opticalChain = oc.OpticalChain(self.__opticalChainFile,
                                            self.bandID)

        #Generate optical arrays
        self.genOptics()
Пример #11
0
    def draw(self, surface):

        # rectangle to fill the background
        # sky = pygame.Rect(0, 0, self.mWidth, self.mHeight)
        # pygame.draw.rect( surface, (66, 215, 245), sky, 0 )

        # grass = pygame.Rect( 0, self.mWidth//2, self.mWidth, self.mHeight//2)
        # pygame.draw.rect( surface, (164, 254, 66), grass, 0 )

        # must have 5/6 0f these
        # i have ract, circle, ellipse
        # rect(), polygon(), circle(), ellipse(), arc(), line()
        # Drawing the Sky 1/6 Classes complete
        theSky = sky.Sky(700, 600)
        theSky.draw(surface)

        # Drawing the Grass 2/6 Classed complete
        theGrass = grass.Grass(700, 600)
        theGrass.draw(surface)

        # Drawing the Cloud 3/6 Classed complete
        theCloud = cloud.Cloud(50, 50, 125, 75)
        theCloud.draw(surface)

        # right cloud
        theCloud2 = cloud.Cloud(500, 100, 125, 75)
        theCloud2.draw(surface)

        theSun = sun.Sun(350, 100, 70)
        theSun.draw(surface)

        house = square.Square(200, 300, 300, 190, (50, 100, 200))
        house.draw(surface)

        # surface, self.mColor, self.mPoint, 0)
        HouseRoof = roof.Roof(((170, 300), (350, 200), (530, 300)),
                              (115, 47, 0))
        HouseRoof.draw(surface)

        # door
        door = square.Square(325, 410, 50, 80, (255, 255, 255))
        door.draw(surface)

        # left window
        # self.mX, self.mY, self.mWidth, self.mHeight
        leftWindow = square.Square(242, 330, 40, 40, (255, 191, 0))
        leftWindow.draw(surface)

        # right window
        rightWindow = square.Square(420, 330, 40, 40, (255, 191, 0))
        rightWindow.draw(surface)

        # walk way
        stone1 = square.Square(333, 500, 35, 35, (90, 90, 90))
        stone1.draw(surface)

        stone2 = square.Square(333, 545, 35, 35, (90, 90, 90))
        stone2.draw(surface)

        stone2 = square.Square(333, 590, 35, 35, (90, 90, 90))
        stone2.draw(surface)

        bird1 = bird.Bird(75, 200, 50, 50)
        bird1.draw(surface)

        return
Пример #12
0
    def __init__(self, *args, **kwargs):
        super(World, self).__init__(*args, **kwargs)
        self.scale = 1.0
        self.pos = (0, 0, 0)
        self.fov = 75
        self.render_distance = 100.0
        self.window_x = 1080
        self.window_y = 720
        self.on_resize(self.window_x, self.window_y)

        glClearColor(1.0, 1.0, 1.0, 0.0)
        glEnable(GL_DEPTH_TEST)

        self.file_path = resource_path('textureImages')
        self.textures = self.load_textures()

        import random
        seed = random.randrange(1000, 9999)
        print 'seed ', seed
        shape = TerrainShape(seed=seed,
                             island_location=(0, 0),
                             size=4,
                             height=.5)
        sand = Terrain(self.textures[0], shape, size=(20, 20), resolution=1)
        self.sand = sand

        self.draw_ables = []
        self.update_ables = []
        self.control_ables = []
        self.point_ables = []
        self.draw_ables_2d = []

        self.loading = loading.Fact(self)
        self.update_ables.append(self.loading)
        self.loading_time_total = 10.0
        self.loading_time = 0.0

        fort = building.Building(sand, 1, 1, .1)
        fort_2 = building.Building(sand, 2, 1, .1)
        fort_3 = building.Building(sand, 1, 2, .2)
        fort_4 = building.Building(sand, 2, 2, .1)
        fort_outpost = building.Building(sand, -2, -2, .07)
        fort_king = building.Building(sand, 0, 0, .25)

        self.map = map.Map(self.textures[1], sand)
        self.update_ables.append(self.map)
        self.map.add_building(fort)
        self.map.add_building(fort_2)
        self.map.add_building(fort_3)
        self.map.add_building(fort_4)
        self.map.add_building(fort_outpost)
        self.map.add_building(fort_king)

        self.sky = sky.Sky(self.sand, self.textures[4])
        self.draw_ables.append(self.sky)

        self.control_able_index = 0
        self.default_controllable_index = 0

        self.camera = FpsCamera(self, self.sand)
        self.control_ables.append(self.camera)

        noob = noobie.Noob(self, self.sand, self.map.get_buildings())
        self.draw_ables.append(noob)
        self.update_ables.append(noob)

        # self.sprite = sprite.Sprite(self, self.map.land)
        # self.control_ables.append(self.sprite)
        # self.draw_ables.append(self.sprite)
        # self.update_ables.append(self.sprite)
        # self.point_ables.append(self.sprite)

        self.selector = selector.Selector(shape=sand, window=self)
        self.draw_ables.append(self.selector)
        self.update_ables.append(self.selector)

        self.input_handler = inputHandler.InputHandler()
        self.push_handlers(self.input_handler)
        self.c_bumped = self.input_handler.add_bumped(pyglet.window.key.C)
        self.v_bumped = self.input_handler.add_bumped(pyglet.window.key.V)
        self.b_bumped = self.input_handler.add_bumped(pyglet.window.key.B)
        self.n_bumped = self.input_handler.add_bumped(pyglet.window.key.N)
        self.b_switch = False
        self.period_bumped = self.input_handler.add_bumped(
            pyglet.window.key.PERIOD)
        self.comma_bumped = self.input_handler.add_bumped(
            pyglet.window.key.COMMA)

        self.reset_control()

        self.draw_number = 0  # the first rendered frame is 1

        pyglet.clock.schedule_interval(self.update, 1 / 60.0)