public BackgroundStar(Game1 _game, Vector2 _position, int startex, Random _rand) { game = _game; position = _position; rotation = 0f; if (startex == 0) { tex = game.Content.Load<Texture2D>("star1"); speed = new Vector2(0, 0); multiplier = 0.4f; } else if(startex == 1) { tex = game.Content.Load<Texture2D>("star2"); speed = new Vector2(0, 0); multiplier = 0.5f; } else if (startex == 2) { tex = game.Content.Load<Texture2D>("star3"); speed = new Vector2(0, 0); multiplier = 0.5f; } else if (startex == 3) { tex = game.Content.Load<Texture2D>("star4"); speed = new Vector2(0, 0); multiplier = 0.4f; } sourceRect = new Rectangle((int)position.X, (int)position.Y, tex.Width, tex.Height); scale = 0.5f; origin = new Vector2(tex.Width / 2, tex.Height / 2); rand = _rand; }
public Asteroid(Game1 _game, int side) { game = _game; tex = game.Content.Load<Texture2D>("asteroid"); if (side == -1) { side = rand.Next(0, 4); }; if (side == 0) { position = new Vector2(-100, (int)(rand.NextDouble() * game.GraphicsDevice.Viewport.Height));//move right speed = new Vector2((float)rand.NextDouble() * rand.Next(1, 5)+1, (float)rand.NextDouble() * rand.Next(-3, 2)+1); } else if (side == 1) { position = new Vector2(game.GraphicsDevice.Viewport.Width+100, (int)(rand.NextDouble() * game.GraphicsDevice.Viewport.Height)); speed = new Vector2((float)rand.NextDouble() * rand.Next(-4, 0), (float)rand.NextDouble() * rand.Next(-3, 2));//move left } else if(side == 2) { position = new Vector2((int)(rand.NextDouble() * game.GraphicsDevice.Viewport.Width), -100);//move down speed = new Vector2((float)rand.NextDouble() * rand.Next(-3, 2), (float)rand.NextDouble() * rand.Next(1, 5)); } else if(side == 3) { position = new Vector2((int)(rand.NextDouble() * game.GraphicsDevice.Viewport.Width), game.GraphicsDevice.Viewport.Height+100); speed = new Vector2((float)rand.NextDouble() * rand.Next(-3, 2), (float)rand.NextDouble() * rand.Next(-4, 0));//move up } rotation = (float)rand.NextDouble(); sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); inputController = game.inputController; objectController = game.objectController; radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public World(Game1 _game) { game = _game; position = new Vector2(0, 0); tex = game.Content.Load<Texture2D>("starBG"); background = new Background(game); target = new Target(game); }
public Gun(Game1 _game, Vector2 _position) { game = _game; tex = game.Content.Load<Texture2D>("gun"); position = _position; muzzlelocation = new Vector2(0, 0); scale = 1f; sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); origin = new Vector2(tex.Width/2, tex.Height/2); }
public Background(Game1 _game) { game = _game; bgList = new List<BackgroundStar>(); for (int i = 0; i < 30; i++) { bgList.Add(new BackgroundStar(game, new Vector2(rand.Next(0, game.GraphicsDevice.Viewport.Width), rand.Next(0, game.GraphicsDevice.Viewport.Height)), rand.Next(0, 4), rand)); } }
public LevelController(Game1 _game) { game = _game; level = 0; startTime = 0; triggerTime = 0; rand = new Random(); leveltype = "Get Ready!"; totalTime = 0; }
public Target(Game1 _game) { game = _game; tex = game.Content.Load<Texture2D>("target"); position = new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 2 - tex.Height / 2); rotation = 0f; sourceRect = new Rectangle((int)position.X, (int)position.Y, tex.Width, tex.Height); scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); speed = new Vector2(0, 0); radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public Bossbullet(Game1 _game, Vector2 _position, Vector2 direction) { game = _game; tex = game.Content.Load<Texture2D>("bullet"); position = _position; rotation = 0f; sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); speed = new Vector2(direction.X*10, direction.Y*10); radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public Boss(Game1 _game) { game = _game; tex = game.Content.Load<Texture2D>("bossguiseppe"); position = new Vector2(game.GraphicsDevice.Viewport.Width+200, game.GraphicsDevice.Viewport.Height/2 - tex.Height/2); origin = new Vector2(tex.Width/2f, tex.Height/2f); speed = new Vector2(0, 0); rotation = 0f; sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); scale = 1f; health = 50; radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public Bullet(Game1 _game, Vector2 direction, Vector2 offset, Vector2 _position) { game = _game; tex = game.Content.Load<Texture2D>("bullet"); position = _position + offset; rotation = 0f; sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); speed = new Vector2(direction.X/8, direction.Y/8); inputController = game.inputController; objectController = game.objectController; radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public Bomb(Game1 _game, Vector2 direction) { game = _game; tex = game.Content.Load<Texture2D>("Bomb"); position = new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 2); rotation = 0f; sourceRect = new Rectangle(0, 0, tex.Width, tex.Height); scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); speed = new Vector2(direction.X / 8, direction.Y / 8); inputController = game.inputController; objectController = game.objectController; time = 0; radius = (float)Math.Sqrt(Math.Pow(tex.Height, 2) + Math.Pow(tex.Width, 2)); }
public Ship(Game1 _game, Vector2 _position, float _rotation) { game = _game; tex = game.Content.Load<Texture2D>("ship"); position = new Vector2(_position.X + tex.Width/4 + 25, _position.Y + tex.Height/3); sizeX = tex.Width / 4; sizeY = tex.Height / 3; column = 0; row = 2; scale = 1f; origin = new Vector2(tex.Width / 2, tex.Height / 2); speed = new Vector2(0, 0); rotation = 0f; radius = (float)Math.Sqrt(Math.Pow(tex.Height/3, 2) + Math.Pow(tex.Width/4, 2)); sourceRect = new Rectangle(sizeX * column - sizeX, sizeY * row - sizeY, sizeX, sizeY); destRect = new Rectangle((int)position.X, (int)position.Y, sizeX, sizeY); }
public Explosion(Game1 _game, Vector2 _position, bool _big) { game = _game; if(_big){ tex = game.Content.Load<Texture2D>("bigexplosion"); }else{ tex = game.Content.Load<Texture2D>("smallexplosion"); } sizeX = tex.Width / 9; sizeY = tex.Height / 9; column = 0; row = 0; position = new Vector2(_position.X - tex.Width/18, _position.Y - tex.Height/18); Console.WriteLine(sizeX + " " + sizeY); time = 0; scale = 1f; sourceRect = new Rectangle(sizeX * column, sizeY * row, sizeX, sizeY); }
public ObjectController(Game1 _game) { game = _game; inputController = game.inputController; basespeed = new Vector2(0, 0); entityList = new List<Entity>(); cleanList = new List<int>(); points = 0; highscore = 0; verdana = game.Content.Load<SpriteFont>("Verdana"); countDown = ""; levelType = ""; weaponMode = 1; ship = new Ship(game, new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 2), 0f); gun = new Gun(game, new Vector2(game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 2)); entityList.Add(ship); entityList.Add(gun); }
static void Main() { using (var game = new Game1()) game.Run(); }
public PlayerControls(Game1 _game) { game = _game; inputController = game.inputController; game.IsMouseVisible = false; }
public InputController(Game1 _game) { game = _game; }