Getting the position of Sprites from an Array and comparing Images


Someone had shared that they’re doing a Friday Night Funkin’ game or similar and it gave me the idea for something similar…

The problem:

  1. I know I could manually input the X-positions of the sprites at the top… and then just have a simple comparison but that’s … er… too easy?
  2. I’ve made an array of sprites which are spaced equally and fixed at the top of the screen… I want to: compare the image of the sprite that is created (the projectile) to the fixed arrows at the top… If the spawned projectile is, say, an arrow pointing left; it compares the images and gets the x-position of the arrow at the top, setting the projectile’s spawned X position as the same (so they later overlap)

Why on Earth would you want this?!:

  1. This way, it opens up possibilities to extend the game for other things at a later date… whether that’s effortlessly adding in an A or B button to press too … or to have a 2nd player etc…

I’ve included the start of my code


1 Like