Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

motion = move_and_slide( seems like it's not using a 2d vector but a bool. Stands for boolean which is a value that can be true or false. If motion is a boolean it doesn't have a value motion.y. This would cause motion.y = -100 to cause the error you see. You may need to use velocity.y = -100 instead of motion.y to fix it. 

I am not a Godot expert so please take this suggestion with a grain of salt.

(+1)

Yeah no worries!! 

I'll give this a try later tonight and let you know if it works out! Thank you! 😄

just looked it up, move and slide returns if there was a collision (true or false)
try calling the function without the "motion ="

(+2)

This did fix the error!... but my knockback still isn't working for some reason... Lol.

(+1)

you are calling move and slide only once (in the knockback function), but you need to call it every frame for it to continuously update

like

func _physics_process(delta):
    move_and_slide()

Glad that helped. I think SimulatedGravity has your next step. You need to process the action as long as you have velocity to keep it animating. Consider friction or something similar to slow it over time or it will just continue to be blown away.