Пример #1
0
    fps = 0
    lastFPS = 0
    animate = 0.0
    lastFrame = time.time()
    timeStep = 1.0 / 160
    vel_iters, pos_iters = 6, 2
    borrar_bullet = []
    borrar_asteroids = []
    updateFPS()
    t_delta = getDelta()
    bullet = []
    asteroids_dic = dict()
    myListener = myContactListener(borrar_bullet)
    myDestructor = myDestructionListener()
    world=b2World(gravity=(0,0),contactListener=myListener, destructorListener=myDestructor)
    mapa = chunk(0,0,world)
    #generate asteroids
    for ids in range(10):
        asteroids_dic[ids] = asteroids(world, [randint(-10000,10000)/100,randint(-10000,10000)/100], borrar_asteroids, ids)

    # Se prepara el servidor
    #server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server = socket.socket(socket.SOCK_DGRAM)
    global clientes
    clientes = []
    maestro = mainProcess(clientes, bullet, borrar_bullet, borrar_asteroids,  asteroids_dic)
    maestro.start()
    try:
        server_name = sys.argv[1]
    except:
        server_name = "Default name"
Пример #2
0
def initFun():
    print "initFun"
    glEnable(GL_AUTO_NORMAL)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_BLEND)
    glClearColor(0.0, 0.0, 0.0, 0.0)
    #reshapeFun(resolution[0],resolution[1])
    ### load textures and initial chunk
    global textures
    global Lchunk
    global player
    global world
    global civiles
    global civiles_muertos
    global global_DL
    global civiles_muertos_DL
    global vida_DL
    global last_total_kills
    global total_kills_DL
    global total_kills
    global last_kill
    global trenecito
    global last_damage

    last_total_kills = -1
    last_kill = [-1, -1]
    last_damage = 0.0
    total_kills = 0
    civiles_muertos_DL = glGenLists(1)
    vida_DL = glGenLists(1)
    total_kills_DL = glGenLists(1)
    global_DL = glGenLists(256)

    tmp2 = 0
    for taa in range(12, 256 + 12):
        glNewList(global_DL + tmp2, GL_COMPILE)
        basicas.draw_cube(0.16, tmp2)
        glEndList()
        tmp2 += 1

    civiles = []
    civiles_muertos = []
    clases.audio.stationMusic(0)

    textures.append(loadImage('assets/stGrid1.png'))
    textures.append(loadImage('assets/player.png'))
    textures.append(loadImage('assets/bullet.png'))
    textures.append(loadImage('assets/stGriddeco.png'))
    textures.append(loadImage('assets/icons.png'))
    textures.append(loadImage('assets/tren_1.png'))
    textures.append(loadImage('assets/inicio.png'))
    textures.append(loadImage('assets/gameover.png'))
    textures.append(loadImage('assets/frases1.png'))

    player = player(bullet, joints, borrar, global_DL)
    myListener = myContactListener(borrar, player)
    myDestructor = myDestructionListener()
    world = b2World(contactListener=myListener,
                    destructorListener=myDestructor
                    )  # default gravity is (0,-10) and doSleep is True
    world.gravity = (0, 0)
    player.set_world(world)
    trenecito = tren([115, 29], world, bullet)
    Lchunk.append(chunk(0, 0, world, global_DL))
    enable_vsync()
    getDelta()
Пример #3
0
def initFun():
    print "initFun"
    glEnable(GL_AUTO_NORMAL)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    glEnable(GL_BLEND)
    glClearColor(0.0,0.0,0.0,0.0)
    #reshapeFun(resolution[0],resolution[1])
    ### load textures and initial chunk
    global textures
    global Lchunk
    global player
    global world
    global civiles
    global civiles_muertos
    global global_DL
    global civiles_muertos_DL
    global vida_DL
    global last_total_kills
    global total_kills_DL
    global total_kills
    global last_kill
    global trenecito
    global last_damage

    last_total_kills = -1
    last_kill = [-1,-1]
    last_damage = 0.0
    total_kills = 0
    civiles_muertos_DL = glGenLists(1)
    vida_DL = glGenLists(1)
    total_kills_DL = glGenLists(1)
    global_DL = glGenLists(256)

    tmp2 = 0
    for taa in range(12,256 + 12):
        glNewList(global_DL+tmp2, GL_COMPILE)
        basicas.draw_cube(0.16, tmp2)
        glEndList()
        tmp2 += 1

    civiles = []
    civiles_muertos = []
    clases.audio.stationMusic(0)

    textures.append(loadImage('assets/stGrid1.png'))
    textures.append(loadImage('assets/player.png'))
    textures.append(loadImage('assets/bullet.png'))
    textures.append(loadImage('assets/stGriddeco.png'))
    textures.append(loadImage('assets/icons.png'))
    textures.append(loadImage('assets/tren_1.png'))
    textures.append(loadImage('assets/inicio.png'))
    textures.append(loadImage('assets/gameover.png'))
    textures.append(loadImage('assets/frases1.png'))

    player = player(bullet, joints, borrar, global_DL)
    myListener = myContactListener(borrar, player)
    myDestructor = myDestructionListener()
    world=b2World(contactListener=myListener, destructorListener=myDestructor) # default gravity is (0,-10) and doSleep is True
    world.gravity = (0, 0)
    player.set_world(world)
    trenecito = tren([115,29], world, bullet)
    Lchunk.append(chunk(0,0, world, global_DL))
    enable_vsync()
    getDelta()