Make a player collecting coins

i am newly beginner in panda3d , i start with a simple game in which a player is running and i want to know how can i make it collecting items like coins to win ?

The easiest is probably to set a tag on your coins like coin.setTag(“coin”, 1).

Then, in your update task you can do:

pickup_radius = 0.5
for coin in render.findAllMatches("**/=coin"):
    if my_player.get_distance(coin) < pickup_radius:
        # Player collected coin, increase score or so
        coin.removeNode() 

You have to replace my_player by your player. The pickup radius is the distance the player has to approach the coin before it is picked up.

ok Thanks i’ll try this :slight_smile: