View Single Post
  #2 (permalink)  
Old 03-13-2008, 07:26 AM
Erel's Avatar
Erel Erel is offline
Administrator
 
Join Date: Apr 2007
Posts: 3,185
Default

If I understand correctly this code will run several times in each set of collisions.
The order of the sprites (gw.Sprite1 and gw.Sprite2) can be different each time and therefore cause both sprites to move.
The best solution is to bind the stationary sprite to one object and use this object to move it:
Code:
Sub gw_Collision
  If gw.SpriteIndex(spr1.Value) = IndexOfSpecialSprite OR gw.SpriteIndex(spr2.Value) = IndexOfSpecialSprite Then
  SpecialSprite.x = SpecialSprite.x + 1
 End If
End Sub
Reply With Quote