当前位置: 首页>>代码示例>>Python>>正文


Python hud.Hud类代码示例

本文整理汇总了Python中hud.Hud的典型用法代码示例。如果您正苦于以下问题:Python Hud类的具体用法?Python Hud怎么用?Python Hud使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hud类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, window, input_handler):
     super(GameScreen, self).__init__()
     self.window = window
     self.input_handler = input_handler
     self.camera = Camera(window)
     self.render = Render(self.camera, self.window)
     sc_batch = self.render.scene_batch
     st_batch = self.render.static_batch
     self.player = player.Player(renderhook=self.render.playerhook)
     self.proj_viewer = ProjectileViewer(
         self.send_center, batch=sc_batch, scale=self.render.scale,
         rndhook=self.render.attack)
     self.controls = {}
     self.controls_old = {}
     self.map = Map('blank')
     #self.player.spawn(100, 100)
     self.time = 0
     self.moves = moves(1024)
     self.index = [0]
     self.head = [0]
     #other players
     self.players = {}
     self.specs = {}
     #crosshair
     self.cross = CrossHair(batch=st_batch)
     self.isSpec = 0.5
     self.hud = Hud(batch=st_batch, window=self.window)
     self.gs_view = GameStateViewer(self.players, self.hud.update_prop,
                                    self.hud.set_score)
     self.frozen = False
     self.rest_time = 0
开发者ID:mokapharr,项目名称:python_game,代码行数:31,代码来源:gamescreen.py

示例2: postInit

    def postInit(self):
        #
        # initialize game content
        #
        base.cTrav = CollisionTraverser("base collision traverser")
        base.pusher = CollisionHandlerPusher()
        self.menu = Menu()
        self.credits = Credits()
        self.charSelection = CharacterSelection()
        self.levelSelection = LevelSelection()
        self.koScreen = KoScreen()
        self.hud = Hud()
        self.menuMusic = loader.loadMusic("assets/audio/menuMusic.ogg")
        self.menuMusic.setLoop(True)
        self.fightMusic = loader.loadMusic("assets/audio/fightMusic.ogg")
        self.fightMusic.setLoop(True)
        base.audio3d = Audio3DManager(base.sfxManagerList[0], camera)

        #
        # Event handling
        #
        self.accept("escape", self.__escape)

        #
        # Start with the menu
        #
        self.request("Menu")
开发者ID:jorjuato,项目名称:panda3d-tutorial,代码行数:27,代码来源:main.py

示例3: __init__

    def __init__(self):
        self.display = Display()
        self.player = Charactor(self)
        self.level = Level(self)
        self.hud = Hud()

        self.prepare_stage()
开发者ID:lupo72,项目名称:miner2011,代码行数:7,代码来源:main.py

示例4: initialize

 def initialize(self):
     self.player = Tabby(0, 0)
     self.hud = Hud()
     self.pause = Pause()
     self.title = TitleScreen()
     self.camera = Camera(self.player.sprite)
     self.cameratarget = self.player
     self.entities.append(self.player) #player should always be the first in the list
开发者ID:Hatchet2k4,项目名称:mannux,代码行数:8,代码来源:__init__.py

示例5: __init__

 def __init__(self):
     pygame.mixer.pre_init(48000,-16,2, 1024) #Sound Settings
     pygame.init()
     
     #sets the screen resolution for the game and sets a rect for the game screen
     self.screen = pygame.display.set_mode((1024,768))
     self.screen_rect = self.screen.get_rect()
     
     #initializes a clock for the game
     self.clock = pygame.time.Clock()
     
     #initializes a menu object and HUD object and Score object
     self.menu = Menu()
     self.hud = Hud()
     self.score = Score()
     #sets a boolean for whether you are still in the menu or not
     self.inMenu = True
     #sets a camera for the world
     self.camBorder = 32
     self.cam = Camera(pygame.Rect(100, 100, 1024, 768), pygame.Rect(self.camBorder, self.camBorder, 2048 - self.camBorder, 1536 - self.camBorder))
     self.camShakeFactor = 0 #Magnitude of shake
     self.camShakeDecayFactor = 0.08 #Lerp Amount
     
     #Timing
     self.timer = pygame.time.get_ticks()
     self.elapsed = 0
     
     #Sound Controller
     self.soundCon = SoundCon()
     
     #Game Values
     self.backgroundImg = pygame.image.load("Images/Arena/Arena2.png").convert_alpha()
     self.backgroundImgRect = self.backgroundImg.get_rect()
     self.player = Player( self.hud )
     
     #Effects
     self.effectInstances = []
     self.spawnSound = pygame.mixer.Sound("Sounds/ShipRev.wav")
     self.deathSound = pygame.mixer.Sound("Sounds/shipExplo.wav")
     self.enemyExplo = pygame.mixer.Sound("Sounds/enemyExplo.wav")
     self.clashSound = pygame.mixer.Sound("Sounds/clash.wav")
     self.boostSound = pygame.mixer.Sound("Sounds/boostLow.wav")
     
     #Game over fade out
     self.fadeImage = pygame.image.load("Images/HUD/CrackedGlass.png").convert_alpha()
     self.fadeRect = self.fadeImage.get_rect()
     self.fadeSurface = pygame.Surface((1024, 768), pygame.SRCALPHA)
     self.fadeSurfaceAlpha = 0
     self.fadeSurfaceRate = 1
     self.doFade = False
     self.restartGame = False
     
     #Enemies
     self.enemyList = []
     self.baseNumEnemies = 2
     self.spawnTime = 10
     self.currentSpawnTime = 30
