Can Area2d be used to check for collision on a player's feet?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 9BitStrider

I’m currently using a tilemap for my game’s levels. I have code in place to determine which tile the player is standing on. But let’s say that the player is standing on a conveyor or ice:

enter image description here

Basically, the player will only slide until the game determines it’s x position is no longer above a conveyor/ice tile. Making them stop sliding at the edge of the tile, instead of falling off the edge from the momentum.

I have an Area2D in place to act as the player’s “Feet”. Basically I want to use this to determine if the player is standing on said tile so that they will plummet off the side instead of coming to a dead stop at the very edge.


Area2D is overlapping "Conveyor" or "Ice"
----Do conveyor/ice things.

Any and all help is appreciated. Thank you.

EDIT: I am currently using signals to determine when the Area2D is overlapping a tile. But that doesn’t help me with telling WHICH tile that it’s overlapping.

:bust_in_silhouette: Reply From: Othman2019

set a group name for the ice tiles, then check if the area2d in the feet is overlapping with
an object of that group for example :

if body.is_on_group("Ice_tiles"):

or make a custom signal that activates when you collide with the sprite of the tile

Trying the above example spits out a Nonexistent function ‘is_on_group’ in base ‘TileMap’ error.

9BitStrider | 2019-05-10 09:24

lol, you write that code in the area2d on the player’s feet, not on the tile.
and make sure that you click on the ice sprite, click on node, click on groups, then under manage groups write Ice_tiles, then click on add.

Othman2019 | 2019-05-10 20:09