Skip to content

Instantly share code, notes, and snippets.

@rodesousa
Last active May 7, 2020 19:30
Show Gist options
  • Save rodesousa/8c2a5c1b4b05aea9ddd4adcd6f4f1f01 to your computer and use it in GitHub Desktop.
Save rodesousa/8c2a5c1b4b05aea9ddd4adcd6f4f1f01 to your computer and use it in GitHub Desktop.
godot reminder

func _ready():

Called when the node enters the scene tree for the first time.

func _process(delta):

Called every frame. 'delta' is the elapsed time since the previous frame.

character move

func _physics_process(delta):
	var velocity = Vector2()
	if Input.is_action_pressed("ui_right"):
		velocity.x += 1
	if Input.is_action_pressed("ui_left"):
		velocity.x -= 1
	if Input.is_action_pressed("ui_up"):
		velocity.y -= 1
	if Input.is_action_pressed("ui_down"):
		velocity.y += 1
	if velocity.length() > 0:
		velocity = velocity.normalized() * speed
		move_and_slide(velocity)

When a tile overlap a other tile

u need to use "Z Index" in Node2D conf. A node with a bigger Z index are over the others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment