![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | LNTMRT |
In my game I had implemented a system in gdscript where you could check what kind of area the player got in contact.
Area2D script:
var areaType = "Item"
or
var areaType = "Bullet"
and I could do something like this in my player script:
func on_player_area_entered():
if "areaType" in area:
if area.areaType =="Item":
# get drop
elif area.areaType =="Bullet":
#suffer damage
Now I am trying to repplicate this in c#, how can I do it??
sorry for not perfect english.
This is not really answer for your question, but in GDS You can check classes itselves, with “is” keyword. If You have class_name Bullet, than You can ask “if area is Bullet”
Inces | 2021-09-22 10:36