Exemple #1
0
    def __init__(self, mainActor):
        
        self.teamMateImage = 'models/hexahedron.png'
        self.heroImage = 'models/mainHero2.png'
        self.miniMapImage = 'models/miniMap000.png'
        self.towerImage = 'models/tower_neitral.png'
        self.towerRed = 'models/tower_red.png'
        self.towerBlue = 'models/tower_blue.png'
        
        self.map = OnscreenImage(image = self.miniMapImage, pos=(-0.7, 0, 0.8), 
                              scale=(MAP_SCALEX, 0, MAP_SCALEY))
        
        self.map.setTransparency(1)
        #self.map.reparentTo(rander)

        self.hero = OnscreenImage(image=self.heroImage, pos=(mainActor.getX()/525, 0, mainActor.getY()/160), 
                                    scale=(HERO_SCALE, 1, HERO_SCALE), 
                                    hpr=(0, 0, mainActor.getH()))
        self.hero.reparentTo(self.map)
        self.hero.setTransparency(1)
        
        self.npc = {}
        
        self.tower = {}
        
        self.team = {}
Exemple #2
0
	def __init__(self, path='/models', scale = 0.0, posX = -0.9, posZ = -0.65, mapimageName = None):
		taskMgr.add(self.step,"MinimapTask")
		self.path = path
		self.posX = posX
		self.posZ = posZ
		b = 500
		pos = Vec3(self.posX,0,self.posZ)#Aspect2D coordinates for the location of the center of the minimap. 
		if mapimageName is None: mapimageName = '%s/battlemap.png' % self.path#mapimage is the image to place in the minimap
		
		self.scale = scale  #this value is the number of pixels wide the map will be.
		ratio = b/self.scale
		self.dotScale = (ratio) * b
		self.dotSize = 0.005 / ratio
		self.map = aspect2d.attachNewNode('Map')
		mapimage = self.getMapImage(mapimageName)
		
		props = base.win.getProperties( )
		self.Height = float(props.getYSize())
		self.Hscale = (1/self.Height)
		
		self.map.setScale(self.Hscale)  #Sets scale to the screen resolution.
		self.map.setPos(pos) #this is the location on aspect2d for the minimap. 
		self.dots = []
		self.dots.append([])
		self.targets = []
		self.targets.append([])
		self.teamImage = []  #a list of paths to the image that each team will use. 
		self.setNumTeams(9)
		self.mapimage = OnscreenImage(image = mapimage, scale = self.scale, parent = self.map)
		self.mousePosition = OnscreenImage(image = self.path + 'select3.png', scale = self.dotSize*10, pos = (0,0,0), parent = aspect2d)
		self.totaltargets = 0
Exemple #3
0
    def loadGUI(self):
        self.vidas_imgs = list()
        w = 0.24
        for i in range(self.VIDAS):
            image_warning = OnscreenImage(
                image='../data/Texture/signal_warning.png',
                pos=(-1 + i * w, 0, 0.85),
                parent=self._playing_node2d)
            image_warning.setScale(0.1)
            image_warning.setTransparency(TransparencyAttrib.MAlpha)
            image_warning.hide()

            image_ok = OnscreenImage(image='../data/Texture/signal_ok.png',
                                     pos=(-1 + i * w, 0, 0.85),
                                     parent=self._playing_node2d)
            image_ok.setScale(0.1)
            image_ok.setTransparency(TransparencyAttrib.MAlpha)
            image_ok.show()
            self.vidas_imgs.append((image_ok, image_warning))

        self._level_time_O = OnscreenText(text='',
                                          pos=(0, 0.85),
                                          scale=0.14,
                                          fg=(1.0, 1.0, 1.0, 1.0),
                                          bg=(0.0, 0.0, 0.0, 1.0),
                                          parent=self._playing_node2d)
Exemple #4
0
    def __init__(self):
        HUDElement.__init__(self)
        self.dir = ani.model_dir / 'hud' / 'english'
        self.text_scale = 0.2
        self.text_color = (1, 1, 1, 1)

        self.circle = OnscreenImage(image=panda_path(self.dir / 'circle.png'),
                                    parent=self.dummy_right,
                                    scale=0.15)
        self.circle.setTransparency(TransparencyAttrib.MAlpha)
        autils.alignTo(self.circle, self.dummy_right, autils.CL, autils.C)
        self.circle.setZ(-0.65)

        self.crosshairs = OnscreenImage(image=panda_path(self.dir /
                                                         'crosshairs.png'),
                                        pos=(0, 0, 0),
                                        parent=self.circle,
                                        scale=0.14)
        self.crosshairs.setTransparency(TransparencyAttrib.MAlpha)

        self.text = OnscreenText(
            text="(0.00, 0.00)",
            pos=(0, -1.15),
            scale=self.text_scale,
            fg=self.text_color,
            align=TextNode.ACenter,
            mayChange=True,
            parent=self.circle,
        )
    def __init__(self):
        ShowBase.__init__(self)
        ready = 'Neutral.png'
        # if you don't want to test out the rollover effect just uncomment below and comment the other pair
        #set = ready
        set = 'Hover.png'
        #set = ready
        go = 'Click.png'

        hidden = self.hidden
        ready1 = OnscreenImage(image=ready, parent=hidden)
        ready1.setTransparency(TransparencyAttrib.MAlpha)

        set1 = OnscreenImage(image=set, parent=hidden)
        set1.setTransparency(TransparencyAttrib.MAlpha)
        go1 = OnscreenImage(image=go, parent=hidden)
        go1.setTransparency(TransparencyAttrib.MAlpha)

        self.loadButton = DirectButton(frameSize=None,
                                       image=(ready1, set1, go1),
                                       relief=None,
                                       geom=None,
                                       pad=(0.01, 0.01),
                                       suppressKeys=0,
                                       borderWidth=(0.015, 0.01),
                                       scale=1)
