/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); chiF = Content.Load<SpriteFont>("ChillerFont"); dadGod = Content.Load<Texture2D>("gods/DaddyGod"); broGod = Content.Load<Texture2D>("gods/BrotherGod"); sisGod = Content.Load<Texture2D>("gods/SisterGod"); dadFont = Content.Load<SpriteFont>("gods/DaddyFont"); broFont = Content.Load<SpriteFont>("gods/BrotherFont"); sisFont = Content.Load<SpriteFont>("gods/SisterFont"); intro = new Introduction(this, Content.Load<Texture2D>("gods/DaddyGod"), new Vector2(0,0), new Vector2(0,0), dadFont); myGrass = new GrassSprite(Content.Load<Texture2D>("grass"), new Vector2(0, 0), new Vector2(0, 0)); myWater = new WaterSprite(Content.Load<Texture2D>("water"), new Vector2(0, 0), new Vector2(0, 0)); myRoad = new Road(Content.Load<Texture2D>("road"), new Vector2(0, 0), new Vector2(0, 0)); //Kill the game with Escape GameAction closeGame = new GameAction(this, this.GetType().GetMethod("ExitGame"), new object[0]); InputManager.AddToKeyboardMap(Keys.Escape, closeGame); GrowGrass grassPower = new GrowGrass(Content.Load<Texture2D>("UI/sprouts"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(grassPower); Rain rainPower = new Rain(Content.Load<Texture2D>("UI/raindrop"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(rainPower); sproutTree = new SproutTree(Content.Load<Texture2D>("UI/treeicon"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(sproutTree); BuildRoad buildRoad = new BuildRoad(Content.Load<Texture2D>("UI/roadicon"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(buildRoad); Fire fire = new Fire(Content.Load<Texture2D>("UI/fireicon"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(fire); BuildHouse housePower = new BuildHouse(Content.Load<Texture2D>("UI/house_icon"), this, new Vector2(0, 0), new Vector2(0, 0)); powers.Add(housePower); //Protect protect = new Protect(Content.Load<Texture2D>("UI/protect"), this, new Vector2(0, 0), new Vector2(0, 0)); Dictionary<string, Power> myPowers = new Dictionary<string, Power>(); myPowers.Add("grass", grassPower); myPowers.Add("sprout", sproutTree); myPowers.Add("fire", fire); myPowers.Add("house", housePower); List<Power> availablePowers = new List<Power>(); //availablePowers.Add(protect); cursor = new Cursor(Content.Load<Texture2D>("cursor"), new Vector2(0,0), this, powers); player = new Player(Content.Load<Texture2D>("UI/icon"), Content.Load<Texture2D>("UI/iconBG"), chiF, new Vector2(0, 0), new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), tempMapSize, cursor, powers, availablePowers); map = new Map(Content.Load<Texture2D>("Maps/Mars/marsorbit"), new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), new Vector2(0, 0), player); worldScale = map.baseScale; // TODO: use this.Content to load your game content here LoadObjects(); FontPos = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2); myApocalypse = new Apocalypse(this, myPowers); //myApocalypse.BuildVillage(); mainMusic = Content.Load<SoundEffect>("Sound/mainMusic"); mainMusicInstance = mainMusic.CreateInstance(); mainMusicInstance.IsLooped = true; mainMusicInstance.Play(); }
/// <summary> /// Three separate regions: /// 1. Movement: W,A,S,D keys /// 2. Power selection: 1,2,3,4,5 for now /// 3. Power usage: LMB for main use, RMB for alt-fire /// </summary> public void SetupInput() { #region Movement GameAction moveLeft = new GameAction( this, this.GetType().GetMethod("MoveLeft"), new object[0]); GameAction moveRight = new GameAction( this, this.GetType().GetMethod("MoveRight"), new object[0]); GameAction moveUp = new GameAction( this, this.GetType().GetMethod("MoveUp"), new object[0]); GameAction moveDown = new GameAction( this, this.GetType().GetMethod("MoveDown"), new object[0]); InputManager.AddToKeyboardMap(Keys.W, moveUp); InputManager.AddToKeyboardMap(Keys.A, moveLeft); InputManager.AddToKeyboardMap(Keys.S, moveDown); InputManager.AddToKeyboardMap(Keys.D, moveRight); #endregion #region Power Selection Hotkeys Keys[] possibleHotkeys = { Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7, Keys.D8, Keys.D9, Keys.D0 }; for (int i = 0; i < MAX_POWER_HOTKEYS; i++) { object[] param = new object[1]; param[0] = i; GameAction hotkey = new GameAction( this, this.GetType().GetMethod("powerHotkey"), param); InputManager.AddToKeyboardMap(possibleHotkeys[i], hotkey); } #endregion #region Power Usage Hotkeys GameAction powerLMBClick = new GameAction( this, this.GetType().GetMethod("usePower"), new object[0]); GameAction powerRMBClick = new GameAction( this, this.GetType().GetMethod("clearTile"), new object[0]); InputManager.AddToMouseMap(InputManager.LEFT_BUTTON, powerLMBClick); InputManager.AddToMouseMap(InputManager.RIGHT_BUTTON, powerRMBClick); #endregion }
public void SetUpInput() { GameAction next = new GameAction( this, this.GetType().GetMethod("setNextState"), new object[0]); //GameAction skip = new GameAction( // this, // this.GetType().GetMethod("skipEvent"), // new object[0]); InputManager.AddToKeyboardMap(Keys.Space, next); //InputManager.AddToKeyboardMap(Keys.Tab, skip); }
public void SetUpInput() { GameAction next = new GameAction( this, this.GetType().GetMethod("setNextState"), new object[0]); InputManager.AddToKeyboardMap(Keys.Space, next); }