//function IsOverLapping of type bool with parameters boxover and pos bool IsOverLapping(GameEntity boxover, Vector2 pos) { Vector2 boxpos = boxover.Position;//boxpos is equal to boxover.position if ((boxpos.X >= pos.X + 26) && (boxpos.X <= pos.X + 54))//if boxpos.x is in between pos.x +26 and pos.x+54 { if ((boxpos.Y >= pos.Y - 11) && (boxpos.Y <= pos.Y + 111))//if boxpos.y is in between pos.y-11 and pos.y+111 { return true;//return true } } return false;//return false }
protected override void Initialize() { gameState = GameState.Menu;//gamestate equals gamestate.Menu player = new Player();//player equal new player entities.Add(player);//add player to entities Addbox();//call addbox function soundEffect = Content.Load<SoundEffect>("Bass");//load soundeffect Bass.wav soundEffectInstance = soundEffect.CreateInstance();//create sound effect instance called soundEffectInstance base.Initialize(); }