Exemple #6
0
 def game(self,task):
     if self.game_init:
         self.initgame()
         for thing in self.todelete:
             thing.destroy()
         self.game_init = False
     if self.rungame:
         if self.GameOver == False:
             if self.new_trial:
                 self.init_trial()
             elif self.go:
                 self.godisp()
             else:
                 if self.joystickon == 1:
                     self.getjoystick()
                 else:
                     self.move()
                 self.animate()
                 self.dig()
                 self.drag()
             self.movecam()
             if self.savelog:
                 self.log()
                 self.savelog = False
         else:
             if self.BlackScreen == 0:
                 self.BlackScreen = 1
                 OnscreenImage(image = 'textures/black.jpg', pos = (0, 0, 0),scale=100)
                 self.starimage = OnscreenImage(image = 'textures/goldstar.png', pos = (0,0,0),scale=0.1)
                 self.starimage.setTransparency(TransparencyAttrib.MAlpha)
     return task.cont
Exemple #7
0
    def __init__(self):
        Bar.__init__(self)

        #-----------------------------------------------------------------------------------------------------------------------------------------------
        #---------------------------------------------------VARIABLE DECLARATION------------------------------------------------------------------------
        #-----------------------------------------------------------------------------------------------------------------------------------------------
        # Init the bar with alpha sprites
        self.cereal = False
        self.specialCereal = OnscreenImage(
            image="./tex/cereal_not_special.png",
            pos=(0.43, 0, 0.87),
            hpr=None,
            scale=0.11,
            color=None,
            parent=None,
            sort=1)
        self.specialCereal.setTransparency(TransparencyAttrib.MAlpha)

        self.banana = False
        self.specialBanana = OnscreenImage(
            image="./tex/banana_not_special.png",
            pos=(0.63, 0, 0.87),
            hpr=None,
            scale=0.11,
            color=None,
            parent=None,
            sort=1)
        self.specialBanana.setTransparency(TransparencyAttrib.MAlpha)

        self.cheese = False
        self.specialCheese = OnscreenImage(
            image="./tex/cheese_not_special.png",
            pos=(0.83, 0, 0.87),
            hpr=None,
            scale=0.11,
            color=None,
            parent=None,
            sort=1)
        self.specialCheese.setTransparency(TransparencyAttrib.MAlpha)

        self.tomato = False
        self.specialTomato = OnscreenImage(
            image="./tex/tomato_not_special.png",
            pos=(1.03, 0, 0.87),
            hpr=None,
            scale=0.11,
            color=None,
            parent=None,
            sort=1)
        self.specialTomato.setTransparency(TransparencyAttrib.MAlpha)

        self.egg = False
        self.specialEgg = OnscreenImage(image="./tex/egg_not_special.png",
                                        pos=(1.23, 0, 0.87),
                                        hpr=None,
                                        scale=0.11,
                                        color=None,
                                        parent=None,
                                        sort=1)
        self.specialEgg.setTransparency(TransparencyAttrib.MAlpha)
