Shoot & snap to position

I'm trying to create a bubble shooter, where the bubbles will snap to a grid once they are shot.

Right now I have invisible actors and the bubbles snap to their x & y coordinates if they overlap/collide. The problem I am having is that the bubbles overlap/collide with more than one invisible actor when they are shot since they are so close together in the grid.

Any better way of doing this or any other suggestions?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2014

    You'll have to work out how to determine when a bubble should stop (maybe when it's velocity is below a certain threshold?) but here's how to snap to grid:

    Constrain attribute self.position.X to prec(self.position.X/game.gridSize,0)*game.gridSize

    Constrain attribute self.position.Y to prec(self.position.Y/game.gridSize,0)*game.gridSize

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.