本文整理汇总了Python中gameobject.GameObject类的典型用法代码示例。如果您正苦于以下问题:Python GameObject类的具体用法?Python GameObject怎么用?Python GameObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GameObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_eq
def test_eq(self):
a = GameObject()
a.pos_x = 100
b = GameObject()
b.pos_x = 100
self.assertTrue(a == b)
pass
示例2: __init__
def __init__(self):
GameObject.__init__(self)
self.x = 0
self.y = 0
self.width = BLOCK_SIZE * 10
self.height = BLOCK_SIZE * 10
self.color = 0xFFFFFF
self.shape = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
]
self.blocks = []
for row_index, row in enumerate(self.shape):
myrow = []
for col_index, col in enumerate(row):
if col == 1:
myrow.append(Block(self, self.color, col_index * BLOCK_SIZE, row_index * BLOCK_SIZE))
self.blocks.append(myrow)
示例3: __init__
def __init__(self, name, xy, tiletype, can_be_eaten=True, hp_gain=0, mp_gain=0):
GameObject.__init__(self, xy, tiletype, solid=False, draw_once_seen = False)
self.name = name
self.time_to_live = 10
self.can_be_eaten = can_be_eaten
self.hp_gain = hp_gain
self.mp_gain = mp_gain
示例4: __init__
def __init__(self, root, x, y):
GameObject.__init__(self, root, x, y)
self.lifeAlarm = 0
self.direction = 0
self.sprite = load_image("sprites/projectiles/shots/0.png")
self.rect = self.sprite.get_rect()
示例5: __init__
def __init__(self, xy, name, type, variant=0, resources_left=1):
GameObject.__init__(self, xy, type, solid=True, draw_once_seen=True)
self.action = None
self.view = make_rect(Pos(0,0), globals.SCREEN_SIZE)
self.tile_variant = variant
self.name = name
self.resources_left = resources_left
self.seen = False
示例6: __init__
def __init__(self, game, position=(0, 0), angle=0, is_inside=True, radius=1, image='images/default.png', density=20,
friction=8, name='Circle'):
GameObject.__init__(self, game, position=position, angle=angle, is_inside=is_inside, image=image)
size = self.surface.origin.get_size()
self.name = name
self.radius = ((size[0] + size[1]) / 4) / game.PPM
self.body.CreateCircleFixture(radius=radius,
density=density,
friction=friction)
示例7: __init__
def __init__(self):
GameObject.__init__(self)
self.orientation = -1 # 0 = horizontal, 1=vertical
self.graphic = 0
self.startPosition = [0,0]
self.length = 0
self.portalList = []
self.wallExists = []
self.exteriorWallID = -1
示例8: draw
def draw(self):
if self.game.debug:
for i in range(len(self.body.fixtures)):
pt = self._place(i)
pygame.draw.circle(self.game.screen, (20, 20, 20), self.game.to_screen(pt),
int(10 * self.game.camera.zoom), 1)
pt = self._place(i, False)
pygame.draw.circle(self.game.screen, (20, 20, 20), self.game.to_screen(pt),
int(10 * self.game.camera.zoom), 1)
GameObject.draw(self)
示例9: __init__
def __init__(self, name=None, position=None, texImg=None, specTexImg=None, radius=None,
mass=None, spin=None, shininess=None, ka=None, kd=None,
ks=None, program=None):
GameObject.__init__(self, name=name, position=position, texImg=texImg,
specTexImg=specTexImg, shininess=shininess, ka=ka, kd=kd,
ks=ks, program=program)
self.radius = radius
self.mass = mass
self.spin = spin
self._initModel()
示例10: __init__
def __init__(self, game, brain, x, y):
GameObject.__init__(self, game, x, y)
game.creaturelist.append(self)
self.size = 10
self.score = 0
self.direction = 0
self.brain = brain
self.lefteye = eye.Eye(self, game)
self.righteye = eye.Eye(self, game)
self.leftimage = []
self.rightimage = []
示例11: __init__
def __init__(self, name = None, min = [0,0,0], max = [5,5,5]):
self.name = name
self.min = min
self.max = max
self.type = "Box"
self.pointselection = -1
GameObject.__init__(self)
示例12: __init__
def __init__(self):
self.program = Program()
self.vao = GLuint(0)
self.vbuf = None
self.ibuf = None
self.vertices = []
self.normals = []
self.indices = []
self.uvs = []
# we should really be getting the camera not creating a new instance..
self.camera = Camera(800, 600)
GameObject.__init__(self)
示例13: __init__
def __init__(self, root, x, y):
GameObject.__init__(self, root, x, y)
self.owner = None
self.firingSprite = None
self.ammo = 0
self.maxAmmo = 0
self.justShot = False
self.readyToShoot = True
self.refireAlarm = 0
self.direction = 0
示例14: __init__
def __init__(self, name = None, x = 1, y = 1, z = 1):
self.name = name
self.x = x
self.y = y
self.z = z
self.type = "Point"
self.pointselection = -1
self.r = 1
GameObject.__init__(self)
示例15: draw
def draw(self):
mouse_x, mouse_y = pygame.mouse.get_pos()
if point_direction(self.x, self.y, mouse_x + self.root.Xview, mouse_y + self.root.Yview) > 90 and point_direction(self.x, self.y, mouse_x + self.root.Xview, mouse_y + self.root.Yview) < 270:
if self.flip == 0:
self.sprite = pygame.transform.flip(self.sprite, 1, 0)
self.flip = 1
else:
if self.flip:
self.sprite = pygame.transform.flip(self.sprite, 1, 0)
self.flip = 0
GameObject.draw(self)