This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Ok I created a brick
Area
Srpite
CollisionShape2D

now when i am standing under it and jump up
1 to 5
each time I hit the brick (I.E enter the Area ) I get a random number of coins ( 1 to 10)
and makes a sound
on the 5 time the brick breaks (I.E dis-appears form the screen)

Godot version 3.4.4
in Engine by (52 points)

1 Answer

0 votes

Block needs to have a variable referring to its durability.
Every time a collision occurs this variable goes down one number and script checks it :

pseudocode

on collision :
     play sound
     give random amount of money
     if durability == 0:
           queue_free()
     durability -= 1
by (8,188 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.