开发者ID:BrettMcNeff,项目名称:TBA,代码行数:57,代码来源:game.py

示例6: brushing

 def brushing(self):
     self.weapons = []
     self.spiders = []
     self.effects = []
     self.dead_spiders = []
     self.hud = Hud()
     self.player = Player()
     self.bonus_time = 0
     self.bonus_timmer = 30
     self.double_bonus = False
     self.tripple_bonus = False
     self.level = 0
开发者ID:tomislater,项目名称:kill_spiders,代码行数:12,代码来源:start_game.py

示例7: __init__

    def __init__(self, _main):
        self.main = _main
        self.name = ""
        self.points = 0
        self.health = 100.0
        self.runSpeed = 1.8
        self.keyMap = {
            "left":False,
            "right":False,
            "up":False,
            "down":False
            }
        base.camera.setPos(0,0,0)
        self.model = loader.loadModel("Player")
        self.model.find('**/+SequenceNode').node().stop()
        self.model.find('**/+SequenceNode').node().pose(0)
        base.camera.setP(-90)
        self.playerHud = Hud()
        self.playerHud.hide()
        self.model.hide()

        # Weapons: size=2, 0=main, 1=offhand
        self.mountSlot = []
        self.activeWeapon = None
        self.isAutoActive = False
        self.trigger = False
        self.lastShot = 0.0
        self.fireRate = 0.0

        self.playerTraverser = CollisionTraverser()
        self.playerEH = CollisionHandlerEvent()
        ## INTO PATTERNS
        self.playerEH.addInPattern('intoPlayer-%in')
        #self.playerEH.addInPattern('colIn-%fn')
        self.playerEH.addInPattern('intoHeal-%in')
        self.playerEH.addInPattern('intoWeapon-%in')
        ## OUT PATTERNS
        self.playerEH.addOutPattern('outOfPlayer-%in')
        playerCNode = CollisionNode('playerSphere')
        playerCNode.setFromCollideMask(BitMask32.bit(1))
        playerCNode.setIntoCollideMask(BitMask32.bit(1))
        self.playerSphere = CollisionSphere(0, 0, 0, 0.6)
        playerCNode.addSolid(self.playerSphere)
        self.playerNP = self.model.attachNewNode(playerCNode)
        self.playerTraverser.addCollider(self.playerNP, self.playerEH)
        #self.playerNP.show()

        self.playerPusher = CollisionHandlerPusher()
        self.playerPusher.addCollider(self.playerNP, self.model)
        self.playerPushTraverser = CollisionTraverser()
        self.playerPushTraverser.addCollider(self.playerNP, self.playerPusher)
开发者ID:grimfang,项目名称:owp_shooter,代码行数:51,代码来源:player.py

示例8: initAttr

    def initAttr(self):
        self.turn = True
        self.hudWidth = HUD["HUD_WIDTH"]
        self.edgeWidth = GAME["EDGE_WIDTH"]

        # 先获取 board 部分的大小,再自适应自己的大小
        self.board = Board((self.hudWidth, self.edgeWidth))
        Div.__init__(self, (self.board.width + self.hudWidth, self.board.height + self.edgeWidth * 2))
        # 根据窗口高度设置 HUD 高度
        self.hud = Hud((0, self.height), (0, 0))
        self.hud.setMark(self.turn)
        self.board.setTurn(self.turn)
        self.gameID = 0
        self.order = None
开发者ID:piratf,项目名称:Game_Boxes,代码行数:14,代码来源:game.py

