import time
# t = time.time()
from ursina
import *
from ursina.prefabs.platformer_controller_
2d
import PlatformerController
2d
# window.vsync = False
window.borderless = False
app = Ursina()
window.color = color.light_gray
camera.orthographic = True
camera.fov =
20
ground =
Entity(
model=
'cube',
color=color.olive.tint(-.
4),
z=-.
1,
y=-
1, origin_
y=.
5,
scale=(
1000,
100,
10),
collider=
'box',
ignore=True)
random.seed(
4)
for i in
range(
10):
Entity(
model=
'cube',
color=color.dark_gray,
collider=
'box',
ignore=True,
position=(random.randint(-
20,
20), random.randint(
0,
10)),
scale=(random.randint(
1,
20), random.randint(
2,
5),
10))
# ground = Entity(model='cube', color=color.white33, origin_y=.5, scale=(20, 10, 1), collider='box')
# wall = Entity(model='cube', color=color.azure, origin=(-.5,.5), scale=(5,10), x=10, y=.5, collider='box')
# ceiling = Entity(model='cube', color=color.white33, origin_y=.5, scale=(10, 1, 1), y=4, collider='box')
player = PlatformerController
2d()
player.x=
1
player.y = raycast(player.world_position, player.down).world_point[
1] + .
01
camera.add_script(SmoothFollow(target=player, offset=[
0,
5,-
30], speed=
4))
input_handler.bind(
'right arrow',
'd')
input_handler.bind(
'left arrow',
'a')
input_handler.bind(
'up arrow',
'space')
input_handler.bind(
'gamepad dpad right',
'd')
input_handler.bind(
'gamepad dpad left',
'a')
input_handler.bind(
'gamepad a',
'space')
# test
from ursina.scripts.noclip_mode
import NoclipMode
2d
player.add_script(NoclipMode
2d())
app.run()