none
Collisions RRS feed

  • Question

  • Hi, I'm creating a game using visual basic that is based on Space Invaders. I am currently working on the code for collisions but I am struggling to add code that detects collisions between two that are created at runtime. I am not very knowledgable with regards to setting from watching videos on youtube. I'm finding it very difficult to grasp it.

    I would really appreciate some help relating to this issue.

    Thank you.

    Sunday, March 31, 2019 9:41 AM

All replies

  • Perhaps If MisslePb.Bounds.IntersectsWith(spt.Bounds) Then will work?

    Exactly how to do it depends on your code so far.

    Show us your code so far.

    Show us what you have tried and describe what you dont understand and what you do understand and what you expect from us. We cant guess where you are you need to tell us.

    Sunday, March 31, 2019 11:56 AM
  • As Tommytwotrain said, the basic method is with Rectangle.Intersect

    If the bitmaps are not rectangular, you can improve it with "Pixel Perfect Collision"

    A sample with pixel transparency detection with 2 png images : VB Direct2D Pixel Perfect Collision

    where the result of the detection is done on the smaller ball vs the bigger one


    • Edited by Castorix31 Monday, April 1, 2019 8:39 PM
    Monday, April 1, 2019 8:26 PM