I have quite a simple question about developing games in Monogame. Let's say I have a UFO as an object that can move around. From time to time, my UFO spawns a hole in the ground (purple circle) directly under the spot where he is standing.
After doing this, the UFO can fly around freely again. However, when I want to fly over the hole I just spawned, I notice the circle is higher then my UFO. It doesn't fly over the hole but instead just clips under it.
Is there any way to make the UFO object always be on the foreground or possibly spawn the holes behind the UFO?
The main game that adds the hole:
Components.Add(new Hole(this, holeTexture,
hero.HolePosition));
The hole object's draw function:
public override void Draw(GameTime gameTime)
{
SpriteBatch sBatch =
(SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
sBatch.Draw(texture, position, Color.White);
base.Draw(gameTime);
}
The function in the hero (UFO) object where I define the location of the hole:
public Vector2 HolePosition //nodig om gaten te graven (startpos.)
{
get { return new Vector2(position.X + (WIDTH / 2), position.Y + HEIGHT); }
}
Images of the problem: