Boosting the player with TileMapLayer

Godot Version

V4.7

Question

Hi, I have a TileMapLayer as a scene, which has a area2D and collision shape. I’m trying to make it so that if the player jumps into the tile map layer they get boosted, increasing the height.

If I place the TileMapLayer in the main level, only one of the tiles work. The arrows on the left provides a boost to the player when it is jumped into, but not the arrows on the right.

Script for TileMapLayer:

extends TileMapLayer

func _on_area_2d_body_entered(body: Node2D) -> void:
	body.velocity.y -= 100

Player script:

extends CharacterBody2D

const SPEED : float = 150.0
const JUMP_VELOCITY : float = -320.0
const GRAVITY : float = 1000.0

func _physics_process(delta: float) -> void:
	# Add the gravity.
	if not is_on_floor():
		velocity.y += GRAVITY * delta

	# Handle jump.
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y = JUMP_VELOCITY

	var direction := Input.get_axis("move_left", "move_right")
	if direction:
		velocity.x = direction * SPEED
	else:
		velocity.x = move_toward(velocity.x, 0, SPEED)
	
	move_and_slide()

this is a silly question maybe, but do the tiles on the right also have an area2D for the player to interact with? your screenshot only seems to show that the player and left tiles do, which is odd

Well, I’m trying to make it so that when I place down the TileMapLayer, it also has the area2D to boost the player, but only the first one works (I have to move/drag it into a spot)

I’m guessing that when placing the tile, it doesn’t get the area2D, and therefore it can’t boost the player.

I don’t know what terrain properties are. Searching it up, and it looks very complicated.

terrain properties is probably a non-solution for this so it’s my bad. others might know better, but unfortunately the cleanest solution seems like just putting an area2D node wherever you place a boost tile!