示例#1
0
    def __init__(self, screen, background, capture, ref_img, transform_mat, wins, players_height):
        self.wins = wins
        self.players_height = players_height
        State.__init__(self, screen, background, capture, ref_img, transform_mat)
        self.times = []

        print "GameState: Initialized"
示例#2
0
 def __init__(self):
     State.__init__(self)
     self.cardtype = 'state'
     self.base = 'nocturne'
     self.desc = "At the start of your turn, you may discard a card to receive a Boon."
     self.name = "Lost in the Woods"
     self.unique_state = True
	def __init__(self, main):
		# transition from another state
		State.__init__(self,main)
		self.loadPlayer()
		self.hud = Actor(IMG_HUD,-1)
		self.hud2 = Actor(IMG_HUD2)
		self.hud.setPos(32,HEIGHT/2)
		self.hud2.setPos(WIDTH-32,HEIGHT/2)
		GameState.guiGroup.add(self.hud)
		GameState.guiGroup.add(self.hud2)
		self.health = 7
		self.hudHearts = []
		self.hudHeartsHalf = Actor(IMG_HEART2,-1)
		self.hudSlot = [None]*3
		self.wl = WorldLoader('new.world')	
		self.background = TerrainLayer("0_0.map")
		self.currentMap = "0_0.map"
		for i in range(0,3):
			self.hudSlot[i] = Actor(IMG_SLOT,-1)
			self.hudSlot[i].setPos(50,120+i*120)
			self.guiGroup.add(self.hudSlot[i])
			
		self.updateHudHealth()

		pygame.mixer.init()
		filename = "worldAmbient.mp3"
		path = os.path.join(util.GAME_SOUNDS, filename)
		path = util.filepath(path)
		pygame.mixer.music.load(path)
		pygame.mixer.music.play()
示例#4
0
    def __init__(self, screen, background, capture, ref_img, transform_mat):
        State.__init__(self, screen, background, capture, ref_img, transform_mat)
        self.ready = False
        self.should_draw_bounding_box = True
        self.player1_rect = pygame.rect.Rect((10, 100, 300, common.RESOLUTION[1] - 100))
        self.player2_rect = pygame.rect.Rect((common.RESOLUTION[0] - 310, 100, 390, common.RESOLUTION[1] - 100))
        self.special_detection_rects += (self.player1_rect, self.player2_rect)
        self.mask = StageMask(self.player1_rect, self.player2_rect)
        self.title = common.FloatingWord(common.load_image('geekfighter.png', alpha = True)[0], center = (common.RESOLUTION[0] / 2, 154), sfx = 'opening.wav')
        self.title.start_size = (19, 10)
        self.title.end_size = (600, 308)
        self.title.anim_time = 2000
        self.title.wait_forever = True
        self.sprites.add(self.title)
        self.explanations1 = common.HelpText((common.RESOLUTION[0] / 2, 330), 'Stand facing each other', self.font, (210, 0, 0), pos_is_center = True)
        self.explanations2 = common.HelpText((common.RESOLUTION[0] / 2, 370), 'in your FIGHTING STANCE', self.font, (210, 0, 0), pos_is_center = True)
        self.explanations3 = common.HelpText((common.RESOLUTION[0] / 2, 410), 'and HOLD STILL for 5 seconds', self.font, (210, 0, 0), pos_is_center = True)
        
        self.player1_counter = 0
        self.player1_heights = []
        self.player2_counter = 0
        self.player2_heights = []

        self.readybar1 = ReadyBar((10, 89), self.INIT_TIME)
        self.readybar2 = ReadyBar((common.RESOLUTION[0] - 310, 89), self.INIT_TIME)        

        self.last_time = pygame.time.get_ticks()        
##        self.text = self.font.render("Players, stand facing each other with your arms at your sides", 1, (10, 10, 10))
##        self.pos = (self.screen.get_width() / 2 - self.text.get_width() / 2, self.screen.get_height() / 10)
##        self.text2 = self.font.render("Press the SPACEBAR when ready...", 1, (10, 10, 10))
##        self.pos2 = (self.screen.get_width() / 2 - self.text2.get_width() / 2, self.screen.get_height() / 10 + self.text.get_height() + 5)
        print "TutorialState: Initialized"
