Esempio n. 1
0
def add_barrier(state, x, y, r):
        barrier_count = user.get_data(state, "n_barriers")
        barrier_entity_name = "barrier_%d" % barrier_count
        user.set_data(state, "n_barriers", barrier_count + 1)

        entities.insert(state,
                barrier_entity_name,
                {
                        "*": {
                                "textures": ("assets/img/sprites/barrier.png",),
                        },
                },
                (
                        x,
                        y,
                        r,
                ),
                collision=(("rectangle", 0.0, 0.0, 0.5, 0.125),))
        physical_mover.add(state,
                barrier_entity_name,
                0.5,
                0,
                0,
                0,
                0,
                0.92,
                YAPYG_STD_INELASTICITY,
                0,
                YAPYG_STD_ROT_FRICTION,
                YAPYG_STD_ROT_DECAY,
                YAPYG_STD_STICKYNESS,
                )
Esempio n. 2
0
def add_barrel(state, x, y):
        barrel_count = user.get_data(state, "n_barrels")
        barrel_entity_name = "barrel_%d" % barrel_count
        user.set_data(state, "n_barrels", barrel_count + 1)

        entities.insert(state,
                barrel_entity_name,
                {
                        "*": {
                                "textures": ("assets/img/sprites/barrel.png",),
                        },
                },
                (
                        x,
                        y,
                        0,
                ),
                collision=(("circle", (1.0 / 4.0) / 2.0, (1.0 / 4.0) / 2.0, (1.0 / 4.0) / 2.0,),))
        physical_mover.add(state,
                barrel_entity_name,
                0.01,
                0,
                0,
                0,
                0,
                0.92,
                YAPYG_STD_INELASTICITY,
                0,
                YAPYG_STD_ROT_FRICTION,
                YAPYG_STD_ROT_DECAY,
                YAPYG_STD_STICKYNESS,
                )
Esempio n. 3
0
def add_barrier(state, x, y, r):
    barrier_count = user.get_data(state, "n_barriers")
    barrier_entity_name = "barrier_%d" % barrier_count
    user.set_data(state, "n_barriers", barrier_count + 1)

    entities.insert(state,
                    barrier_entity_name, {
                        "*": {
                            "textures": ("assets/img/sprites/barrier.png", ),
                        },
                    }, (
                        x,
                        y,
                        r,
                    ),
                    collision=(("rectangle", 0.0, 0.0, 0.5, 0.125), ))
    physical_mover.add(
        state,
        barrier_entity_name,
        0.5,
        0,
        0,
        0,
        0,
        0.92,
        YAPYG_STD_INELASTICITY,
        0,
        YAPYG_STD_ROT_FRICTION,
        YAPYG_STD_ROT_DECAY,
        YAPYG_STD_STICKYNESS,
    )
Esempio n. 4
0
def add_barrel(state, x, y):
    barrel_count = user.get_data(state, "n_barrels")
    barrel_entity_name = "barrel_%d" % barrel_count
    user.set_data(state, "n_barrels", barrel_count + 1)

    entities.insert(state,
                    barrel_entity_name, {
                        "*": {
                            "textures": ("assets/img/sprites/barrel.png", ),
                        },
                    }, (
                        x,
                        y,
                        0,
                    ),
                    collision=((
                        "circle",
                        (1.0 / 4.0) / 2.0,
                        (1.0 / 4.0) / 2.0,
                        (1.0 / 4.0) / 2.0,
                    ), ))
    physical_mover.add(
        state,
        barrel_entity_name,
        0.01,
        0,
        0,
        0,
        0,
        0.92,
        YAPYG_STD_INELASTICITY,
        0,
        YAPYG_STD_ROT_FRICTION,
        YAPYG_STD_ROT_DECAY,
        YAPYG_STD_STICKYNESS,
    )
Esempio n. 5
0
def get_health(state):
        return user.get_data(state, USERDATA_HEALTH)
Esempio n. 6
0
def get_health_text(state):
        hp = user.get_data(state, USERDATA_HEALTH)
        hp_text = "Health:%d" % hp
        return hp_text
Esempio n. 7
0
def incr_score(state, points):
        score = user.get_data(state, USERDATA_SCORE)
        score += points
        user.set_data(state, USERDATA_SCORE, score)
        text.set_text_sprite(state, ENT_TEXT_SCORE, get_score_text(state), FONT_NAME, True)
Esempio n. 8
0
def get_score_text(state):
        score = user.get_data(state, USERDATA_SCORE)
        score_text = "Score:%d" % score
        return score_text