lots pewpews, in rotating colors

This commit is contained in:
Colin McMillen 2020-11-19 18:52:56 -05:00
parent db01dcea28
commit 18f80f8a70

View File

@ -14,12 +14,22 @@ namespace SemiColinGames {
}
public class Shot {
public TextureRef Texture = Textures.Projectile1;
static int color = 0;
public TextureRef Texture;
public Vector2 Position;
public Vector2 HalfSize = new Vector2(11, 4);
public Rectangle Bounds;
public Vector2 Velocity;
public Shot(Vector2 position, Vector2 velocity) {
Texture = (color % 5) switch {
0 => Textures.Projectile1,
1 => Textures.Projectile2,
2 => Textures.Projectile3,
3 => Textures.Projectile4,
_ => Textures.Projectile5
};
color++;
Position = position;
Velocity = velocity;
Update(0); // set Bounds
@ -68,8 +78,12 @@ namespace SemiColinGames {
if (input[0].Attack && !input[1].Attack) {
Vector2 shotOffset = new Vector2(12, 2);
Vector2 shotPosition = Vector2.Add(Player.Position, shotOffset);
Shot shot = new Shot(shotPosition, new Vector2(300, 0));
Shots.Add(shot);
Shots.Add(new Shot(shotPosition, new Vector2(300, 40)));
Shots.Add(new Shot(shotPosition, new Vector2(300, 20)));
Shots.Add(new Shot(shotPosition, new Vector2(300, 0)));
Shots.Add(new Shot(shotPosition, new Vector2(300, -20)));
Shots.Add(new Shot(shotPosition, new Vector2(300, -40)));
new Shot(shotPosition, Vector2.Zero);
}
Shots.RemoveAll(shot => !Bounds.Intersects(shot.Bounds));