Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Newby |
So basically every time i move my player the is_on _floor function keeps switching to true and false even though I’m on the floor.
I’m using a tilemap to give collisions to my floor and viewed the collisions shapes while running and there wasn’t any gaps between the tiles.
I’m using Godot 3.1
What your move_and_slide
call looks like?
Dlean Jeans | 2019-06-16 06:41
found out my player is bobbling up ad down but very tiny bobs.
don’t know why however.
any ways here’s the script
Player Move script
if Input.is_action_pressed("ui_right"): facing=1 $anim.play("Right") motion.x=SPEED elif Input.is_action_pressed("ui_left"): facing=-1 $anim.play("Left") motion.x=-SPEED else: motion.x=0
Extends script for player
extends KinematicBody2D
const MAXSPEED=120
var SPEED=MAXSPEED
const JUMPPOWER=270
const JUMP=Vector2(0,-1)
const GRAV=10
var motion=Vector2()
func move():
if !is_on_floor():
motion.y+=GRAV
motion=move_and_slide(motion,JUMP)
Newby | 2019-06-16 07:16