€ éfunction init(self) go.set_position(vmath.vector3(950,700,0.2)) self.velocity = vmath.vector3(0, 0, 0) self.gravity = -5000 self.grounded = false end function update(self, dt) local pos = go.get_position() pos = pos + self.velocity * dt local centre = vmath.vector3(pos.x, pos.y, 0) local platform = pos + vmath.vector3(0, -45, 0) local platform_result = physics.raycast(centre, platform, { hash("platform") }) if platform_result then local point = platform_result.position - pos self.grounded = true self.velocity.y = 0 if point.y > -45 then pos.y = pos.y + (point.y + 45) end else self.grounded = false end if not self.grounded then self.velocity.y = self.velocity.y + self.gravity * dt end go.set_position(pos) end @main/mummy.script"