示例9: __init__

    def __init__(self, ventana):
        super(Lienzo, self).__init__()
        #Cambiar el color de fondo de la ventana
        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0,0,0))
        # Pedir el tamano de la ventana
        self.set_size_request(WINDOW_SIZE,WINDOW_SIZE)
        #Asignar la ventana que recibe de paramentro a la ventana que se
        #utilizara en el lienzo
        self.ventana=ventana
        #expose-event es una propiedad de DrawingArea que le dice como
        #dibujares, aqui le decimos que utilize nuestra funcion paint
        #para ese evento en vez del que trae por defaul.
        self.connect("expose-event", self.paint)
        #reconocer cuando oprimes y sueltas el mouse
        self.connect("button_press_event",self.button_press)
        self.connect("button_release_event",self.button_release)
        self.connect("motion_notify_event",self.actualizar_dragged)
        self.set_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK|gtk.gdk.POINTER_MOTION_MASK)
        self.hud=Hud()
        self.minTimeToNextCell=100
        self.maxTimeToNextCell=300
        self.ticksToNextCell=random.randint(self.minTimeToNextCell,self.maxTimeToNextCell)
        self.trainingZoneLimit=WINDOW_SIZE-100

        #cells
        self.virus=[]
        self.cells=[]
        self.trainingSet=[]

        self.draggingObject = None
        self.objetoSeleccionado=[]

        self.currentState="Running"
        self.classificationList=["Target","Enemy","Food"]
        self.divisionPoints=[]

        
        self.currentCell = 0
        self.apareciendo = []
        self.numCells = 0
        self.read_file()

        self.r_table = Table()
        self.qagent = QAgent(self.r_table,'A')

        self.init_simulation()
        self.init_training_set()
开发者ID:alex31016,项目名称:BiokteriiRL,代码行数:47,代码来源:main.py

示例10: __init__

    def __init__(self):

        self.framerate = 0 
        self.number_meanies = 32
        self.bricks_in_level = 0
        self.display = Display()
        self.hud = Hud()
        pygame.key.set_repeat(100,5)
        self.meanies = pygame.sprite.Group()
        
        self.player = Charactor(self)
        self.player.speed = 2
       
        self.level = Level(self)

        self.level.load_level(0)
        self.start_game()
开发者ID:lupo72,项目名称:miner2011,代码行数:17,代码来源:main.py

示例11: main

def main():
	hud = Hud()
	# ser = serial.Serial(port = '/dev/ttyUSB0',
	# 					baudrate = 9600,
	# 					parity = serial.PARITY_NONE,
	# 					stopbits = serial.STOPBITS_ONE,
	# 					bytesize = serial.EIGHTBITS,
	# 					timeout = 1)
	logger = 0
	kv = {}
	stringKV = {}
	firstPass = True

	while True:
		# wrapping this all in a try-catch should handle file-opening/-closing timeline nicely
		# i.e. catch TclError(possibly tclError): close file
		#
		# var parsing and file writing will need to be wrapped in classes
		sleep(0.5)
		#kv = RT.randomKV()
		#print kv
		try:
			#inLine = ser.readline()
			inLine = RT.randomKVLine()
			if inLine[0] == '@':
				newKV = parseLineToKV(inLine)
				newStringKV = parseLineToStringKV(inLine)
				if firstPass:
					keys = sorted(newStringKV.keys())
					logger = Logger(keys)
					firstPass = False

				if newKV != kv:
					kv = newKV
					stringKV = newStringKV
					hud.updateHud(kv)
					hud.update_idletasks()
					hud.update()
					logger.logKV(stringKV)
					print strfkv(stringKV)

		except TclError: #possibly tclError
			print "HUD was closed"
			logger.close()
			break
		except err:
			print err
			break
开发者ID:gabrieltriggs,项目名称:solar-vehicle,代码行数:48,代码来源:controller.py

示例12: __init__

    def __init__(self, ventana):
        """"""
        super(Lienzo, self).__init__()

        #Cambiar el color de fondo de la ventana
        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0,0,0))
        # Pedir el tamano de la ventana
        self.set_size_request(WINDOW_SIZE,WINDOW_SIZE)

        #Asignar la ventana que recibe de paramentro a la ventana que se
        #utilizara en el lienzo
        self.ventana=ventana

        #expose-event es una propiedad de DrawingArea que le dice como
        #dibujares, aqui le decimos que utilize nuestra funcion paint
        #para ese evento en vez del que trae por defaul.
        self.connect("expose-event", self.paint)
        #reconocer cuando oprimes y sueltas el mouse
        self.connect("button_press_event",self.button_press)
        self.connect("button_release_event",self.button_release)
        self.connect("motion_notify_event",self.actualizar_dragged)
        self.set_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK|gtk.gdk.POINTER_MOTION_MASK)

        #Inicializar todos los valores
        self.init_simulation(None)
        self.hud=Hud()
        
        #celulas
        self.annealedCells=cellList+stationList
        self.virus=vir

        self.annealingCompleted=False
        self.initialized=False
        self.allVisited=False
        self.visitedCells=0
        self.nextCell=None

        self.draggingObject = None
        self.corriendo = True

        self.bestEnergy=0
        self.currentEnergy=0
        self.currentTemp=0

        self.objetoSeleccionado=[]
开发者ID:tucif,项目名称:Biokterii,代码行数:45,代码来源:main.py

