</> ursina.prefabs.platformer_controller_2d
Inherits Entity
Initialization
PlatformerController2d()
Attributes
.model
default: 'cube'
.origin_y
default: -0.5
.scale_y
default: 2
.color
default: color.orange
.collider
default: 'box'
.animator
default: Animator({'idle': None, 'walk': None, 'jump': None...
.walk_speed
default: 8
.walking
default: False
.velocity
default: 0
the walk direction is stored here. -1 for left and 1 for right.
.jump_height
default: 4
.jump_duration
default: 0.5
.jumping
default: False
.max_jumps
default: 1
.jumps_left
default: self.max_jumps
.gravity
default: 1
.grounded
default: True
.air_time
default: 0
this increase while we're falling and used when calculating the distance we fall so we fall faster and faster instead of linearly.
.traverse_target
default: scene
by default, it will collide with everything except itself. you can change this to change the boxcast traverse target.
.ignore_list
default: [self]
.gravity
default: 0
.min_x
default: -99999
.max_x
default: 99999
.y
default: ray.world_point[1] + 0.01
Methods
update()
input(key=None)
jump()
start_fall()
land()