CollisionMouse Event
Previous Top Next

CollisionMouse event occurs when the user presses on a sprite.
Sprite1 property holds the pressed sprite.
X and Y properties hold the mouse position.

Example:
Sub gw_CollisionMouse
'This event occurs when the user presses on a sprite.
      sprite.Value = gw.Sprite1 'Get the sprite.
      If gw.SpriteIndex(sprite.Value) = 0 Then Return 'Ignore the explode sprite.
      sprite.MarkedForDelete = true 'Delete the sprite.
      explodeSprite.X = gw.X - explodeSprite.Width/2 'Set the exploding sprite position and show it for 5 ticks.
      explodeSprite.Y = gw.Y - explodeSprite.Height/2
      explodeSprite.CurrentFrame = 0
      explodeSprite.LifeTimeCounter = 5
      Sound("explode.wav")
      form1.Text = "hit"
End Sub