Browse Source

lots pewpews, in rotating colors

main
Colin McMillen 3 years ago
parent
commit
18f80f8a70
  1. 20
      Shared/ShmupWorld.cs

20
Shared/ShmupWorld.cs

@ -14,12 +14,22 @@ namespace SemiColinGames {
} }
public class Shot { public class Shot {
public TextureRef Texture = Textures.Projectile1;
static int color = 0;
public TextureRef Texture;
public Vector2 Position; public Vector2 Position;
public Vector2 HalfSize = new Vector2(11, 4); public Vector2 HalfSize = new Vector2(11, 4);
public Rectangle Bounds; public Rectangle Bounds;
public Vector2 Velocity; public Vector2 Velocity;
public Shot(Vector2 position, 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; Position = position;
Velocity = velocity; Velocity = velocity;
Update(0); // set Bounds Update(0); // set Bounds
@ -68,8 +78,12 @@ namespace SemiColinGames {
if (input[0].Attack && !input[1].Attack) { if (input[0].Attack && !input[1].Attack) {
Vector2 shotOffset = new Vector2(12, 2); Vector2 shotOffset = new Vector2(12, 2);
Vector2 shotPosition = Vector2.Add(Player.Position, shotOffset); 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)); Shots.RemoveAll(shot => !Bounds.Intersects(shot.Bounds));

Loading…
Cancel
Save