本文整理汇总了Python中pandac.PandaModules.BitMask32.allOn方法的典型用法代码示例。如果您正苦于以下问题:Python BitMask32.allOn方法的具体用法?Python BitMask32.allOn怎么用?Python BitMask32.allOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.BitMask32
的用法示例。
在下文中一共展示了BitMask32.allOn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOn [as 别名]
def __init__(self, x, y, z):
self.model = loader.loadModel("models/circle")
self.model.reparentTo(render)
self.model.setPos(x, y, z)
self.model.setHpr(0, 0, 0)
self.model.setColor(1, 1, 1, 1)
self.model.setTexture(loader.loadTexture('textures/spiral.png'))
self.glow = loader.loadModel("models/tube")
self.glow.reparentTo(render)
self.glow.setShaderOff()
self.glow.setLightOff()
self.glow.hide(BitMask32.allOn())
self.glow.show(BitMask32(0x01))
self.glow.setPos(x, y, z + 0.05)
self.glow.setHpr(0, 0, 0)
self.glow.setColor(1, 1, 1, 1)
texture = loader.loadTexture('textures/green_glow.png')
texture.setWrapU(Texture.WMClamp)
texture.setWrapV(Texture.WMClamp)
self.glow.setTexture(texture)
self.glow.setTransparency(TransparencyAttrib.MAlpha)
self._active = False
self.visibility = 0
taskMgr.add(self._update_task, "AcceleratorUpdateTask")
示例2: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOn [as 别名]
def __init__(self, render, world, base, originMap, hopper, idNum, strength = 1, size = 1.2):
self.render = render
self.world = world
self.base = base
self.originMap = originMap
self.hopper = hopper
self.idNum = idNum
self.strength = strength
self.size = size
self.volume = 1
self.turned = False
self.isAttacking = False
self.mult = 1
self.attackSound = self.base.loader.loadSfx("sounds/bloodSquirt.mp3")
self.attackSound.setVolume(1)
self.damageSound = self.base.loader.loadSfx("sounds/swordSlash.mp3")
self.damageSound.setVolume(0.5)
self.freeze = False
#----- Setup Enemy -----
h = 2.75
w = self.size + 0.2
enemyShape = BulletCapsuleShape(w, h - 2 * w, ZUp)
self.enemyBulletNode = BulletCharacterControllerNode(enemyShape, 0.4, "Enemy")
self.enemyNP = self.render.attachNewNode(self.enemyBulletNode)
self.enemyNP.setPos(originMap)
self.enemyNP.setH(90)
self.enemyNP.setCollideMask(BitMask32.allOn())
self.world.attachCharacter(self.enemyBulletNode)
self.enemyModel = Actor("models/art/monster/bvw-f2004--monster/monster1.egg", {
'idle' : 'models/art/monster/bvw-f2004--monster/monster1-idle.egg',
'explode' : 'models/art/monster/bvw-f2004--monster/monster1-explode.egg',
'attackL' : 'models/art/monster/bvw-f2004--monster/monster1-pincer-attack-left.egg',
'attackR' : 'models/art/monster/bvw-f2004--monster/monster1-pincer-attack-right.egg',
'attackT' : 'models/art/monster/bvw-f2004--monster/monster1-tentacle-attack.egg',
'attackLR' : 'models/art/monster/bvw-f2004--monster/monster1-pincer-attack-both.egg'})
self.enemyModel.reparentTo(self.enemyNP)
self.enemyModel.setScale(0.42 * self.size)
self.enemyModel.setH(180)
self.enemyModel.setPos(0, 0, 1)
self.enemyModel.loop("idle")
#self.setupPoison()
self.enemyCollider = self.enemyModel.attachNewNode(CollisionNode('enemyNode'))
self.enemyCollider.node().addSolid(CollisionSphere(0, 0, 0, 1))
self.enemyCollider.setTag("id", str(self.idNum))
示例3: __setupEnvironment
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOn [as 别名]
def __setupEnvironment(self):
cm = CardMaker("ground")
size = 200
cm.setFrame(-size, size, -size, size)
environment = render.attachNewNode(cm.generate())
environment.lookAt(0, 0, -1)
environment.setPos(100, -100, 0)
environment.setCollideMask(BitMask32.allOn())
environment.reparentTo(render)
texture = loader.loadTexture("textures/ground.png")
# This is so the textures can look better from a distance
texture.setMinfilter(Texture.FTLinearMipmapLinear)
environment.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition)
environment.setTexScale(TextureStage.getDefault(), 0.02, 0.02)
environment.setTexture(texture, 1)
示例4: __init__
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOn [as 别名]
#.........这里部分代码省略.........
# else, we rule that the move is illegal.
self.cTrav = CollisionTraverser()
self.playerGroundRay = CollisionRay()
self.playerGroundRay.setOrigin(0,0,1000)
self.playerGroundRay.setDirection(0,0,-1)
self.playerGroundCol = CollisionNode('playerRay')
self.playerGroundCol.addSolid(self.playerGroundRay)
self.playerGroundCol.setFromCollideMask(BitMask32.bit(3))
self.playerGroundCol.setIntoCollideMask(BitMask32.allOff())
self.playerGroundColNp = self.player.attachNewNode(self.playerGroundCol)
self.playerGroundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.playerGroundColNp, self.playerGroundHandler)
self.camGroundRay = CollisionRay()
self.camGroundRay.setOrigin(0,0,1000)
self.camGroundRay.setDirection(0,0,-1)
self.camGroundCol = CollisionNode('camRay')
self.camGroundCol.addSolid(self.camGroundRay)
self.camGroundCol.setFromCollideMask(BitMask32.bit(3))
self.camGroundCol.setIntoCollideMask(BitMask32.allOff())
self.camGroundColNp = base.camera.attachNewNode(self.camGroundCol)
self.camGroundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.camGroundColNp, self.camGroundHandler)
# Uncomment this line to see the collision rays
#self.playerGroundColNp.show()
#self.camGroundColNp.show()
#Uncomment this line to show a visual representation of the
#collisions occuring
#self.cTrav.showCollisions(render)
#Code for Enemy player
self.enemyGroundRay = CollisionRay()
self.enemyGroundRay.setOrigin(0,0,1000)
self.enemyGroundRay.setDirection(0,0,-1)
self.enemyGroundCol = CollisionNode('enemyRay')
self.enemyGroundCol.addSolid(self.enemyGroundRay)
self.enemyGroundCol.setFromCollideMask(BitMask32.bit(3))
self.enemyGroundCol.setIntoCollideMask(BitMask32.allOff())
self.enemyGroundColNp = self.enemy.attachNewNode(self.enemyGroundCol)
self.enemyGroundHandler = CollisionHandlerQueue()
self.cTrav.addCollider(self.enemyGroundColNp, self.enemyGroundHandler)
self.cRocketHandler = CollisionHandlerQueue()
self.worldEdge = CollisionInvSphere(0, 0, 0, 50)
cNode = CollisionNode("worldEdge")
cNode.addSolid(self.worldEdge)
cNode.setFromCollideMask(BitMask32.allOff())
cNode.setIntoCollideMask(BitMask32.allOn())
self.worldEdgeNp=self.environ.attachNewNode(cNode)
#self.cTrav.addCollider(self.worldEdgeNp, self.cRocketHandler)
#cNP = render.attachNewNode(cNode)
cNode2 = CollisionNode("wall")
cNode2.addSolid(CollisionPlane(Plane(Vec3(-1,0,0), Point3(22.5,0,0))))
cNode2.addSolid(CollisionPlane(Plane(Vec3(1,0,0), Point3(-22.5,0,0))))
cNode2.addSolid(CollisionPlane(Plane(Vec3(0,-1,0), Point3(0,22.5,0))))
cNode2.addSolid(CollisionPlane(Plane(Vec3(0,1,0), Point3(0,-22.5,0))))
cNode2.setFromCollideMask(BitMask32.allOff())
cNode2.setIntoCollideMask(BitMask32.allOn())
cNP2=self.environ.attachNewNode(cNode2)
self.picker = CollisionTraverser() #Make a traverser
self.pq = CollisionHandlerQueue() #Make a handler
#Make a collision node for our picker ray
self.pickerNode = CollisionNode('mouseRay')
#Attach that node to the camera since the ray will need to be positioned
#relative to it
self.pickerNP = camera.attachNewNode(self.pickerNode)
#Everything to be picked will use bit 1. This way if we were doing other
#collision we could seperate it
self.pickerNode.setFromCollideMask(BitMask32.allOn())
self.pickerRay = CollisionRay() #Make our ray
self.pickerNode.addSolid(self.pickerRay) #Add it to the collision node
#Register the ray as something that can cause collisions
self.picker.addCollider(self.pickerNP, self.pq)
self.playerrocket = None
self.enemyrocket = None
self.enemyTurn = 0
self.enemyDestAng = 180
self.enemyHp = 3
self.playerHp = 3
#Collisions
self.setupCollisions()
self.playermoving = False
#setup hud
self.drawHud()
示例5: PathFinder
# 需要导入模块: from pandac.PandaModules import BitMask32 [as 别名]
# 或者: from pandac.PandaModules.BitMask32 import allOn [as 别名]
from pandac.PandaModules import CollisionRay
from pandac.PandaModules import CollisionHandlerQueue
from pandac.PandaModules import CollisionTraverser
from pandac.PandaModules import GeomNode
from pandac.PandaModules import LineSegs
from pandac.PandaModules import NodePath
from pandac.PandaModules import Point3
from pandac.PandaModules import Vec3
import math
from math import sqrt
wallRayNP = render.attachNewNode(CollisionNode("wall ray collision node"))
wallRayNP.node().addSolid(CollisionRay(0,0,0,0,1,0))
wallRayNP.node().setIntoCollideMask(BitMask32.allOff())
wallRayNP.node().setFromCollideMask(BitMask32.allOn() & ~GeomNode.getDefaultCollideMask())
wallRayNP.node().setFromCollideMask(wallRayNP.node().getFromCollideMask() & ~BitMask32.bit(1))
#wallRayNP.show()
collisionHandler = CollisionHandlerQueue()
collisionTraverser = CollisionTraverser("pathfinder's collisionTraverser")
collisionTraverser.addCollider(wallRayNP, collisionHandler)
collisionTraverser.setRespectPrevTransform(True)
class PathFinder():
## def __init__(self, position, ID = -1):
## NodePath.__init__(self, "Waypoint")
## self.position = position
## self.texture = loader.loadTexture("textures/blue.jpg")
## self.costToThisNode = 0