示例13: __init__

    def __init__(self, ventana):
        super(Lienzo, self).__init__()
        #Cambiar el color de fondo de la ventana
        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0,0,0))
        # Pedir el tamano de la ventana
        self.set_size_request(WINDOW_SIZE,WINDOW_SIZE)
        #Asignar la ventana que recibe de paramentro a la ventana que se
        #utilizara en el lienzo
        self.ventana=ventana
        #expose-event es una propiedad de DrawingArea que le dice como
        #dibujares, aqui le decimos que utilize nuestra funcion paint
        #para ese evento en vez del que trae por defaul.
        self.connect("expose-event", self.paint)
        #reconocer cuando oprimes y sueltas el mouse
        self.connect("button_press_event",self.button_press)
        self.connect("button_release_event",self.button_release)
        self.connect("motion_notify_event",self.actualizar_dragged)
        self.set_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK|gtk.gdk.POINTER_MOTION_MASK)
        self.hud=Hud()
        self.minTimeToNextCell=200
        self.maxTimeToNextCell=200
        self.ticksToNextCell=random.randint(self.minTimeToNextCell,self.maxTimeToNextCell)

        #cells
        self.virus=[Virus(
               random.randint(0,100-VIRUS_WIDTH),
               random.randint(0,WINDOW_SIZE-CELL_HEIGHT),
                ) for i in xrange(TOTAL_VIRUS)]
        self.virus[0].policy="Fuzzy"
        self.virus[1].policy="Random"
        self.cells=[]
        
        self.draggingObject = None
        self.objetoSeleccionado=[]

        self.currentState="Running"
        self.classificationList=["Target","Enemy","Food"]

        self.trainingZoneLimit=WINDOW_SIZE-100

        self.fnn = None

        self.init_simulation()
        self.run_simulation()
开发者ID:Zheroth,项目名称:BiokteriiFuzzy,代码行数:44,代码来源:main.py

示例14: __init__

    def __init__(self):
        super(World, self).__init__()

        self.frames = 1

        # this is normal difficulty by default
        # easy would prolly be .7ish and hard.. 1.3 or so?
        self.difficulty = 0.7
        self.spawnFreq = 10
        self.scrollPosition = 0
        self.scrollSpeed = 3
        self.endPosition = FRAMES_UNTIL_BOSS * self.scrollSpeed
        self.startScreen = True
        self.helpScreen = False
        self.difficultyScreen = False
        self.bossMode = False
        self.gameOver = False
        self.winScreen = False
        self.score = 0
        self.call_popcorn = 0
        self.boss_music=False
        self.holdingLeftMouseButton = False

        #for keeping track of for the win screen!
        self.numEnemiesAppeared = 0
        self.numEnemiesDestroyed = 0
        self.numViruses = 0
        self.numWorms = 0
        self.numPopUps = 0

        self.playerGroup = pygame.sprite.GroupSingle()
        self.enemies = pygame.sprite.Group()
        self.pickups = pygame.sprite.Group()
        self.bullets = pygame.sprite.Group()
        self.mines = pygame.sprite.Group()
        self.backgrounds = pygame.sprite.Group()
        self.spawnBkg()
        
        # sprite groups listed in draw order (lowest sprite get drawn first)
        self.spriteGroups = [self.backgrounds, self.mines, self.pickups, self.bullets, self.enemies, self.playerGroup]
        
        self.hud = Hud()
开发者ID:dandelarosa,项目名称:unaffectedindicator,代码行数:42,代码来源:world.py

示例15: __init__

    def __init__(self, player, character_name, position=Vec2D(0, 0)):
        """Initialize all member variables of character.

        damage -- numeric value, the amount of harm dealt through normal_attack
        lock -- bool varible, says if the character is currently casting an
        ability or motion
        action -- string, the action currently being excecuted by the character

        """
        pygame.sprite.Sprite.__init__(self)

        self.name = character_name
        self.damage = 100
        self.attribute = self.attributes[self.name]
        self.lock = True
        self.action = "introduction"
        self.enemy_position = pygame.Rect(0, 0, 0, 0)

        if not isinstance(position, Vec2D):
            self.position = Vec2D(position)
        else:
            self.position = position

        if player == 1:
            self.controls = P1_CONTROLS
            self.direction = "Right"
        elif player == 2:
            self.controls = P2_CONTROLS
            self.direction = "Left"
        else:
            raise SystemExit("player argument should be either 1 or 2")

        self.movements = {}
        for action in get_all_movements(self.name):
            self.movements[action] = Movement(self.name, action)

        self.skills = SkillManager()
        self.hud = Hud(player, self.name)
        self.sound_effects = SoundManager(self.name)

        self.update({})
开发者ID:gshopov,项目名称:Pyruto,代码行数:41,代码来源:character.py


注:本文中的hud.Hud类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。