Collision detection between drawn Objects

I want to draw a ball with Canvas.DrawCircle and see if my ImageSprite collides with it. The event ImageSprite.ColliededWith doesn't trigger, is there another option? Or do I need to check the color next to my image?

1 Like

Welcome Flo.

Read how to detect collisions in Creating Animated Apps and particularly Figure 17-7 might help you figure this out.

What did you try?

1 Like

If you draw with "canvas.drawCircle" you only fill an area with a color but you don't create an object. Use a "Ball" instead (fill "paintcolor); it's equivalent to an imageSprite in handling - then you have two objects whose behaviour (events) can be handled using the suitable events.

Can I create rectangle objects as well?

A Sprite is a 'rectangular object'. See Drawing and Animation components for documentation.

Thanks for all these fast replies! I am going to check the colors next to the player, because the solutions are not usefull in my case. But thanks anyways :slight_smile:

Here is a totally list based alternative approach ...

I dont really get that approach, can you explain it?

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