def __object_at_index(self, index):
     split_path = (MODELS_PREFIX_DIR + scene.OBJECTS_LIST[index]["path"]).split("/")
     pfobj_dir = '/'.join(split_path[:-1])
     pfobj_filename = split_path[-1]
     if scene.OBJECTS_LIST[index]["anim"]:
         ret = pf.AnimEntity(pfobj_dir, pfobj_filename, pfobj_filename.split(".")[0], idle_clip=scene.OBJECTS_LIST[index]["idle"])
     else:
         ret = pf.Entity(pfobj_dir, pfobj_filename, pfobj_filename.split(".")[0])
     ret.scale = scene.OBJECTS_LIST[index]["scale"]
     ret.selection_radius = scene.OBJECTS_LIST[index]["sel_radius"]
     ret.selectable = True
     return ret
Exemplo n.º 2
0
############################################################
# Entities setup                                           #
############################################################

FIELD_WIDTH = 240
FIELD_HEIGHT = 120
PADDLE_HEIGHT = 16
PLAYER_SPEED = 2.5
COMPUTER_SPEED = 2.5
BALL_SPEED = 5.0

obelisks = []

# top, bot border
for i in range(-FIELD_WIDTH / 2, FIELD_WIDTH / 2, 4):
    top = pf.Entity("assets/models/props", "obelisk_2.pfobj", "border")
    top.pos = (-FIELD_HEIGHT / 2.0, 0.0, i)
    obelisks += [top]

    bot = pf.Entity("assets/models/props", "obelisk_2.pfobj", "border")
    bot.pos = (FIELD_HEIGHT / 2.0, 0.0, i)
    obelisks += [bot]

# left, right border
for i in range(-FIELD_HEIGHT / 2, FIELD_HEIGHT / 2, 4):
    left = pf.Entity("assets/models/props", "obelisk_2.pfobj", "border")
    left.pos = (i, 0.0, -FIELD_WIDTH / 2.0)
    obelisks += [left]

    right = pf.Entity("assets/models/props", "obelisk_2.pfobj", "border")
    right.pos = (i, 0.0, FIELD_WIDTH / 2.0)
Exemplo n.º 3
0
pf.set_emit_light_color([1.0, 1.0, 1.0])
pf.set_emit_light_pos([1024.0, 768.0, 768.0])

pf.new_game("assets/maps", "demo-arena.pfmap")
pf.set_map_render_mode(CHUNK_RENDER_MODE_PREBAKED)

############################################################
# Setup entities                                           #
############################################################

sinbad = sb.Sinbad("assets/models/sinbad", "Sinbad.pfobj", "Sinbad")
sinbad.pos = [-80.0, 18.0, -95.0]
sinbad.scale = [1.0, 1.0, 1.0]
sinbad.activate()

oak_tree = pf.Entity("assets/models/oak_tree", "oak_tree.pfobj", "OakTree")
oak_tree.pos = [-40.0, 14.0, -115.0]
oak_tree.scale = [2.0, 2.0, 2.0]
oak_tree.activate()

oak_leafless = pf.Entity("assets/models/oak_tree", "oak_leafless.pfobj",
                         "OakLeafless")
oak_leafless.pos = [-95.0, 18.0, -35.0]
oak_leafless.scale = [1.5, 1.5, 1.5]
oak_leafless.activate()

############################################################
# Setup global events                                      #
############################################################

active_cam_idx = 0