🎮ArcadeLab

Parkour

by CrystalBolt84
93 lines1.9 KB
▶ Play
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController

app = Ursina()

window.title = "Parkour Challenge"

player = FirstPersonController(
    position=(0,2,0),
    speed=6
)

Sky()

ground = Entity(
    model='cube',
    scale=(10,1,10),
    texture='white_cube',
    color=color.green,
    collider='box'
)

checkpoint_pos = Vec3(0,2,0)
difficulty = 0

class Checkpoint(Entity):
    def __init__(self, position):
        super().__init__(
            model='cube',
            color=color.yellow,
            scale=(2,1,2),
            position=position,
            collider='box'
        )

    def update(self):
        global checkpoint_pos

        if distance(self, player) < 2:
            checkpoint_pos = self.position + Vec3(0,2,0)
            self.color = color.orange

class KillBlock(Entity):
    def __init__(self, position):
        super().__init__(
            model='cube',
            color=color.red,
            position=position,
            scale=(4,1,4),
            collider='box'
        )

    def update(self):
        if distance(self, player) < 2:
            player.position = checkpoint_pos

def create_section(start_z, level):
    gap = min(8, 2 + level)

    for i in range(8):
        Entity(
            model='cube',
            color=color.azure,
            scale=(3,1,3),
            position=(0,0,start_z + i*(gap+3)),
            collider='box'
        )

    Checkpoint(position=(0,1,start_z+20))

for stage in range(10):
    create_section(stage*60, stage)

for i in range(15):
    KillBlock(position=(10,0,i*20))

Text(
    text="WASD = Move | SPACE = Jump",
    position=(-0.8,0.45),
    scale=1.5
)

def update():
    global difficulty

    if player.y < -20:
        player.position = checkpoint_pos

    difficulty = int(player.z // 60)

    window.title = f"Parkour Challenge - Difficulty {difficulty+1}"

app.run()

Game Source: Parkour

Creator: CrystalBolt84

Libraries: none

Complexity: moderate (93 lines, 1.9 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: minecraft-crystalbolt84" to link back to the original. Then publish at arcadelab.ai/publish.