Problem with sprite and ball collide

Hi,

I've a problem with my app :

I've create a sprite image to display my item (vegetable) on the canvas, and i also create a ball sprite to display the area of a mature vegetable.
The Image Sprite is Enable = false. Z = 1
The ball sprite is Enable = true. Z = 0

When i drag and drop the ball, the Image Sprite follow the ball center.

But when i want to use the "any ball.CollidedWith" block, nothing appends. In the documentation, its say that the block "any ball.CollidedWith" is triggered when an Enabled Ball or Sprite collid together.

I've search for a solution but i can't see one.

Does the Enabled Ball permanently collid with my Image sprite and that why the CollidedWith block don't run ?

BlockIssue

Hello Maxime

Well, logically the Sprites never collide with the Balls because they are on a separate Z plane and disabled......

If the area of a mature vegetable does not change dynamically in your App, I would combine two images into one, such that there are only sprites.

1 Like

You could instead keep track of Ball and Sprite center locations, and calculate distances between centers dynamically during drags events.

There are other ways to get circles on a Canvas besides Balls, if you do the bookkeeping and the calculations.

1 Like

@ABG, there is my solution, thanks you.

I have used this equation :

Distance_entre_2_points

I make a check between the result and the radius of the two vegetables (vegetable radius 1 + vegetable radius 2)

If the result distance between the 2 vegetables is inferior at the required distance, it give a result like that :

@ChrisWard To be honest, i've spent several hours to change the working sprite to a working ball, i really dont want to change to a new setup :disappointed_relieved:

Thanks you for your help :slightly_smiling_face:

With respect - you are changing to a new setup :upside_down_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.