//Horizontal Collision* Code public void EndHorzMoveJump(Horizontal_Platform platform) { if (platform.Active == true) { //Checks if Glitch is touching a platform if (bottomHitBox.Intersects(platform.HitBox) == true) { currentPlatform = platform; onHorzPlatform = true; //Checks if she's in Jump State if (currentGlitchState == GlitchState.Jump) { hasJumped = false; //Checks whether to put her facing right or left when the collision happens if (currentKeyState == keyboardState.Right) { currentGlitchState = GlitchState.IdleRight; } else if (currentKeyState == keyboardState.Left) { currentGlitchState = GlitchState.IdleLeft; } } } } }
/// <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); //Starting Position Rectangles Platform* //x,y,width,height slimePos1 = new Rectangle(500, 425, 108, 108); vertPos1 = new Rectangle(600, 400, 400, 100); horzPos1 = new Rectangle(600, 500, 400, 100); //Class Initializations glitch = new Glitch(); slime1 = new Slime(slimePos1, true, 0); vert1 = new Vertical_Platform(vertPos1); horz1 = new Horizontal_Platform(horzPos1); ground = new Ground(); button = new Buttons(); //Load Content Logic button.LoadContent(Content); slime1.LoadContent(Content); glitch.LoadContent(Content); vert1.LoadContent(Content); horz1.LoadContent(Content); ground.LoadContent(Content); //List Initializations enemyList = new List <Slime>(); enemyList.Add(slime1); horzPlatformList = new List <Horizontal_Platform>(); horzPlatformList.Add(horz1); vertPlatformList = new List <Vertical_Platform>(); vertPlatformList.Add(vert1); //Menu Textures menuSkin = Content.Load <Texture2D>("logoSkin.png"); pause = Content.Load <Texture2D>("pause.png"); gameOver = Content.Load <Texture2D>("gameover.png"); //Menu Rectangle menuPos = new Rectangle(0, 0, 1024, 720); //Sounds currentMusicState = MusicState.Stop; songStart = false; song = Content.Load <Song>("Level1"); //health texture heart = Content.Load <Texture2D>("Heart"); //Timers slimeTimer = 10.0; text = Content.Load <SpriteFont>("Time"); // TODO: use this.Content to load your game content here glitch.Initialize(); //initialized glitch so you can jump and get hurt /* * button.Initialize(); * longSword.Initialize(); * slime1.Initialize(); * horz1.Initialize(); * vert1.Initialize();*/ }