示例#5
0
 def __init__(self, stack, updater):
     State.__init__(self, stack)
     
     self.title  = 'power'
     self.modes  = 'shutdown reboot restart'.split(' ')
     self.updater = updater    
     self.scroller = Scroller(self.modes)
示例#6
0
 def __init__(self):
     State.__init__(self)
     self.cardtype = 'state'
     self.base = 'nocturne'
     self.desc = "-2 VP"
     self.name = "Miserable"
     self.victory = -2
示例#7
0
	def __init__(self, tankWorld, tracking_name, position=Vec3(0,0,0), name='PadState', size=Vec3(2,2,2)):
		'''
			TrackingObject is the world object that we are tracking
			Position trigger has a representation needs to be added.

		'''
		State.__init__(self,tankWorld)

		#grab the object with this name
		for child in tankWorld.render.getChildren():
			if child.getName() == tracking_name:
				self.tracking_object = child

		self.position = position+Vec3(0,0,.01)
		self.tracking_name = tracking_name
		self.size = size
		#print "PositionTrigger.__init__: Trigger created"
		assert(self.tracking_object, "No tracking object")

		cm=CardMaker('')
		cm.setFrame(0,1,0,1)
		self.floor = render.attachNewNode(PandaNode("padCollision"))
		self.floor.setPos(self.position)

		tex = loader.loadTexture('media/'+'trigger.png')
		tex.setMagfilter(Texture.FTNearest)
		tex.setMinfilter(Texture.FTNearest)
		for y in range(int(size.getX())):
			for x in range(int(size.getY())):
				nn = self.floor.attachNewNode(cm.generate())
				nn.setP(-90)
				nn.setPos((x), (y), 0)
		self.floor.setTexture(tex)
示例#8
0
 def __init__(self, stack, updater, camera):
     State.__init__(self, stack)
     self.updater = updater
     self.camera = camera
     self.title  = 'main'
     self.modes  = 'clean overview setproperty guide player power'.split(' ')
     self.scroller = Scroller(self.modes, 0, self.on_mode_change)
     self.overview = False        
示例#9
0
    def __init__(self, value, data, grammar, hole_penalty=None, **kwargs):
        """
        Initializer. The hole_penalty is a dictionary from nonterminals to
        """

        State.__init__(self, value, **kwargs)

        self.data = data
        self.grammar = grammar
        self.hole_penalty = hole_penalty
        assert self.hole_penalty is not None # Need this!
示例#10
0
 def __init__(self, menu, rememberPosition = False):
     State.__init__(self)
     self.menu = menu
     self.choice = 0
     self.rememberPosition = rememberPosition
     
     self.timer = 0.
     self.random_color = (randint(0,255), randint(0,255), randint(0,255))
     self.random_pos = (randint(0,screen_size[0]-1), randint(0,screen_size[1]-1))
     self.random_size = (screen_size[0]-1-randint(self.random_pos[0],screen_size[0]-1),
                         screen_size[1]-1-randint(self.random_pos[1],screen_size[1]-1))
示例#11
0
    def __init__(self, value, data, grammar, hole_penalty=None, **kwargs):
        """
        Initializer. The hole_penalty is a dictionary from nonterminals to
        """

        State.__init__(self, value, **kwargs)

        self.data = data
        self.grammar = grammar
        self.hole_penalty = hole_penalty
        assert self.hole_penalty is not None  # Need this!
示例#12
0
    def __init__(self, screen, background, capture, ref_img, transform_mat):
        State.__init__(self, screen, background, capture, ref_img, transform_mat)
        self.one = FloatingWord(common.load_image("1.png", alpha=True)[0], sfx="one.wav")
        self.two = FloatingWord(common.load_image("2.png", alpha=True)[0], sfx="two.wav")
        self.three = FloatingWord(common.load_image("3.png", alpha=True)[0], sfx="three.wav")
        self.fight = FloatingWord(common.load_image("fight.png", alpha=True)[0], sfx="fight.wav")
        self.fight.end_size = (200, 200)
        self.fight.anim_time = 1000
        self.fight.wait_time = 100
        self.sprites.add(self.three)

        print "CountdownState: Initialized"
