game programing
-
Hi! I found this video and I would like to do something like this. But i dónt know how to make the part where the coin meets the pot and it adds to the score. Can someone help?
-
I don't have a VIMEO account so I can't view the video, but if it's 2D object collision detection you could look at @Dusx and @GertjanB's answers on this post: https://community.troikatronix.com/topic/6816/answered-2d-collision-detection-advice/6?_=1672833713872
-
@carolina Yes, as Woland has suggested you need to use some form of collision detection. The easiest would be a point to rect collision. In this case you would use the center of the coin (its X Y position) and check every frame if its position is between two X positions and between two Y positions, so within a Non Rotated Rectangle (your pot in this case).
If it is in the 'pot' then you would trigger an addition to the score, the end of the current coins life, and the start of the next coin (or something like that)
A failing case might be that the coin is below a certain threshold and isn't in the pot.
this demo file might help you get started: https://community.troikatronix... -
-
Nice, thank you!