|
|
@ -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)); |
|
|
|