Beispiel #1
0
        /// <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);
            World.LoadContent(Content);
            Player.LoadContent(Content);
            PhysicalObject.LoadContent(Content);
            rectangle = Content.Load <Texture2D>("texture_chelou");
            rouliFont = Content.Load <SpriteFont>("Rouli");

            world = new World(player);
        }
Beispiel #2
0
        public void Bump(PhysicalObject bumper)
        {
            Vector2 Knockback = new Vector2();

            Knockback = new Vector2(Hurtbox.Center.X - bumper.Hurtbox.Center.X, Math.Min(Hurtbox.Center.Y, bumper.Hurtbox.Center.Y) - bumper.Hurtbox.Center.Y);
            if (Knockback == new Vector2(0, 0))
            {
                Knockback = new Vector2(0, -1);
            }
            Knockback.Normalize();
            Knockback *= 10;
            //if (!world.CheckCollision(Hurtbox, Knockback))
            Velocity = Knockback;
        }