示例#13
0
 def __init__(self, stack, camera):
     State.__init__(self, stack)
     self.camera = camera
     self.title  = 'setproperties'
     
     self.settings_menu = []     
     
     for setting in CameraSettings.camera_settings:        
         menuitem = setting['key']
         self.settings_menu.append(menuitem)
         
     self.scroller = Scroller(self.settings_menu)
示例#14
0
 def __init__(self, stack, camera, propertykey):
     State.__init__(self, stack)
     self.camera = camera
     self.propertykey = propertykey        
     self.title  =  propertykey
     self.property = camera.get_property( propertykey )
     self.actual_camera_settings = utils.load_camera_settings()
     self.original_value = camera.get_property_value( propertykey ) 
                             
     if self.property['type'] == 'select':
         self.scroller = Scroller(self.property['values'], 
                 self.property['values'].index(camera.get_property_value(propertykey)) )
     pygame_utils.change_to_stripe()
示例#15
0
    def __init__(self, info):
        #info['income']  = int(round(np.random.normal(self.income_avg, self.income_std)))
        tmp1 = int(round(np.random.normal(self.income_avg, self.income_std)))
        info['income'] = tmp1
        print(" avg    = ", self.income_avg)
        print(" std    =  ", self.income_std)
        print(" income =  ", tmp1)

        #info['expense'] = round( self.income_avg-200, self.income_std)
        #tmp2 = round( self.income_avg-200, self.income_std)
        tmp2 = self.income_avg - 200
        info['expense'] = tmp2
        print(" avg     = ", self.income_avg - 200)
        print(" std     =  ", self.income_std)
        print(" expense =  ", tmp2)

        print info
        State.__init__(self, info)
示例#16
0
文件: Driver.py 项目: SimionZafiu/1NG
  def __init__(self,  info):
    #info['income']  = int(round(np.random.normal(self.income_avg, self.income_std)))
    tmp1 = int(round(np.random.normal(self.income_avg, self.income_std)))
    info['income']  = tmp1
    print (" avg    = ",  self.income_avg )
    print (" std    =  ", self.income_std )
    print (" income =  ", tmp1 )

    #info['expense'] = round( self.income_avg-200, self.income_std)
    #tmp2 = round( self.income_avg-200, self.income_std)
    tmp2 =  self.income_avg - 200
    info['expense'] = tmp2
    print (" avg     = ",  self.income_avg - 200 )
    print (" std     =  ", self.income_std )
    print (" expense =  ", tmp2 )

    print info
    State.__init__(self, info)
示例#17
0
 def __init__(self, stack):
     State.__init__(self, stack)        
     self.title  = 'player'
     self.path = utils.settings['outputpath']
     self.image = None
     self.dimensions = (0,0)
      
     self.mode = 'standard'
     
     # self.files = [f for f in listdir(self.path) if isfile(join(self.path, f))]       
     # print      
     self.scroller = Scroller(dir.get_images_sorted(self.path),0, self.load_image)
     
     self.filename = self.scroller.get_value(0)
     
     self.load_image(self.filename)
     
     pygame_event = pygame.event.Event(pygame_utils.CHANGE_DISPLAY_SETTINGS, {'command': 'alpha', 'value': 255})
     pygame.event.post(pygame_event)     
	def __init__(self, main):
		# transition from another state
		State.__init__(self,main)
		self.titleScreen = Actor(IMG_TITLE_SCREEN)
		self.btnStart = Actor(IMG_LABEL_START)
		self.btnStart2 = Actor(IMG_LABEL_START2)
		
		self.btnStart.setPos(WIDTH/2,HEIGHT-300)
		self.btnStart2.setPos(WIDTH/2,HEIGHT-300)
		
		self.tick = 0
		self.tickInterval = 60
		self.ready = False

		TitleState.titleGroup.add(self.titleScreen)
		TitleState.btnStartGroup.add(self.btnStart)
		
		pygame.mixer.init()
		pygame.mixer.music.load("../data/sounds/godspeed.mid")
		pygame.mixer.music.play()