Exemple #8
0
    def __init__(self):
        ShowBase.__init__(self)

        self.disableMouse()

        #Instrucciones
        self.ralph_escape = addInstructions(.06, "[ESC]: Para Salir")
        self.ralph_run = addInstructions(.12, "[A]: Para Correr")
        self.ralph_saluda = addInstructions(.18, "[S]: Para Saludar")
        self.ralph_giraD = addInstructions(.24, "[E]: Girar a la derecha")
        self.ralph_giraI = addInstructions(.30, "[Q]: Girar a la izquierda")

        # Carga de Actor
        """self.Ralph = Actor("models/ralph",
                           {"run": "models/ralph-run",
                            "walk": "models/ralph-walk"})
        self.Ralph.setScale(.5,.5,.5)
        self.Ralph.reparentTo(self.render)
        self.Ralph.setPos(0,10,-1)   # X,Y,Z"""

        # Carga de imágenes
        self.Perro = OnscreenImage(image='src/images/Dog.png')
        self.Vaca = OnscreenImage(image='src/images/Cow.png')
        self.Leon = OnscreenImage(image='src/images/Lion.png')
        self.Perro.setScale(.2, .2, .2)
        self.Vaca.setScale(.2, .2, .2)
        self.Leon.setScale(.2, .2, .2)
        self.Perro.setPos(-1, 0, 0)
        self.Vaca.setPos(0, 0, 0)
        self.Leon.setPos(1, 0, 0)

        # Carga de audio
        self.audioPerro = loader.loadSfx("src/sounds/Dog.mp3")
        self.audioPerro.play()

        #self.audioPerro.play()

        # Definir articulaciones con Joint
        """self.BrazoDerecho = self.Ralph.controlJoint(None, 'modelRoot', 'RightShoulder')
        self.BrazoIzquierdo = self.Ralph.controlJoint(None, 'modelRoot', 'LeftShoulder')

        # Movimientos con el brazo derecho
        self.moverBrazoDerechoAbajo = self.BrazoDerecho.hprInterval(1.0, Point3(72.2059, 106.186,-45))
        self.moverBrazoDerechoArriba = self.BrazoDerecho.hprInterval(1.0, Point3(72.2059, 76.186, 6.02231))
        self.Secuencia1 = Sequence(self.moverBrazoDerechoAbajo, self.moverBrazoDerechoArriba)

        # Movimientos con el brazo izquierdo
        self.moverBrazoIzquierdoAbajo = self.BrazoIzquierdo.hprInterval(1.0, Point3(160.1401, -22.1706, 6.55722))
        self.moverBrazoIzquierdoArriba = self.BrazoIzquierdo.hprInterval(1.0, Point3(80.1401, -52.1706, 6.55722))
        self.Secuencia2 = Sequence(self.moverBrazoIzquierdoAbajo, self.moverBrazoIzquierdoArriba)

        # Movimientos paralelos
        self.Paralelo = Parallel(self.Secuencia1, self.Secuencia2)"""

        # Add Eventos
        self.accept("escape", sys.exit)
        self.accept("a", self.ralphRun)
        self.accept("s", self.ralphSaluda)
        self.accept("q", self.ralphGiraI)
        self.accept("e", self.ralphGiraD)
Exemple #9
0
 def __init__(self, lrtb, track_img, handle_img, col_dct, cars, player_car):
     self.lrtb = lrtb
     self.minimap = OnscreenImage(track_img,
                                  pos=(-.25, 1, .25),
                                  scale=.2,
                                  parent=eng.base.a2dBottomRight)
     self.minimap.setTransparency(True)
     self.minimap.setAlphaScale(.64)
     self.car_handles = {}
     cars = cars[:]
     cars.remove(player_car)
     cars += [player_car]
     for car_name in cars:
         scale = .015 if car_name == player_car else .01
         self.car_handles[car_name] = OnscreenImage(
             handle_img,
             pos=(-.25, 1, .25),
             scale=scale,
             parent=eng.base.a2dBottomRight)
         col = col_dct[car_name]
         self.car_handles[car_name].set_color_scale(col)
     map(lambda car: car.setTransparency(True), self.car_handles.values())
     self.width = self.minimap.getScale()[0] * 2.0
     self.height = self.minimap.getScale()[2] * 2.0
     center_x, center_y = self.minimap.getX(), self.minimap.getZ()
     self.left_img = center_x - self.width / 2.0
     self.bottom_img = center_y - self.height / 2.0
