# Issue with RigidBody2D mobile platform

Attention Topic was automatically imported from the old Question2Answer platform.

Hi everyone! I have a problem with a RigidBody2D mobile platform. When I jump on it with my KinematicBody2D player, the above platform flips and goes adrifts. How can I design a rigid mobile platform? Thank you!

You may need to post some code or a link to your project

Eric Ellingson | 2019-02-08 20:45

Ok, this is the platform code:

``````extends RigidBody2D

func _integrate_forces(state):
if position.y >= 480:
linear_velocity = linear_velocity * (-1)
elif position.y <= 80:
linear_velocity = linear_velocity * (-1)
``````

And this is the player code:

``````extends KinematicBody2D

const FLOOR = Vector2(0, -1)
var motion = Vector2()
var on_ground = false

func _physics_process(delta):
motion.y += 10
move_and_slide(motion)
if Input.is_action_pressed("ui_right"):
\$AnimatedSprite.set_flip_h(false)
motion.x = 300
move_and_slide(motion)
elif Input.is_action_pressed("ui_left"):
\$AnimatedSprite.set_flip_h(true)
motion.x = -300
move_and_slide(motion)

if Input.is_action_pressed("ui_up"):
\$Jump.play()
if on_ground == true:
motion.y = -300
on_ground = false
motion = move_and_slide(motion, FLOOR)
if is_on_floor():
on_ground = true
else:
on_ground = false
position.y = clamp(position.y, -256, 1600)
if position.y >= 1500:
\$wrong.play()
position.x = 900
position.y = 100
``````

Rob1980 | 2019-02-08 21:14