def setAppearance(self): """ A setter for the appearance of the tower. """ self.towerDiv = avg.DivNode(size=util.towerDivSize, pos=(self.pos.x - util.towerDivSize[0]//2, self.pos.y-util.towerDivSize[1]//2)) #sets the explosion radius self.towerCircle = avg.CircleNode(fillopacity=0.3, strokewidth=0, fillcolor=self.team.color, r=self.towerDiv.size.x//2, pos=(self.towerDiv.size.x//2,self.towerDiv.size.y//2), parent=self.towerDiv) #sets the fancy snow balls for i in xrange(5): radius = self.towerDiv.size[0]//10 xPos = random.randint(0 + math.floor(radius), math.ceil(self.towerDiv.size.x - radius)) yPos = random.randint(0 + math.floor(radius), math.ceil(self.towerDiv.size.y - radius)) snowball = avg.CircleNode(fillopacity=0.5, strokewidth=0, filltexhref=os.path.join(getMediaDir(__file__, "resources"), "snowflakes.png"), r=radius, pos=(xPos,yPos), parent=self.towerDiv) self.snowballAnim(xPos,yPos,snowball) self.tower = avg.RectNode(fillopacity=1, strokewidth=0, size=util.towerSize, pos=(self.pos.x - util.towerSize[0] // 2, self.pos.y - util.towerSize[1] // 2)) if self.team.name == "Team2": self.tower.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "iceball.png") else: self.tower.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "iceball.png")
def setAppearance(self): """ This method sets the appearance of the item. """ if (self.kill == 1): self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "bombblue.png") else: self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "bombred.png")
def setAppearance(self): """ This method sets the appearance of the item. """ if (self.exp == 1): self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "ep.png") elif (self.exp == 2): self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "epp.png") elif (self.exp == 3): self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "eppp.png")
def _setHP(self, number): if number < 1: self._hp = 0 self.hide() elif number > 8: self._hp = 8 self._node.href = os.path.join(getMediaDir(__file__, "resources"), "hp/" + str(self._hp) + ".png") else: self._hp = number self._node.href = os.path.join(getMediaDir(__file__, "resources"), "hp/" + str(self._hp) + ".png")
def releaseBlockHalf(self,id): """ This method checks whether the item has still an effect or not. id: which team should be released of the block. """ if (id == 1): #release player 1. self.player.clearInterval(self.game.timerCreature1) self.game.homeBaseImg.href=os.path.join(getMediaDir(__file__, "resources"), "baseStoned1.png") self.game.timerCreature1 = self.player.setInterval(self.blockTime/2, lambda: self.releaseBlock(1)) else: self.player.clearInterval(self.game.timerCreature2) self.game.homeBaseImg2.href=os.path.join(getMediaDir(__file__, "resources"), "baseStoned1.png") self.game.timerCreature2 = self.player.setInterval(self.blockTime/2, lambda: self.releaseBlock(2))
def __init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints = 8): """ Creates a new scout creature (including the libAVG nodes). g_player: the global player instance. team: the team, the creature should belong to. pos: the initial position. layer: the layer to put the creature on. when: the moment, the creation has been started. """ Creature.__init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints) self.speed = self.speed * 2 if self.team.name == "Team2": self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "triangleEvil.png") else: self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "triangleGood.png")
def onInit(self): self.mediadir = getMediaDir(__file__) self.__gameMusic = avg.SoundNode(href='Fire_Birds.mp3', loop=True, volume=0.75, parent=self) self.__scrollingBg = ScrollingBackground(self) self.__shadowDiv = avg.DivNode(parent=self) self.__gameDiv = avg.DivNode(size=self.size, parent=self) self.__guiDiv = avg.DivNode(parent=self) bg = avg.ImageNode(href='gui_frame.png', parent=self.__guiDiv) self.__guiDiv.pos = (0, self.height - bg.height) self.__lifeCounter = LifeCounter(pos=(8, 12), parent=self.__guiDiv) gunCtrl = GunControl(pos=(300, 54), parent=self.__guiDiv) self.__scoreCounter = ScoreCounter(pos=(1142, 54), parent=self.__guiDiv) self.__enemies = [] for i in xrange(2): self.__createEnemy() self.__player = PlayerAircraft(self.__shadowDiv, gunCtrl, parent=self.__gameDiv) enemyMask = avg.Bitmap(self.mediadir + '/enemy.gif') self.__playerCollisionDetector = collisiondetector.CollisionDetector( enemyMask, avg.Bitmap(self.mediadir + '/spitfire.gif')) self.__bulletCollisionDetector = collisiondetector.CollisionDetector( enemyMask, avg.Bitmap(self.mediadir + '/bullet.gif')) self.__keyStates = dict.fromkeys(PlayerAircraft.ACTION_KEYS, False) self.__frameHandlerId = None self.__spawnTimeoutId = None self.__gameMusic.play() self.__start() player.subscribe(player.KEY_DOWN, self.__onKeyDown) player.subscribe(player.KEY_UP, self.__onKeyUp)
def init(self): self._parentNode.mediadir = getMediaDir(__file__) bgNode = g_player.createNode('image', {'href': 'background.jpg'}) self._parentNode.appendChild(bgNode) self.images = [] self.loadImages()
def __init__(self, data, parent=None, **kwargs): super(PersonNode, self).__init__(**kwargs) self.registerInstance(self, parent) self.publish(self.PERSON_SELECTED) self._data = data self._resisze_anim = None if int(data['IS_BIG']) == 1: self._base_size = PERSON_NODE_SIZE_LARGE else: self._base_size = PERSON_NODE_SIZE_MEDIUM self._image = avg.CircleNode(r=self._base_size, parent=self, filltexhref=unicode( os.path.join( getMediaDir(__file__), 'SACHI_images', data[ 'IMAGE_PATH'].strip())), fillopacity=1, color=STROKE_COLOR, strokewidth=STROKE_WIDTH, ) self._image.subscribe(self._image.CURSOR_DOWN, self._on_click) self._image.subscribe(self._image.CURSOR_OVER or self._image.HOVER_OVER, self._on_person_hover) self._image.subscribe(self._image.CURSOR_OUT or self._image.HOVER_OUT, self._on_person_hover_out)
def init(self): self._parentNode.mediadir = getMediaDir(__file__) self.__gameMusic = avg.SoundNode(href='Fire_Birds.mp3', loop=True, volume=0.75, parent=self._parentNode) self.__scrollingBg = ScrollingBackground(self._parentNode) self.__shadowDiv = avg.DivNode(parent=self._parentNode) self.__gameDiv = avg.DivNode(size=self._parentNode.size, parent=self._parentNode) self.__guiDiv = avg.DivNode(parent=self._parentNode) bg = avg.ImageNode(href='gui_frame.png', parent=self.__guiDiv) self.__guiDiv.pos = (0, self._parentNode.height - bg.height) self.__liveCounter = LiveCounter(pos=(8, 12), parent=self.__guiDiv) gunCtrl = GunControl(pos=(300, 54), parent=self.__guiDiv) self.__scoreCounter = ScoreCounter(pos=(1142, 54), parent=self.__guiDiv) self.__enemies = [EnemyAircraft(self.__shadowDiv, parent=self.__gameDiv) for i in xrange(5)] self.__player = PlayerAircraft(self.__shadowDiv, gunCtrl, parent=self.__gameDiv) self.__keyStates = dict.fromkeys(PlayerAircraft.ACTION_KEYS, False) self.__frameHandlerId = None self.__spawnTimeoutId = None self.__gameMusic.play() self.__start()
def onInit(self): self.mediadir = getMediaDir(__file__) self.game = None self.text_size = 20 self.text_line = Point2D(0, self.text_size) self.margin = Point2D(20, 20) self.background = create_node(self, 'rect', size=self.size, fillcolor='000000', fillopacity=1) self.game_node = create_node(self, 'div', pos=self.margin + self.text_line/2, size=self.size - self.margin*2 - self.text_line/2) self.create_button( self, self.show_about_box, 'About', 1, self.margin - self.text_line/2, 'left') exit_button_pos = avg.Point2D(self.size.x/2, self.margin.y-self.text_line.y/2) self.create_button(self, self.__stop, 'Exit', 1, exit_button_pos, 'center') self.level_button_nodes = [] self.game_over_box = self.create_game_over_box() self.about_box = self.create_about_box() player.subscribe(player.KEY_DOWN, self.__onKeyDown) self.start_game()
def init(self): self._parentNode.mediadir = getMediaDir(__file__) bgNode = g_player.createNode('image', { 'href': "bgpixel.png"}) bgNode.size = self._parentNode.size self._parentNode.appendChild(bgNode) self.__mixer = alsaaudio.Mixer() def setVolume(val): val = 1 - val self.__mixer.setvolume(int(100 * val)) schieberWidth = 100 self.__schieber = Slider(self._parentNode, pos = Point2D(300,10), onChange = setVolume) self.__audioNode = g_player.createNode('sound', { 'href': os.path.join(getMediaDir(__file__), 'test.wav')}) self._parentNode.appendChild(self.__audioNode) def onFinish(): self.__isPlaying = False self.__audioNode.setEOFCallback(onFinish) self.__isPlaying = False testNode = g_player.createNode('words', { 'text': 'VOLUME', 'x': 600, 'y': 50, 'fontsize': 150, }) self._parentNode.appendChild(testNode) #testNode.setEventHandler(avg.CURSORDOWN, # avg.MOUSE | avg. TOUCH, self._onClickPlay) exitNode = g_player.createNode('words', { 'text': 'EXIT', 'x': 600, 'y': 450, 'fontsize': 150, }) self._parentNode.appendChild(exitNode) exitNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg. TOUCH, lambda e: self.leave())
def __init__(self, parentDir): print "Schubser: moving media to ramdisk" self.contentDir = os.path.join(getMediaDir(__file__), "content") ret = os.system("rsync -av %s/ /dev/shm/mediaschubser_content" % self.contentDir) if ret==0: print "rsync success!" self.contentDir = '/dev/shm/mediaschubser_content' super(Schubser, self).__init__(parentDir)
def __init__(self, quadra=False, debug=False): global g_AudioEnabled if not g_AudioEnabled: print "AUDIO: Audio subsystem not available" return self.__soundDir = os.path.join(utils.getMediaDir(__file__), 'Sound') self.__server = scsynth.connect() try: self.__server.sendMsg('/notify', 1) self.__server.receive() except: print "AUDIO: Audio subsystem available but server is not responding. Disabling audio" g_AudioEnabled = False return if debug: self.__server.sendMsg('/dumpOSC', 1) self.__server.sendMsg('/g_freeAll', 0); self.__scPlayer = SponcPlayer(self.__server, quadra) self.__scPlayer.loadSynthDef(self.__soundDir+'/scsyndefs/QuadraPlayer.scsyndef') self.__scPlayer.loadSynthDef(self.__soundDir+'/scsyndefs/StereoPlayer.scsyndef') self.__scPlayer.loadSynthDef(self.__soundDir+'/scsyndefs/simpleAnalog.scsyndef') self.__sampDict = {} self.__sampDict['ping_left'] = self.__scPlayer.allocateSample(self.__soundDir+'/ping_left.wav') self.__sampDict['ping_right'] = self.__scPlayer.allocateSample(self.__soundDir+'/ping_right.wav') self.__sampDict['boundary'] = self.__scPlayer.allocateSample(self.__soundDir+'/bande_dry.wav') self.__sampDict['goal'] = self.__scPlayer.allocateSample(self.__soundDir+'/tor_bekommen.wav') self.__leftSynth = scsynth.Synth() self.__leftSynth.name = 'simpleAnalog' self.__rightSynth = scsynth.Synth() self.__rightSynth.name = 'simpleAnalog' self.__leftSynthSID = self.__scPlayer.allocateSynth(self.__leftSynth) self.__rightSynthSID = self.__scPlayer.allocateSynth(self.__rightSynth) self.setStretchParam('left', 'baseFreq', 69) self.setStretchParam('right', 'baseFreq', 82) self.setStretchParam('left', 'xpos', -1) self.setStretchParam('right', 'xpos', 1) print "AUDIO: Audio subsystem initialized" if quadra: print "AUDIO: Using QuadraPlayer synthdef for sample playback" else: print "AUDIO: Using StereoPlayer synthdef for sample playback"
def __init__(self, layer, pos, color, gameTime, id=1): """ Constructor for a new timeBar object. layer: the layer to place the bar on. pos: the position to place the bar. color: the color of the inner rect. gameTime: time in minutes or -1 if infinity. id: indicates the team the bar belongs to. """ self.timeBarDiv = avg.DivNode(pos=pos, size=util.expBarSize, parent=layer) self.underRect = avg.RectNode(fillopacity=1, strokewidth=0, fillcolor="000000", size=util.expBarSize, pos=(0,0), parent=self.timeBarDiv) self.innerRect = avg.RectNode(fillopacity=0.8, strokewidth=0, fillcolor=color, size=(util.expBarSize[0]-util.levelWordsSize[0], util.sideBarheight), parent=self.timeBarDiv) self.borderImg = avg.ImageNode(href=os.path.join(getMediaDir(__file__, "resources"), "barrock_neu.png"), pivot=(0,0), size=(util.sideBarheight,util.expBarSize[0]), parent=self.timeBarDiv) self.clockImg = avg.ImageNode(href=os.path.join(getMediaDir(__file__, "resources"), "clock.png"), size=util.clockSize, parent=self.timeBarDiv) if id==1: self.clockImg.pos=(util.expBarSize[0]-util.levelWordsSize[0]-util.width//600,util.width//250) self.clockImg.angle=math.pi/2 self.innerRect.pos=(0,0) self.borderImg.pos=(util.expBarSize[0],0) self.borderImg.angle=math.pi /2 if not gameTime==-1: avg.LinearAnim(self.innerRect, "size", gameTime*60*1000, (self.innerRect.size.x, self.innerRect.size.y), (1,self.innerRect.size.y)).start() else: self.clockImg.pos=(util.width//800,util.width//250) self.clockImg.angle=math.pi/2*3 self.innerRect.pos=(util.sideBarheight//4*3,0) self.borderImg.angle=math.pi *3 /2 self.borderImg.pos=(0,util.sideBarheight) if not gameTime==-1: avg.LinearAnim(self.innerRect, "pos", gameTime*60*1000, (self.innerRect.pos.x, self.innerRect.pos.y), (util.expBarSize[0],self.innerRect.pos.y)).start()
def __init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints = 8): """ Creates a new wizard creature (including the libAVG nodes). g_player: the global player instance. team: the team, the creature should belong to. pos: the initial position. layer: the layer to put the creature on. when: the moment, the creation has been started. """ self.maxJumpDistance = util.halfwidth // 2 self.goalXPos = self.maxJumpDistance self.freezed = False self.shouldDie = False self.firstJump = True self.appearAnim = None self.disappearAnim = None Creature.__init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints) if self.team.name == "Team2": self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "circleEvil.png") else: self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "circleGood.png")
def init(self): canvasXML = open(os.path.join(getMediaDir(__file__), "canvas.avg")) self.__mainNode = g_Player.createNode(canvasXML.read()) self.__mainNode.mediadir = getMediaDir(__file__) self._parentNode.appendChild(self.__mainNode) for nodeID in "time", "win": node = g_Player.getElementByID(nodeID) node.width = self._parentNode.size.x node.x = self._parentNode.size.x/2 g_Player.getElementByID("canvas").setEventHandler(avg.CURSORDOWN, avg.TOUCH, self.getColor) g_Player.getElementByID("canvas").setEventHandler(avg.CURSORMOTION, avg.TOUCH, self.paint) g_Player.getElementByID("canvas").setEventHandler(avg.CURSORUP, avg.TOUCH, self.forgetColor) self.tehBrushes, self.oldCoord = {}, {} self.tehTime = config.roundDuration self.tehImage = Bitmap(os.path.join(getMediaDir(__file__), "images/paint.png")) self.im = Image.fromstring ('RGBA', (int(config.resolution.x),(int(config.resolution.y))), self.tehImage.getPixels())
def __initIdleDemo(self, parent): self.__idleTimeoutID = None self.__idlePlayers = [] fp = open(getMediaDir(__file__, 'data/idledemo.pickle'), 'r') demoData = load(fp) fp.close() demoDiv = avg.DivNode(parent=parent, pos=parent.size / 2 - Point2D(0, g_gridSize * 20)) for data in demoData: self.__idlePlayers.append(IdlePlayer(data, parent=demoDiv)) fp = open(getMediaDir(__file__, 'data/idleabout.pickle'), 'r') aboutData = load(fp) fp.close() aboutDiv = avg.DivNode(parent=parent, pos=parent.size / 2 - Point2D(0, g_gridSize * 10)) pos = Point2D(0, 0) for data in aboutData: aboutPlayer = AboutPlayer(data, parent=aboutDiv, pos=pos) pos.y += aboutPlayer.height + 4 * g_gridSize self.__idlePlayers.append(aboutPlayer)
def placeBackNode(parentNode, x, y, angle, id): keyNodeDiv = avg.DivNode(pos=(x,y), parent=parentNode) keyNodeDiv.side=id keyNodeDiv.subscribe(Node.CURSOR_UP, lambda event : keyUp("BACK", keyNodeDiv.side)) avg.RectNode(size=(util.keyHeight, util.keyHeight), pos=(1,0), parent=keyNodeDiv) keyWordNode = avg.ImageNode(href=os.path.join(getMediaDir(__file__, "resources"), "keyArrow.png"), angle=angle, pivot=(0,0), parent=keyNodeDiv) keyWordNode.size=(util.height//20,util.height//20) if id==1: keyWordNode.pos=(util.width//25,util.height//50) else: keyWordNode.pos=(util.width//100,util.height//16)
def __init__(self,parentNode): super(Pianohero, self).__init__(parentNode) self._parentNode.mediadir = getMediaDir(__file__) self.currentState = None self.size = self._parentNode.size self.margin = Point2D(0, 0) self.background = create_node(self._parentNode, 'rect', size=self.size, fillcolor='000000', fillopacity=1) self.game_node = create_node(self._parentNode, 'div', pos=self.margin, size=self.size - self.margin*2) g_Player.showCursor(True)
def placeUpNode(parentNode, x, y, angle, id): keyNodeDiv = avg.DivNode(pos=(x,y), parent=parentNode) keyNodeDiv.side = id keyNodeDiv.subscribe(Node.CURSOR_UP, lambda event : shift(keyNodeDiv.side)) keyNode = avg.RectNode(fillcolor="FFFFFF", fillopacity=0.6, size=(util.keyHeight, util.keyHeight), pos=(1,0), parent=keyNodeDiv) keyWordNode = avg.ImageNode(href=os.path.join(getMediaDir(__file__, "resources"), "keyArrow.png"), angle=angle, size=(util.height//20,util.height//20), pivot=(0,0), parent=keyNodeDiv) if id==1: keyWordNode.pos=(util.width//25,util.height//16) global shiftNode_left shiftNode_left = keyNode else: keyWordNode.pos=(util.width//80,util.height//65) global shiftNode_right shiftNode_right = keyNode
def playTune(self, name, loopEnabled=False, path=getMediaDir(__file__, "resources")): """ Plays a new tune. name: The reference to the new tune. path: The path. """ if self.enabled: self.musicPlayer.stop() self.musicPlayer.href = os.path.join(path, name) try: if loopEnabled: self.musicPlayer.subscribe(SoundNode.END_OF_FILE, lambda: self._setLoop(name, path)) self.musicPlayer.play() except RuntimeError: pass
def reset(self): g_Player.getElementByID("time").text = str(self.tehTime) anim.fadeIn(g_Player.getElementByID("time"), config.fadeInTime, 0.5).start() # self.tehImage = Bitmap(g_Player.getElementByID("canvas").href) self.tehImage = Bitmap(os.path.join(getMediaDir(__file__), "images/paint.png")) # the format of tehImage is BGRA not RGBA. we need to take care of that while we analyse the image ! anim.fadeIn(g_Player.getElementByID("canvas"), config.fadeInTime, 1.0).start() self.dirty = True self.endgame = False # set timers if not self.__onFrameHandler: self.__onFrameHandler = g_Player.setOnFrameHandler(self.updateImage) if not self.__clockInterval: self.__clockInterval = g_Player.setInterval(1000, self.checkTime)
def __init__(self, layer, pos, color, steps, id=1): """ Constructor for a new expBar object. layer: the layer to place the bar on. pos: the position to place the bar. color: the color of the inner rect. steps: nr of increases possible until the bar is full. id: indicates the team the bar belongs to. """ self.expBarDiv = avg.DivNode(pos=pos, size=util.expBarSize, parent=layer) self.underRect = avg.RectNode(fillopacity=1, strokewidth=0, fillcolor="000000", size=util.expBarSize, pos=(0,0), parent=self.expBarDiv) self.innerRect = avg.RectNode(fillopacity=0.8, strokewidth=0, fillcolor=color, size=(0, util.sideBarheight), parent=self.expBarDiv) self.borderImg = avg.ImageNode(href=os.path.join(getMediaDir(__file__, "resources"), "barrock_neu.png"), size=(util.sideBarheight,util.expBarSize[0]), parent=self.expBarDiv) self.steps = steps self.cnt = 0 self.level=0 self.id = id self.stepWidth = math.floor((util.expBarRightInnerDivWidth-util.levelWordsSize[0]) / steps) self.levelWords = avg.WordsNode( font="DejaVu Sans", variant="bold", fontsize=util.convertFontSize(24), text="%02i" % self.level, pivot=(0,0), alignment="center", parent=self.expBarDiv) if id==1: self.borderImg.pivot = (0,0) self.innerRect.pos=(util.width // 300,0) self.levelWords.pos=(self.borderImg.size.y+util.width//400, util.sideBarheight //2) self.levelWords.angle=math.pi / 2 self.borderImg.pos=(self.borderImg.size.y,0) self.borderImg.angle=math.pi /2 else: self.borderImg.pivot = (0,0) self.innerRect.pos=(util.expBarSize[0],0) self.levelWords.pos=(-util.width//400,util.sideBarheight//2) self.levelWords.angle=math.pi *3 / 2 self.innerRect.size=(util.expBarSize[0]-util.sideBarheight //2, util.sideBarheight) self.borderImg.pos=(0,util.sideBarheight) self.borderImg.angle=math.pi*3/2 self.blinkAnim1 = False self.blinkAnim2 = False
def closeKeyboard(): if (self.up1 and self.up2 and not self.highscoreComingUp2): self.highscoreComingUp2=True if self.divLeftAppended: self.divLeft.unlink(True) self.divLeft = None self.keyBoardDivLeft = None self.player1TextDiv = None self.player1Box = None self.player1Text = None global shiftNode_left shiftNode_left = None if self.divRightAppended: self.divRight.unlink(True) self.divRight = None self.keyBoardDivRight = None self.player2TextDiv = None self.player2Box = None self.player2Text = None global shiftNode_right shiftNode_right = None global keys_left global keys_right keys_left = [] keys_right = [] highscoreDiv = avg.DivNode(pos=(0,0), opacity=0, size=(util.width, util.height)) self.highscore.show(highscoreDiv) self.back = avg.ImageNode(id="ButtonBack", opacity=1, href = os.path.join(getMediaDir(__file__, "resources"), "labels/arrow.png"), pos = (-400, util.buttonMarginBottom), size = util.helpAndCloseButtonSize, parent=highscoreDiv) self.back.swapHref = os.path.join(getMediaDir(__file__, "resources"), "labels/arrowGlow.png") self.back.subscribe(Node.CURSOR_DOWN, backClick) self.back.subscribe(Node.CURSOR_OVER, lambda event : glow(event, self.back)) self.back.subscribe(Node.CURSOR_OUT, lambda event : glow(event, self.back)) avg.LinearAnim(self.back, "pos", 1000, self.back.pos, (util.width // 600 , self.back.pos.y), False, None, lambda : self.parentNode.appendChild(highscoreDiv)).start() avg.fadeIn(highscoreDiv, 3000)
def onInit(self): self.mediadir = utils.getMediaDir(__file__) left = right = top = 60 bottom = 160 self.__point = P(left, top) \ + ((self.size - (right+left, bottom+top)) * 0.5) avg.RectNode( parent=self, size=self.size, opacity=0, fillopacity=1, fillcolor='cccccc') self.__pg = PlayGround(parent=self, start=self.__point) self.__menu = Menu(parent=self, quitCb = player.stop, resetCb = self.__pg.reset, centerBottom=(self.size.x * 0.5,self.size.y-bottom-17)) m = Mask(parent=self, left=left,right=right, top=top,bottom=bottom, screenSize=self.size) l = Knob(parent=self, callback=lambda x: self.__move(P(0,x)), pos=(0.5*bottom,self.size.y-bottom*0.5)) l = Knob(parent=self, callback=lambda x: self.__move(P(x,0)), pos=(self.size.x-bottom*0.5,self.size.y-bottom*0.5)) img = avg.ImageNode(parent=self, href="magic-libavg-touch.png", pos=(self.size.x/2, self.size.y-bottom*0.5)) img.pos = img.pos - img.size * 0.5 Noise(parent=self, size=self.size) self.__left = left self.__right = right self.__bottom = bottom self.__top = top self.__setupMultitouch()
def createPreviewNode(maxSize): filename = os.path.join(utils.getMediaDir(__file__), 'preview.png') return utils.createImagePreviewNode(maxSize, absHref = filename)
def __init__(self, parentNode): parentNode.mediadir = utils.getMediaDir("../test/media") self.rootNode = avg.DivNode(parent = parentNode) super(Main, self).__init__(parentNode)
def __init__(self, *args, **kwargs): avg.WordsNode.addFontDir(utils.getMediaDir(__file__, 'fonts')) global _app _app = self super(GameApp, self).__init__(*args, **kwargs) self._parentNode.mediadir = utils.getMediaDir(__file__)
def setAppearance(self): """ This method sets the appearance of the item. """ self.node.filltexhref=os.path.join(getMediaDir(__file__, "resources"), "ultimate.png")