示例#19
0
 def __init__(self, screen, background, capture, ref_img, transform_mat, wins, winning_player, more_sprites = None):
     State.__init__(self, screen, background, capture, ref_img, transform_mat)
     if more_sprites:
         self.sprites.add(more_sprites)
     self.winning_player = winning_player
     if wins[self.winning_player.name] >= common.ROUNDS_TO_WIN:
         self.big_win = True
         self.winning_text = self.font.render(self.winning_player.name + ' WINS!', True, (139, 0, 0))
         self.text_anim = common.FloatingWord(self.winning_text)
         self.text_anim.start_size = common.RESOLUTION
         self.text_anim.end_size = (common.RESOLUTION[0] * 0.7, common.RESOLUTION[1] * 0.7)
         self.spotlight = Spotlight(winning_player.center_of_mass, winning_player.rect.height * 0.6)
         self.spotlight.add(self.sprites)
     else:
         self.big_win = False
         self.winning_text = self.font.render(self.winning_player.name + ' wins this round!', True, (139, 0, 0))
         self.text_anim = common.FloatingWord(self.winning_text)
         self.text_anim.start_size = common.RESOLUTION
         self.text_anim.end_size = (common.RESOLUTION[0] / 2, common.RESOLUTION[1] / 2)
     self.text_anim.anim_time = 3000
     self.text_anim.wait_time = 2000
     self.sprites.add(self.text_anim)
     self.text_anim.start()
     print "WinningState: Initialized"
示例#20
0
 def __init__(self, wolf):
     State.__init__(self, "hiding")
     self.wolf = wolf
示例#21
0
 def __init__(self, info):
     info['income'] = 1000
     info['expense'] = 800
     print info
     State.__init__(self, info)
示例#22
0
 def __init__(self, players):
     State.__init__(self)
     self.players = players
示例#23
0
 def __init__(self):
     State.__init__(self)
     self.cardtype = 'state'
     self.base = 'nocturne'
     self.desc = "At the start of your Buy phase, return this, and you can't buy Actions this turn."
     self.name = "Deluded"
示例#24
0
 def __init__(self, info):
     info['income'] = info['income'] * 0.7
     info['expense'] = info['expense'] * 0.75
     print info
     State.__init__(self, info)
示例#25
0
 def __init__(self, wolf):
     State.__init__(self, "attacking")
     self.wolf = wolf
示例#26
0
 def __init__(self, soldier):
     State.__init__(self, "patrol")
     self.soldier = soldier
示例#27
0
 def __init__(self, context):
     State.name = "Detecting State"
     State.__init__(self)
     self.context = context
示例#28
0
 def __init__(self, architect):
     State.__init__(self, "goBuilding")
     self.architect = architect
示例#29
0
 def __init__(self, wolf):
     State.__init__(self, "retreating")
     self.wolf = wolf
示例#30
0
 def __init__(self, context):
     State.name = "Gathering State"
     State.__init__(self)
     self.context = context
示例#31
0
 def __init__(self, farmer):
     State.__init__(self, "returning")
     self.farmer = farmer
 def __init__(self, context):
     State.__init__(self, context)
示例#33
0
 def __init__(self, soldier):
     State.__init__(self, "hunting")
     self.soldier = soldier
示例#34
0
 def __init__(self):
     State.__init__(self)
     self.desc = "Non Unique State"
     self.name = "NonUnique"
示例#35
0
 def __init__(self):
     State.__init__(self)
     self.desc = "Unique Test State"
     self.name = "Unique"
     self.unique_state = True
示例#36
0
文件: Driver.py 项目: SimionZafiu/1NG
 def __init__(self,  info):
   info['income'] = info['income']*0.7
   info['expense'] = info['expense']*0.75
   print info
   State.__init__(self, info)
示例#37
0
文件: Driver.py 项目: SimionZafiu/1NG
 def __init__(self,  info):
   info['income'] = 1000
   info['expense'] = 800
   print info
   State.__init__(self, info)
示例#38
0
 def __init__(self, farmer):
     State.__init__(self, "goCutting")
     self.farmer = farmer
示例#39
0
 def __init__(self, chef):
     State.__init__(self, "free")
     self.chef = chef
示例#40
0
 def __init__(self, chef):
     State.__init__(self, "goPlanting")
     self.chef = chef
示例#41
0
 def __init__(self, architect):
     State.__init__(self, "free")
     self.architect = architect
 def __init__(self, context, new_instructions):
     State.__init__(self, context)
     self.instructions = new_instructions
 def __init__(self):
     State.__init__(self)