How do I trigger an effect when a random number lands within some certain coordinates?

Hello.
I am working on a bottle slide game, as an introduction to coding in Applab. I’ve coded it so when you click the screen, it moves the bottle to a random location on the table.
What I am trying to do is when the bottle happens to land on a dollar bill, the game needs to knows this, and award the player with money.
I think I can make a balance myself, but I have no idea how to code it so that when it lands on one of the images with money, the game knows it, and rewards the player with money that you can spend in the shop.
Thank you

(The “move” button is what the player presses to make the bottle move)
Link to the project

@fosblmikkel,

Detecting Collisions in App Lab are a little more tricky than in Game Lab. The general idea is that you need to be able to compare the x and y positions of the two objects (as well as their height and width) to see if they are close enough to each other to be touching.

It may be easier to understand by looking at an example of someone using them. Here’s a youTube link of someone demonstrating how they do it.

Good luck! Looks like a super fun game!

Mike

1 Like