Platformer help

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By The_Duskitty
:warning: Old Version Published before Godot 3 was released.

So i have the movement and everything but i have 3 Questions

  1. How do i remove moon-like gravity
  2. How Do i Make it so when i touch walls it doesnt Like, Lock the character there
  3. How Do i make it so my character doesnt slide when i release a key

Here’s my code for reference


extends RigidBody2D

var Ray_Down
var Ray_Left
var Ray_Right
var Walkspeed = 80
var Runspeed = 20
var Jump = 150
var Player

func _ready():
	set_process(true)
	Ray_Down = get_node("RayCast2D")
	Ray_Left = get_node("RayCast2D2")
	Ray_Right = get_node("RayCast2D1")
	Player = self
	Ray_Down.add_exception(Player)
	Ray_Left.add_exception(Player)
	Ray_Right.add_exception(Player)
	set_mode(2)

	
func _process(delta):

	
	
	if Ray_Down.is_colliding():
		print("Hoi")
	
	if Ray_Down.is_colliding():
		if Input.is_key_pressed(KEY_W):
			Player.set_axis_velocity(Vector2(0, -Jump))
	if !Ray_Right.is_colliding():
		if Input.is_key_pressed(KEY_D):
			Player.set_axis_velocity(Vector2(Walkspeed,0))
	if !Ray_Left.is_colliding():
		if Input.is_key_pressed(KEY_A):
			Player.set_axis_velocity(Vector2(-Walkspeed,0))

Um… what does “walls it doesn’t like” mean?

Bojidar Marinov | 2016-03-21 07:53

:bust_in_silhouette: Reply From: theapparatus

You can change the gravity in your project settings. Alternatively you can change the gravity scale of your node from the editor or from script.
To fix your wall problem you want to change the resistance of your RigidBody2D to something less than 1 (like 0.4)

Thanks ^^ for the help

The_Duskitty | 2016-03-21 15:25