Exemple #10
0
 def healthBar1(self, entry):
     #print entry
     if self.health[0] > 0:
         self.health[0] -= .422 / 10
         print "Player1 got hit, Health1: " + str(self.health[0])
         OnscreenImage(image="images/BlueFox/BlueFox_HBred.png",
                       pos=(-1, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_green.png",
                       pos=(-1 - .1, 0, .89),
                       scale=(self.health[0], .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/BlueFox/BlueFox_HB.png",
                       pos=(-1, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_reflection.png",
                       pos=(-1, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
     else:
         print "Player1 was Killed!"
         self.player[0].detachNode()
         OnscreenImage(image="images/GameOver_Blue.png",
                       pos=(-0.7, 0, 0.5),
                       scale=(0.7, 0.5, 0.5)).setTransparency(
                           TransparencyAttrib.MAlpha)
Exemple #11
0
    def configureDance(self):
        self.PRESSED,self.NPRESSED,self.PERFECT,self.GOOD,self.MISS=10,-10,2,1,0
        danceNode = self.render.attachNewNode(PandaNode('dance'))

        # load and set up scene
        danceScene = self.loader.loadModel("../models/disco_hall")
        danceScene.reparentTo(danceNode)
        danceScene.setPosHpr(0, 50, -4, 90, 0, 0)

        self.configureLights(danceNode)
        self.configureDancer(danceNode)

        scoreCircle=OnscreenImage(
                        image = '../textures/arrivalCircle.png', pos = (-1,0,0.8))
        scoreCircle.setTransparency(TransparencyAttrib.MAlpha)
        scoreCircle.setScale(0.2)
        scoreText= OnscreenText(text =str(0), pos = (-1.02,0.76), 
                            scale = 0.1,fg=(1,1,1,1))

        position=self.dancer.getPos()
        position[1]=0
        position[2]=-0.4
        GUIarrows=DirectFrame(frameColor=(0.3,0.3,0.7,0.3),
                                    frameSize=(-0.8,.8,0.2,-0.2),
                                    pos=position)

        hitSign=OnscreenImage(image ='../textures/circle.png', pos = (-0.6, 0, -0.4))
        hitSign.setTransparency(TransparencyAttrib.MAlpha)
        hitSign.setScale(0.15)
        scoreReminder=OnscreenText(text ='PERFECT', pos = (-0.6,-0.4), 
                            scale = 0.04,fg=(1,1,1,1),shadow=(0.4,0.4,0.7,0.3))

        self.setPanel('dance',Panel(danceNode, {'scoreCircle': scoreCircle,
            'GUIarrows':GUIarrows,'hitSign': hitSign,'scoreText': scoreText,
            'scoreReminder': scoreReminder}))
Exemple #12
0
 def healthBar2(self, entry):
     #print entry
     if self.health[1] > 0:
         self.health[1] -= .422 / 10
         print "Player2 got hit, Health2: " + str(self.health[1])
         OnscreenImage(image="images/RedFox/RedFox_HBred.png",
                       pos=(.3, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_green.png",
                       pos=(.3 - .1, 0, .89),
                       scale=(self.health[1], .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/RedFox/RedFox_HB.png",
                       pos=(.3, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_reflection.png",
                       pos=(.3, 0, .89),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
     else:
         print "Player2 was Killed!"
         self.player[1].detachNode()
         OnscreenImage(image="images/GameOver_Red.png",
                       pos=(0.7, 0, 0.5),
                       scale=(0.7, 0.5, 0.5)).setTransparency(
                           TransparencyAttrib.MAlpha)
    def initUI(self):
        self.font = loader.loadFont('./fonts/Magenta.ttf')

        self.lifes = [
            OnscreenImage(image='./UI/fox-icon-png-8.png',
                          pos=(1.1, 0, 0.8),
                          scale=0.05),
            OnscreenImage(image='./UI/fox-icon-png-8.png',
                          pos=(1.2, 0, 0.8),
                          scale=0.05)
        ]

        self.lifes[0].setTransparency(True)
        self.lifes[1].setTransparency(True)

        self.dialogScreen = DirectDialog(frameSize=(-0.7, 0.7, -0.7, 0.7),
                                         relief=DGG.FLAT)

        s = OnscreenImage(image='./UI/fox-icon-png-8.png',
                          pos=(0, 0, -0.2),
                          scale=0.20,
                          parent=self.dialogScreen)
        s.setTransparency(True)

        self.titleUI = DirectLabel(text="Starfox Region 4",
                                   parent=self.dialogScreen,
                                   scale=0.1,
                                   pos=(0, 0, .2),
                                   text_font=self.font)

        self.btn = DirectButton(text="Start",
                                command=self.startGame,
                                pos=(0, 0, 0),
                                parent=self.dialogScreen,
                                scale=0.07)
Exemple #14
0
 def healthBar3(self, entry):
     #print entry
     if self.health[2] > 0:
         self.health[2] -= .422 / 10
         print "Player3 got hit, Health3: " + str(self.health[2])
         OnscreenImage(image="images/GreenFox/GreenFox_HBred.png",
                       pos=(-1, 0, -.12),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_green.png",
                       pos=(-1 - .1, 0, -.12),
                       scale=(self.health[2], .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/GreenFox/GreenFox_HB.png",
                       pos=(-1, 0, -.12),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
         OnscreenImage(image="images/Healthbar_reflection.png",
                       pos=(-1, 0, -.12),
                       scale=(.3, .3, .13)).setTransparency(
                           TransparencyAttrib.MAlpha)
     else:
         print "Player3 was Killed!"
         self.player[2].detachNode()
         OnscreenImage(image="images/GameOver_Green.png",
                       pos=(-0.7, 0, -0.5),
                       scale=(0.7, 0.5, 0.5)).setTransparency(
                           TransparencyAttrib.MAlpha)
Exemple #15
0
    def initSave(self):
        self.erosionFrame = DirectFrame(frameColor=(0, 0, 0, 0),
                                        frameSize=(-1, 1, -1, 1),
                                        pos=(-1.2, 0, 0))
        self.erosionFrame.hide()
        self.erosionFrame.setScale(.02, 1, .4)
        self.background = OnscreenImage('res/erosion_bar.png',
                                        pos=(0, 0, 0),
                                        scale=(1, 1, 1))
        self.background.setTransparency(TransparencyAttrib.MAlpha)
        self.background.reparentTo(self.erosionFrame)
        # self.erosionBar = DirectWaitBar(value=self.EROSION, pos=(0, 0, 0), barTexture='res/erosion_value.png',
        #                                 relief=None)
        # self.erosionBar.setHpr(0, 0, -90)
        # self.erosionBar.setScale(0.98, 1, 10)
        # self.erosionBar.hide()
        # self.erosionBar.reparentTo(self.erosionFrame)
        self.erosionBar = OnscreenImage('res/erosion_value.png',
                                        pos=(0, 0, 0),
                                        scale=(1, 1, 1))
        self.erosionBar.setScale(1)
        self.erosionBar.setTransparency(TransparencyAttrib.MAlpha)
        self.erosionBar.reparentTo(self.erosionFrame)

        self.currentItemFrame = DirectFrame(
            frameColor=(0, 0, 0, 0),
            frameSize=(-2, 2, -2, 2),
            pos=(-1.2, 0, .8),
            image='res/models/items/injection.png',
            scale=(.1))
        self.currentItemFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.currentItemFrame.hide()
Exemple #16
0
    def mapPrev(self, task):
        #show map in corner with all player's positions

        radius = 0.085
        length = 2 * radius
        #image made in Preview
        mapP = OnscreenImage(image='images/straightMap.png',
                             pos=(1, 0, 0.8),
                             scale=0.1)
        self.OSimageText.append(mapP)

        marioProg = self.getPlayerProg(self.mario)
        marioY = (0.8 - radius) + length * marioProg

        yoshiProg = self.getPlayerProg(self.yoshi)
        yoshiY = (0.8 - radius) + length * yoshiProg

        finishY = 0.8 + radius

        #images made in Preview
        marioSym = OnscreenImage(image='images/mariosym.png',
                                 pos=(1, 0, marioY),
                                 scale=0.01)
        yoshiSym = OnscreenImage(image='images/yoshisym.png',
                                 pos=(1, 0, yoshiY),
                                 scale=0.01)
        finishSym = OnscreenImage(image='images/finishsym.png',
                                  pos=(1, 0, finishY),
                                  scale=0.01)

        self.OSimageText.append(marioSym)
        self.OSimageText.append(yoshiSym)
        self.OSimageText.append(finishSym)

        return task.cont
Exemple #17
0
 def addOption(self, name, function):
     '''
     '''
     image = OnscreenImage(self.imagesDB[name][0][0],
                           self.imagesDB[name][1], self.imagesDB[name][2])
     imageSelected = OnscreenImage(self.imagesDB[name][0][1],
                                   self.imagesDB[name][1],
                                   self.imagesDB[name][2])
     self.options.append((name, function, image, imageSelected))
    def _setup(self):
        self.debug("Setting up render pipeline")
        # First, we need no transparency
        render.setAttrib(TransparencyAttrib.make(TransparencyAttrib.MNone),
                         100)

        # Now create deferred render buffers
        self._makeDeferredTargets()

        # Setup compute shader for lighting
        self._createLightingPipeline()

        # Setup combiner
        self._createCombiner()

        self.deferredTarget.setShader(
            BetterShader.load("Shader/DefaultPostProcess.vertex",
                              "Shader/TextureDisplay.fragment"))
        self._setupAntialiasing()

        self._createFinalPass()

        self.antialias.getFirstBuffer().setShaderInput(
            "lastFrame", self.lightingComputeCombinedTex)
        self.antialias.getFirstBuffer().setShaderInput("lastPosition",
                                                       self.lastPositionBuffer)
        self.antialias.getFirstBuffer().setShaderInput(
            "currentPosition", self.deferredTarget.getColorTexture())

        # self.deferredTarget.setShaderInput("sampler", self.lightingComputeCombinedTex)
        # self.deferredTarget.setShaderInput("sampler", self.antialias.getResultTexture())
        self.deferredTarget.setShaderInput("sampler",
                                           self.finalPass.getColorTexture())
        # self.deferredTarget.setShaderInput("sampler", self.combiner.getColorTexture())

        # self.deferredTarget.setShaderInput("sampler", self.lightingComputeCombinedTex)
        # self.deferredTarget.setShaderInput("sampler", self.antialias._neighborBuffer.getColorTexture())
        # self.deferredTarget.setShaderInput("sampler", self.antialias._blendBuffer.getColorTexture())
        # self.deferredTarget.setShaderInput("sampler", self.lightingComputeCombinedTex)

        # add update task
        self._attachUpdateTask()

        # compute first mvp
        self._computeMVP()
        self.lastLastMVP = self.lastMVP

        # DirectFrame(frameColor=(1, 1, 1, 0.2), frameSize=(-0.28, 0.28, -0.27, 0.4), pos=(base.getAspectRatio() - 0.35, 0.0, 0.49))
        self.atlasDisplayImage = OnscreenImage(
            image=self.lightManager.getAtlasTex(),
            pos=(base.getAspectRatio() - 0.35, 0, 0.5),
            scale=(0.25, 0, 0.25))
        self.lastPosImage = OnscreenImage(
            image=self.lightingComputeCombinedTex,
            pos=(base.getAspectRatio() - 0.35, 0, -0.05),
            scale=(0.25, 0, 0.25))
Exemple #19
0
 def __init__(self):
     self.bg_particle = particle.StarParticles()
     self.bg_particle.start(render2d)
     self.bg_particle.setPos(.0, 1.5, 1.0)
     
     self.TITLE_SCALE = (512.0/base.win.getXSize(), 1 ,256.0/base.win.getYSize())
     
     self.bg = OnscreenImage(image='./image/bg.png', pos = (0.0, 2.0, 0.0), parent=render2d)
     self.bg.setTransparency(TransparencyAttrib.MAlpha)
     
     
     self.title_img = OnscreenImage(image='./image/title.png', pos = (0.0, 1.0, 0.6), scale = self.TITLE_SCALE, parent=render2d)
     self.title_img.setTransparency(TransparencyAttrib.MAlpha)
     
     texts = [OnscreenText(text='Start', scale=0.2, font=babelfish_font, align=TextNode.ACenter, fg=(1,1,1,1)),
         OnscreenText(text='Training',  scale=0.2, font=babelfish_font, align=TextNode.ACenter, fg=(1,1,1,1)),
         OnscreenText(text='Options',  scale=0.2, font=babelfish_font, align=TextNode.ACenter, fg=(1,1,1,1)),
         OnscreenText(text='Exit',  scale=0.2, font=babelfish_font, align=TextNode.ACenter, fg=(1,1,1,1))]
     
     for i in range(len(texts)):
         node = aspect2d.attachNewNode("TextPos%d" % i)
         texts[i].reparentTo(node)
         node.setZ(-0.15*(i+1) - .08)
     
     self.options = [
         {
             'action':'start',
             'node': texts[0],
         },
         {
             'action':'training',
             'node': texts[1]
         },
         {
             'action':'options',
             'node': texts[2]
         },
         {
             'action':'exit',
             'node': texts[3]
         },
     ]
         
     
     for opt in self.options:            
         opt['sel_interval'] = Parallel(LerpScaleInterval(opt["node"], duration=0.2, startScale=1.0, scale=1.4, blendType='easeOut'), SoundInterval(menuSfx))
         opt['des_interval'] = LerpScaleInterval(opt["node"], duration=0.2, startScale=1.4, scale=1.0, blendType='easeOut')
     
     self.curr_option = 0
     self.options[self.curr_option]['sel_interval'].finish()
     
     self.copyright_text = OnscreenText(text='MoonBunny (c) TrombaSoft 2007', shadow=(.0,.0,.0,1), scale=0.09, pos=(.0, -.95), align=TextNode.ACenter, fg=(1,1,1,1))
Exemple #20
0
    def __init__(self):
        DirectObject.__init__(self)

        self.pathSmoothening = True
        self.showWaypoints = False
        self.showCollisions = False

        self.accept("escape", sys.exit)

        self.__setupEnvironment()
        self.__setupCollisions()
        self.__setupGravity()
        self.__setupLevel()
        self.__setupMainAgent()
        #        self.__setupOtherAgents()
        self.__setupNPCs()
        self.__setupCamera()
        self.__setupRandomClutter()
        #Many things within the NPC are dependant on the level it is in.
        self.__room1NPC.setKeyAndNestReference(self.keyNest1, self.room1Key)
        self.__room2NPC.setKeyAndNestReference(self.keyNest2, self.room2Key)
        #self.__room2NPC.handleTransition("playerLeftRoom")
        self.__room3NPC.setKeyAndNestReference(self.keyNest3, self.room3Key)
        #self.__room3NPC.handleTransition("playerLeftRoom")
        self.__setupTasks()

        self.setKeymap()

        # This is for the HUD
        self.keyImages = {
            self.room1Key: "models/redKeyHUD.png",
            self.room2Key: "models/blueKeyHUD.png",
            self.room3Key: "models/greenKeyHUD.png"
        }
        self.room1KeyInHUD = False
        self.room2KeyInHUD = False
        self.room3KeyInHUD = False
        self.redKeyImage = OnscreenImage(image=self.keyImages[self.room1Key],
                                         pos=(0.9, 0, 0.9),
                                         scale=(0.0451, 0, 0.1))
        self.redKeyImage.setTransparency(TransparencyAttrib.MAlpha)
        self.redKeyImage.hide()
        self.blueKeyImage = OnscreenImage(image=self.keyImages[self.room2Key],
                                          pos=(0.7, 0, 0.9),
                                          scale=(0.0451, 0, 0.1))
        self.blueKeyImage.setTransparency(TransparencyAttrib.MAlpha)
        self.blueKeyImage.hide()
        self.greenKeyImage = OnscreenImage(image=self.keyImages[self.room3Key],
                                           pos=(0.5, 0, 0.9),
                                           scale=(0.0451, 0, 0.1))
        self.greenKeyImage.setTransparency(TransparencyAttrib.MAlpha)
        self.greenKeyImage.hide()
 def load_HUD(self):
     self.life_image = OnscreenImage(
         image=
         'Thats_so_Ravens/PureMagicApp/PureMagicAssets/life_images/rodney_lives_'
         + str(self.lives) + '.png',
         scale=(0.9, 0, 0.1),
         pos=(0.1, 0, 1.3))
     self.life_image.setTransparency(TransparencyAttrib.MAlpha)
     self.shield_image = OnscreenImage(
         image='Thats_so_Ravens/PureMagicApp/PureMagicAssets/Shield_off.png',
         scale=(0.1),
         pos=(0.8, 0, 1.0))
     self.shield_image.setTransparency(TransparencyAttrib.MAlpha)
Exemple #22
0
    def hud(self):
        self.font = self.loader.loadFont("./fnt/subatomic.tsoonami.ttf")
        self.aim = OnscreenImage(image="./png/ring.png", pos=Vec3(0), scale=0.02)
        self.aim.setTransparency(TransparencyAttrib.MAlpha)
        self.locker = OnscreenImage(image="./png/ring.png", pos=Vec3(0), scale=0.12)
        self.locker.setTransparency(TransparencyAttrib.MAlpha)
        self.locker.hide()

        self.txtFuel = OnscreenText(parent=self.render2d, align=TextNode.ALeft, pos=(-0.95, 0.8), text='FUEL', fg=(1, 1, 1, 0.5), scale=0.05, font=self.font, mayChange=True)
        self.txtSpeed = OnscreenText(parent=self.render2d, align=TextNode.ALeft, pos=(-0.95, 0.7), text='SPEED', fg=(1, 1, 1, 0.5), scale=0.05, font=self.font, mayChange=True)
        self.txtDist = OnscreenText(parent=self.render2d, align=TextNode.ALeft, pos=(-0.95, 0.6), text='DIST', fg=(1, 1, 1, 0.5), scale=0.05, font=self.font, mayChange=True)
        self.txtCoord = OnscreenText(parent=self.render2d, align=TextNode.ALeft, pos=(-0.95, 0.5), text='COORD', fg=(1, 1, 1, 0.5), scale=0.05, font=self.font, mayChange=True)
        self.taskMgr.doMethodLater(1, self.instruments, "task-instruments")
Exemple #23
0
	def enterInstructions(self):
		self.image = OnscreenImage(image="images/Instructions.jpg", pos=(0,0,0), scale=(1.4,1.4,1))
		self.menuBtn = DirectButton(text = "Menu",
									scale = 0.1, 
									pos = Vec3(0, 0, -0.8),
									command = self.request,
									extraArgs = ["Menu"])
Exemple #24
0
    def start(self):
        # load
        self.level2 = loader.loadModel("models/CECUT.bam")
        self.level2.reparentTo(render)
        self.level2.setScale(1, 1, 1)
        self.level2.setPos(0,0, 0)

        # start
        camera.setPos(0.5,-8.5,4)
        camera.lookAt(self.level2)

        # start
        self.background = OnscreenImage(
            parent=render2dp, image="textures/Skunight.png")  # Load an image object

        color = (0.8, 0.8, 0.8)
        #self.linfog = Fog("Scene-wide exponential Fog object")
        #self.linfog.setColor(*color)
        #self.linfog.setLinearRange(0, 35)
        #self.linfog.setLinearFallback(45, 160, 320)
        #render.setFog(self.linfog)
        base.setBackgroundColor(*color)
        self.plight = PointLight("plight")
        self.plight.setColor((1, 1, 1, 1))
        self.plight.setAttenuation((1, 0, 1))

        self.buttons()
        self.text = OnscreenText(font=self.runner_font, text='Que concierto deseas que se presente en el sotano de las ruinas del CECUT?', scale=0.09, pos=[
            0, 0.5], fg=[240, 10, 10, 1], shadow=[0.5, 0.5, 0.5, 0.5], shadowOffset=(0.04, 0.04),wordwrap=20)
Exemple #25
0
    def show_window(self):
        self.window = OnscreenImage(image="Interface/login_window.png",
                                    pos=(0, 0, 0),
                                    scale=(0.5, 1, 0.7))
        self.window.setTransparency(TransparencyAttrib.MAlpha)

        #add button
        self.usernameButton = DirectEntry(text="",
                                          scale=.05,
                                          pos=(-0.3, 0, 0.3),
                                          initialText="Username",
                                          numLines=2,
                                          focusInCommand=self.clearText1)

        self.passwordButton = DirectEntry(text="",
                                          scale=.05,
                                          pos=(-0.3, 0, 0.1),
                                          initialText="Password",
                                          numLines=2,
                                          focusInCommand=self.clearText2)

        self.submitButton = DirectButton(image="Interface/submit2.png",
                                         pos=(-0.05, 0, -0.2),
                                         scale=(0.2, 1, 0.07))
        self.submitButton.setTransparency(TransparencyAttrib.MAlpha)
Exemple #26
0
    def loadImages(self, urls):
        nodepaths=[]
        # z is the vertical axis in the 3D world
        sx,sz = getattr(self.config,'f_scale',[1.0,1.0])
        horGap = getattr(self.config,'f_horgap',0.1)
        vertGap = getattr(self.config,'f_vertgap',0.1)

        # for horizontal distribution
        # incX: distance between centers
        # inc = vertGap + 2.0*sx
        # startX is the first position (all the space / 2)
        incX = vertGap + 2.0*sx
        startX = - (len(urls)-1)*incX/2.0 

        # load each texture
        # the screen x coord in 2D goes from -1.6 to 1.6 (left to right horizontally)
        # the screen z coord in 2D goes from -1 to 1 (top-down vertically)
        try:
            for i in urls:
                # no need to reparent to render or aspect or anything!!!!
                nodepath = OnscreenImage( image = i , scale = Vec3(sx,1.0,sz))
                nodepath.setTransparency(TransparencyAttrib.MAlpha)
                nodepath.setX(startX)
                startX += incX
                nodepaths.append(nodepath)
        except:
            print "Fatal error, could not load texture file or model in models/plane"
            print "Check the file path"
            sys.quit()
        return nodepaths
Exemple #27
0
 def update_trial_command(self):
     self.dirtext.setText(str(self.table[self.trial_counter,2]))
     if self.hand == 'Left':
         xfac = -0.25
     else:
         xfac = 0.25
     self.imageObject = OnscreenImage(image = str(self.table[self.trial_counter,3]),scale=(xfac,0.25,0.25),pos=(-0.8, 0, 0.3))
Exemple #28
0
    def _renderItemsIcons(self):

        self.iconsNode.node().removeAllChildren()
        for icon in self.itemIcons:
            icon.destroy()
        self.itemIcons = []

        startItem = 0
        endItem = self.inventory.getSlotsCount()
        if self.itemsRange is not None:
            startItem = self.itemsRange[0]
            endItem = self.itemsRange[1]

        for i in xrange(endItem - startItem):
            itemNum = startItem + i
            s = self.inventory.getSlotByNum(itemNum)
            if not s.isFree():
                # get slot position and size in aspect2d space
                p, sz = self.slotsLayout.getRelativeSlotPosSize(s.getNum())
                itemImage = s.getItem().getImage()
                imagePath = self.game.getResources().getResourceFullPath(
                    PanoConstants.RES_TYPE_TEXTURES, itemImage)
                iconNode = OnscreenImage(parent=self.iconsNode,
                                         image=imagePath,
                                         pos=(p[0] + sz[0] / 2.0, 0.0,
                                              p[1] + sz[1] / 2.0),
                                         scale=0.2)
                iconNode.setTransparency(TransparencyAttrib.MAlpha)
                iconNode.setBin("fixed",
                                PanoConstants.RENDER_ORDER_INVENTORY_ITEMS)
                self.itemIcons.append(iconNode)
Exemple #29
0
    def _createBackdrop(self, show=True):
        """
        Setups rendering for the inventory's backdrop image.
        The backdrop image is rendered through a OnscreenImage object and is attached under the scenegraph node
        named Inventory.BACKDROP_NODE.
        If the parameter show is True then the backdrop image becomes visible as well, otherwise it is hidden.
        """
        if self.backdropImageObject is not None:
            self.backdropImageObject.destroy()
            self.backdropImageObject = None

        if self.backdropNode is not None:
            self.backdropNode.removeNode()

        imagePath = self.game.getResources().getResourceFullPath(
            PanoConstants.RES_TYPE_TEXTURES, self.backdropImage)

        self.backdropNode = self.node.attachNewNode(
            InventoryView.BACKDROP_NODE)
        self.backdropImageObject = OnscreenImage(parent=self.node,
                                                 image=imagePath,
                                                 pos=(self.pos[0], 0.0,
                                                      self.pos[1]),
                                                 sort=0)

        self.backdropImageObject.setTransparency(TransparencyAttrib.MAlpha)
        self.backdropImageObject.setBin("fixed",
                                        PanoConstants.RENDER_ORDER_INVENTORY)

        if not show:
            self.backdropNode.hide()
Exemple #30
0
    def makeGUI(self):
        '''
        Creates GUI controls and renders on screen
        Health, targeting reticle, ammunition, weapon display, score
        store results in self.playerGUI
        '''
        # TODO GUI logic for player
        self.playerGUI = DirectFrame(
            frameSize=(base.a2dLeft, base.a2dRight, base.a2dBottom,
                       base.a2dTop),
            frameColor=(0, 0, 0, 0)  #make completely transparent
        )
        reticle = OnscreenImage(image='images/reticle.png',
                                scale=(0.5, 1, .25))
        reticle.setTransparency(TransparencyAttrib.MAlpha)
        reticle.reparentTo(self.playerGUI)
        self.playerGUI.HP = OnscreenText(text="HEALTH",
                                         pos=(0.95, 0.8),
                                         scale=0.2,
                                         fg=(0, 0, 90, 1),
                                         align=TextNode.ACenter,
                                         mayChange=1)

        self.playerGUI.HP.reparentTo(self.playerGUI)
        self.playerGUI.score = OnscreenText(text="Score: 0",
                                            pos=(-1.5, 0.8),
                                            scale=0.2,
                                            fg=(0, 0, 90, 1),
                                            align=TextNode.ALeft,
                                            mayChange=1)
        self.playerGUI.score.reparentTo(self.playerGUI)