Collision Help / Theory ?

PIXOMUSEPIXOMUSE Member Posts: 101
edited November -1 in Working with GS (Mac)
Hi, in the following image I have outlined the basic setup of my game, ( this is not the final graphics - just a temporary image to showcase my problem ) : -

image

As you can see, I am aiming for an isometric viewpoint, swipe left and right to move main 'actor' in an isometric path ( yellow cube in this example ), or up and down. Without going into too much detail, the general game idea is the yellow cube is moved and all BLUE cubes must be eliminated from the screen, however once you set the yellow cube in motion, it will not stop until it either hits a blue cube or encounters the edge of the grid, at which point something will happen and you will lose a life, and game will restart the level.

I need to know the best way to go about doing this in terms of collision and making sure my yellow cubes movement is slick and smooth ( i.e. pixel by pixel at whatever velocity I decide ) until a collision occurs or yellow cube encounters edge of grid.

Also, I want the blue cube to disappear as soon as my yellow cube enters it's tile area ( within a pixel if possible ), but not sure best way to achieve this ?

Also, how would I determine if my yellow cube was completely 'off the grid' if I swiped in the wrong direction and sent my yellow cube the wrong way ?

Thanks in advance.

Comments

  • RHRH Member Posts: 1,079
    I'd just use Pythagorus or vectortoangle to calculate the distance between the blue and yellow squares then constrain the distance to a local attribute on the blue squares actor and when (for example) self.distance<or= to 1/2 the size of the grids destroy. You'd have to mess around to get the same result from different axes.

    I haven't had any time to think this through or try it though. Hope it helps in some way.
  • PIXOMUSEPIXOMUSE Member Posts: 101
    Thanks, yes, that is helpful, so very much appreciated !

    Without disrespecting RH's advice, I would still love to hear of any other methods also ?

    Thanks
Sign In or Register to comment.