Only play a sound if a collision happens in view?

Discussion in 'Public Game Developers Forum' started by RDApps, Sep 23, 2015.

  1. RDApps

    RDApps New Member

    Sep 23, 2015
    2
    0
    0
    first post here, lurked for a little while so apologies if this is in the wrong place.

    im working on a game where if there is a collision between two boddies then a sound plays. ive got this part working fine, but i only want the sound to play if the collision happens in the view. i have a scrolling background and collisions further ahead are making a noise.

    any help would be appreciated.
     
  2. Tosty

    Tosty Well-Known Member

    Oct 18, 2014
    84
    0
    6
    Sounds pretty simple. There should be a rectangle to represent the size of the "view", check the collision point between the two objects that have hit each other. If the collision point is in the main view rectangle, play sound.
     

Share This Page