コード例 #1
0
 protected override void LoadContent()
 {
     spriteBatch  = game.getSpriteBatch();
     foodTruck    = game.getTexture(2);//load snackCart texture
     drawCart     = new Rectangle((int)Position.X, (int)Position.Y, foodTruck.Width, foodTruck.Height);
     screenWidth  = game.getScreenWidth();
     screenHeight = game.getScreenHeight();
 }
コード例 #2
0
        }//end constructor

        protected override void LoadContent()
        {
            spriteBatch       = game.getSpriteBatch();
            fence1            = game.getTexture(3); //load fence texture
            pivotCirc         = game.getTexture(4); //load raccoon texture
            drawPivot1        = new Rectangle((int)(Position.X), (int)(Position.Y + length / 2.0f), pivotCirc.Width, pivotCirc.Height);
            drawPivot2        = new Rectangle((int)(Position.X), (int)(Position.Y - length / 2.0f), pivotCirc.Width, pivotCirc.Height);
            drawFence         = new Rectangle((int)Position.X, (int)Position.Y, fence1.Width, fence1.Height);
            screenWidth       = game.getScreenWidth();
            screenHeight      = game.getScreenHeight();
            pivotCenterOffset = pivotCirc.Height / 2;
            fenceAngle        = 3.1415f / 2; //in radians
            //pivot1 = new Vector2((Position.X), Position.Y-(fence1.Height/2));
            //pivot2 = new Vector2((Position.X + fence1.Width), Position.Y - (fence1.Height / 2));
            fenceOrigin  = new Vector2(fence1.Width / 2, fence1.Height / 2);
            pivot1Origin = new Vector2(pivotCirc.Width / 2, pivotCirc.Height / 2); //default left
            pivot2Origin = new Vector2(pivotCirc.Width / 2, pivotCirc.Height / 2); //default right
        }
コード例 #3
0
ファイル: Raccoon.cs プロジェクト: typ0ninja/RaccoonWrangler
        }//end initialize

        protected override void LoadContent()
        {
            spriteBatch     = game.getSpriteBatch();
            Raccoon1        = game.getTexture(1);//load raccoon texture
            drawRaccoon     = new Rectangle((int)Position.X, (int)Position.Y, Raccoon1.Width / 2, Raccoon1.Height / 2);
            screenWidth     = game.getScreenWidth();
            screenHeight    = game.getScreenHeight();
            maxRaccoon      = game.getMaxRaccoon();
            totTooClosePos  = Vector2.Zero;
            avgTooClosePos  = Vector2.Zero;
            AvgSeperateDir  = Vector2.Zero;
            fenceDir        = Vector2.Zero;
            avgFlockDir     = Vector2.Zero;
            avgFlockLookDir = Vector2.Zero;
            snackPos        = game.getSnackLoc();
            snackDir        = Vector2.Zero;
            currentTime     = 0;
            elapsedTime     = 0;
            eTime           = 0;
            speed           = 75f;
            stealTime       = 0;
            resetTime       = 0;
            beanTime        = 0;

            //----testing init direction----
            //framesPerDir = 60;  // set to your frames Per Direction
            rand = game.getRand();

            Vector2 dir;

            dir.Y = (float)rand.NextDouble() - 0.5f;
            dir.X = (float)rand.NextDouble() - 0.5f;

            setDirection(dir);

            base.LoadContent();
        }