/// <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); //Para cargar la textura en la variable de césped, agrega lo siguiente al método LoadContent: grass = Content.Load <Texture2D>("suelo"); dino = new SpriteClass(GraphicsDevice, "person.png", ScaleToHighDPI(0.5f)); broccoli = new SpriteClass(GraphicsDevice, "broccoli.png", ScaleToHighDPI(0.2f)); // TODO: use this.Content to load your game content here }
public bool RectangleCollision(SpriteClass otherSprite) { if (this.x + this.texture.Width * this.scale * HITBOXSCALE / 2 < otherSprite.x - otherSprite.texture.Width * otherSprite.scale / 2) { return(false); } if (this.y + this.texture.Height * this.scale * HITBOXSCALE / 2 < otherSprite.y - otherSprite.texture.Height * otherSprite.scale / 2) { return(false); } if (this.x - this.texture.Width * this.scale * HITBOXSCALE / 2 > otherSprite.x + otherSprite.texture.Width * otherSprite.scale / 2) { return(false); } if (this.y - this.texture.Height * this.scale * HITBOXSCALE / 2 > otherSprite.y + otherSprite.texture.Height * otherSprite.scale / 2) { return(false); } return(true); }