Added texture cache and sprite origins.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AlienAttack.MonoGame.Things;
|
||||
using AlienAttack.MonoGame.Things.Asteroids;
|
||||
using AlienAttack.MonoGame.Things.Enemies;
|
||||
using AlienAttack.MonoGame.Things.Enemies.Mines;
|
||||
using AlienAttack.MonoGame.Things.Enemies.Turrets;
|
||||
@@ -263,7 +264,8 @@ internal class GameLoop : GameLoopBase
|
||||
Random = _random,
|
||||
GameTime = gameTime,
|
||||
Content = Content,
|
||||
SpawnSprite = _spritesToAdd.Add
|
||||
SpawnSprite = _spritesToAdd.Add,
|
||||
Player = _player
|
||||
};
|
||||
|
||||
foreach (Sprite sprite in Sprites)
|
||||
@@ -406,6 +408,12 @@ internal class GameLoop : GameLoopBase
|
||||
Sprites.Add(enemy);
|
||||
_spawnNewEnemyThreshold = 100 + _random.Next(0, 100);
|
||||
}
|
||||
else if (randomNumber == 13)
|
||||
{
|
||||
Asteroid enemy = new(_random.Next(0, ViewTransform.ScreenWidth - Asteroid.Width), -Asteroid.Height);
|
||||
Sprites.Add(enemy);
|
||||
_spawnNewEnemyThreshold = 100 + _random.Next(0, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AlienAttack.MonoGame.Audio;
|
||||
using AlienAttack.MonoGame.Textures;
|
||||
using AlienAttack.MonoGame.View;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
@@ -13,6 +14,7 @@ internal abstract class GameLoopBase(AlienAttackGame game) : IGameLoop
|
||||
protected readonly SpriteBatch SpriteBatch = game.SpriteBatch;
|
||||
protected readonly ViewTransform ViewTransform = game.ViewTransform;
|
||||
protected readonly AudioManager Audio = game.Audio;
|
||||
protected readonly TextureCache Textures = game.Textures;
|
||||
|
||||
public void Draw(GameTime gameTime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user