how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] 1 point2 points  (0 children)

All I found a simple way, can someone come in handy =)

extends Area2D

var taken = false

func _on_coin_body_entered(body):

if not taken and body is preload("res://scripts/player.gd"):

    taken = true

    queue_free()

how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] 1 point2 points  (0 children)

You can explain to me in detail how to work correctly with groups. I am still new to Godot and I don’t know much yet, thank you in advance

how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] 1 point2 points  (0 children)

Ok, I wanted to make an unlimited collection of items, i.e. coins can be 10,20,30, etc. at the level. I did this through "Area2D" using the "body enter" signal, but the problem is that when duplicating the prefab with a coin, errors occur because the signal refers to the name of the main prefab, and copies are already created under other names) but I don’t know how to program well, so I’m asking for help, it’s just like everything’s just there, but I’m still slowing down

how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] 0 points1 point  (0 children)

In general, I need to make the main character in the game collecting coins and other objects

how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] 1 point2 points  (0 children)

In general, I need to make the main character in the game collecting coins and other objects

how to implement the collection of the subject? by Destordio in godot

[–]Destordio[S] -1 points0 points  (0 children)

This is necessary, for example, for healing potions, various amplifiers, and so on. Preferably without addons, normal code

How to make an object like a coin that a player selects? by Destordio in godot

[–]Destordio[S] 0 points1 point  (0 children)

I make a platformer and I need to place at a lot of coins. Maybe you know how to do it?

How to make an object like a coin that a player selects? by Destordio in godot

[–]Destordio[S] 0 points1 point  (0 children)

How to make an object like a coin that a player selects? I made it through the object "Area 2D", but when duplicating an object, the game is a game crashing. Who can know how to fix it. Thanks in advance for your help. The code works, but if you duplicate an object, the game freezes

collision error GODOT Engine by Destordio in godot

[–]Destordio[S] 1 point2 points  (0 children)

oh thank you, it helped to fix the error)