//Collision* public void Hurt(Glitch glitch) { if (this.Position.Intersects(glitch.Position) == true) { if (timesHit < 2) { timesHit++; //set a timer that makes the slime hurt for 1-2 seconds currentSlimeState = SlimeState.Hurt; } else { Dead(); } } }
public void Update(GameTime gameTime, Glitch glitch) { center = new Vector2(glitch.Position.X + (glitch.Position.Width / 2) - 400, 0); //only moves in the x-axis transform = Matrix.CreateScale(new Vector3(1, 1, 0)) * Matrix.CreateTranslation(new Vector3(-center.X, -center.Y, 0)); }
public Camera(Viewport newView) { view = newView; glitch = new Glitch(); }
/// <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();*/ }