Esempio n. 1
0
        //------------------------------------------------------------------------------------------------------------------

        public void addMyComponents(float x, float y, float time)
        {
            this.resetOnCheckpoint = false;

            //POSITION COMPONENT - Does it have a position?
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //DRAW COMPONENT - Does it get drawn to the game world?
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Foreground.SpikeButton0", "RunningGame.Resources.Artwork.Foreground.SpikeButton0.png", GlobalVars.SWITCH_INACTIVE_SPRITE_NAME);
            drawComp.addSprite("Artwork.Foreground.SpikeButton0", "RunningGame.Resources.Artwork.Foreground.SpikeButton1.png", GlobalVars.SWITCH_ACTIVE_SPRITE_NAME);
            drawComp.setSprite(GlobalVars.SWITCH_INACTIVE_SPRITE_NAME);

            //COLLIDER - Does it hit things?
            addComponent(new ColliderComponent(this, GlobalVars.SPIKE_SWITCH_COLLIDER), true);

            //Swich Component - Is it a switch? Yes.
            addComponent(new SwitchComponent(startingState), true);

            if (time > -1)
            {
                //Timed Switch Component It's a timed switch!
                addComponent(new TimedSwitchComponent(time), true);
            }
        }
Esempio n. 2
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, int switchId, float width, float height, bool defaultClosed)
        {
            this.resetOnCheckpoint = false;

            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, width, height, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" or maybe .bmp
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(width, height, level, true), true);

            if (width <= height)
            {
                drawComp.addSprite("Artwork.Foreground.DoorClosed", "RunningGame.Resources.Artwork.Foreground.DoorClosed11.png", GlobalVars.DOOR_CLOSED_SPRITE_NAME);
                drawComp.addSprite("Artwork.Foreground.DoorOpen", "RunningGame.Resources.Artwork.Foreground.DoorOpen11.png", GlobalVars.DOOR_OPEN_SPRITE_NAME);
            }
            else
            {
                drawComp.addSprite("Artwork.Foreground.WideDoorClosed", "RunningGame.Resources.Artwork.Foreground.WideDoorClosed11.png", GlobalVars.DOOR_CLOSED_SPRITE_NAME);
                drawComp.addSprite("Artwork.Foreground.WideDoorOpen", "RunningGame.Resources.Artwork.Foreground.WideDoorOpen11.png", GlobalVars.DOOR_OPEN_SPRITE_NAME);
            }

            if (defaultClosed)
            {
                drawComp.setSprite(GlobalVars.DOOR_CLOSED_SPRITE_NAME);
            }
            else
            {
                drawComp.setSprite(GlobalVars.DOOR_OPEN_SPRITE_NAME);
            }

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            if (defaultClosed)
            {
                addComponent(new ColliderComponent(this, GlobalVars.BASIC_SOLID_COLLIDER_TYPE), true);
            }

            /*SWITCH LISTENER - It listens for a switch
             */
            string eventType = GlobalVars.DOOR_EVENT_TYPE;

            if (!defaultClosed)
            {
                eventType = GlobalVars.DEFAULT_OPEN_DOOR_EVENT_TYPE;
            }
            addComponent(new SwitchListenerComponent(switchId, eventType), true);
        }
Esempio n. 3
0
        public void addMyComponents(float x, float y, float width, float height)
        {
            //Position Component
            addComponent(new PositionComponent(x, y, width, height, this), true);

            if (!GlobalVars.fullForegroundImage)
            {
                //Draw component
                DrawComponent drawComp = new DrawComponent(defaultWidth, defaultHeight, level, true);
                drawComp.addSprite("Artwork.Foreground.Grass.Dirt", "RunningGame.Resources.Artwork.Foreground.Grass.Dirt61.png", dirtSpriteName);
                string grassFile = "placeholder";
                if (!GlobalVars.simpleGround)
                {
                    grassFile = "Artwork.Foreground.Grass.Grass0";
                    Random rand = new Random(this.randId);
                    switch (rand.Next(0, 5))
                    {
                    case (1):
                        grassFile = "Artwork.Foreground.Grass.Grass1";
                        break;

                    case (2):
                        grassFile = "Artwork.Foreground.Grass.Grass2";
                        break;

                    case (3):
                        grassFile = "Artwork.Foreground.Grass.Grass3";
                        break;

                    case (4):
                        grassFile = "Artwork.Foreground.Grass.Grass4";
                        break;
                    }
                }
                else
                {
                    grassFile = "Artwork.Foreground.Grass.SimpGrass";
                }

                drawComp.addSprite(grassFile, "RunningGame.Resources.Artwork.Foreground.Grass61.png", grassSpriteName);
                drawComp.setSprite(dirtSpriteName);
                addComponent(drawComp, true);
            }
            //Collider
            ColliderComponent c = ( ColliderComponent )addComponent(new ColliderComponent(this, GlobalVars.BASIC_SOLID_COLLIDER_TYPE, defaultWidth - 1, defaultHeight - 1));

            c.hasTransparentPixels = false;
            c.collideOnNoSprite    = true;
        }
Esempio n. 4
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Resources.Creatures.DeadPlayer", "RunningGame.Resources.Artwork.Creatures.DeadPlayer.png", "Main"); //Add image
            drawComp.setSprite("Main");                                                                                                     //Set image to active image

            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            //addComponent(new AnimationComponent(0.0005f));

            /*VELOCITY COMPONENT - Does it move?
             */
            addComponent(new VelocityComponent(0, 0), true);

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.BASIC_SOLID_COLLIDER_TYPE), true);

            /*GRAVITY COMPONENT - Does it have Gravity?
             * There's a standard gravity in GlobalVars
             */
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);
        }
Esempio n. 5
0
        //------------------------------------------------------------------------------------------------------------------

        public void addMyComponents(float x, float y)
        {
            this.lastCheckpointState = startingState;
            this.resetOnCheckpoint   = false;

            //POSITION COMPONENT - Does it have a position?
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //DRAW COMPONENT - Does it get drawn to the game world?
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Foreground.switchUp", "RunningGame.Resources.Artwork.Foreground.switchUp11.png", GlobalVars.SWITCH_INACTIVE_SPRITE_NAME);
            drawComp.addSprite("Artwork.Foreground.switchRight", "RunningGame.Resources.Artwork.Foreground.switchRight11.png", GlobalVars.SWITCH_ACTIVE_SPRITE_NAME);
            drawComp.setSprite(GlobalVars.SWITCH_INACTIVE_SPRITE_NAME);

            //COLLIDER - Does it hit things?
            addComponent(new ColliderComponent(this, GlobalVars.SWITCH_COLLIDER_TYPE), true);

            //Swich Component - Is it a switch? Yes.
            addComponent(new SwitchComponent(startingState), true);
        }
Esempio n. 6
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Other.WhiteSquare.png", "Main");
            drawComp.setSprite("Main");   //Set image to active image

            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            addComponent(new AnimationComponent(0.2f));


            List <string> anim = new List <string>()
            {
                "Artwork.Creatures.vision_orb1",
                "Artwork.Creatures.vision_orb2",
            };
            List <string> animDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Creatures.vision_orb1.png",
                "RunningGame.Resources.Artwork.Creatures.vision_orb2.png",
            };

            drawComp.addAnimatedSprite(anim, animDefaults, "MainAnim");
            drawComp.setSprite("MainAnim");


            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.VISION_ORB_UNLOCK_COLLIDER), true);

            /*GRAVITY COMPONENT - Does it have Gravity?
             * There's a standard gravity in GlobalVars
             */
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);
        }
Esempio n. 7
0
        public void addMyComponents(float x, float y)
        {
            //position and velocity
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.GreenSplat", "RunningGame.Resources.Artwork.Foreground.GreenSplat.png", "Main");
            drawComp.setSprite("Main");   //Set image to active image
            addComponent(new ColliderComponent(this, GlobalVars.BOUNCE_POSTGROUND_COLLIDER_TYPE, defaultWidth - 4, defaultHeight + 3), true);
        }
Esempio n. 8
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, int msg)
        {
            string message = "A MSG";

            switch (msg)
            {
            case (0):
                message = "Left Click to Shoot!";
                break;

            case (1):
                message = "Exit the right side of the Level to Continue!";
                break;

            case (2):
                message = "You can activate switches by shooting them!";
                break;

            case (3):
                message = "Combine powerups in creative\nways for the best effects!";
                break;

            case (4):
                message = "Not all enemies are vulnerable to your weapon,\nbut perhaps there are other ways to handle them...";
                break;
            }

            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);
            addComponent(new SignComponent(message), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = (DrawComponent)addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            // Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.Sign", "RunningGame.Resources.Artwork.Foreground.Sign10.png", "Main");
            drawComp.setSprite("Main"); //Set image to active image

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.SIGN_COLLIDER_TYPE), true);
        }
Esempio n. 9
0
        public void addMyComponents(float x, float y)
        {
            //position and velocity
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.BlueDrop", "RunningGame.Resources.Artwork.Foreground.BlueDrop.png", "Main");
            drawComp.setSprite("Main");   //Set image to active image
            addComponent(new VelocityComponent(0, 0));


            addComponent(new ColliderComponent(this, GlobalVars.SPEEDY_PREGROUND_COLLIDER_TYPE), true);
            //Out of screen removal
            addComponent(new ScreenEdgeComponent(3, 3, 3, 3));
        }
Esempio n. 10
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, int dir)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            PositionComponent posComp = ( PositionComponent )addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);
            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            string sprName = "Main";

            drawComp.addSprite("Artwork.Foreground.Spike", "RunningGame.Resources.Artwork.Foreground.Spike.png", sprName);
            drawComp.setSprite(sprName);   //Set image to active image

            //Won't always be the same as spr name
            //Like if it's been de-colored as a result of being in a
            //World's 1st level before the color orb is obtained.
            string currentSprite = drawComp.activeSprite;

            //Rotate accordingly
            for (int i = 0; i < dir; i++)
            {
                drawComp.rotateFlipAllSprites(System.Drawing.RotateFlipType.Rotate90FlipNone);
            }

            /*
             * DIRECTIONAL COMPONENT - it has a direction (used by collision)
             */
            addComponent(new DirectionalComponent(dir), true);

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.SPIKE_COLLIDER_TYPE, 4, 4), true);
        }
Esempio n. 11
0
        public void addMyComponents(float x, float y)
        {
            //Position Component
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //Draw component
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Other.WhiteSquare.png", "Main");
            drawComp.setSprite("Main");

            //Velocity Component
            addComponent(new VelocityComponent(0, 0), true);

            //Collider
            addComponent(new ColliderComponent(this, GlobalVars.BASIC_SOLID_COLLIDER_TYPE), true);

            //Gravity Component
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);
        }
Esempio n. 12
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, float w, float h)
        {
            /*POSITION COMPONENT
             */
            addComponent(new PositionComponent(x, y, w, h, this));

            /*DRAW COMPONENT
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.useAlreadyLoadedImage = false;
            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Background.Bkg11.png", "Main");
            drawComp.setSprite("Main");

            /* ANIMATION COMPONENT
             */
            //addComponent(new AnimationComponent(0.0005f));

            /*BACKGROUND COMPONENT
             */
            addComponent(new BackgroundComponent(), true);
        }
Esempio n. 13
0
        //------------------------------------------------------------------------------------------------------------------

        public void addMyComponents(float x, float y)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Other.WhiteSquare.png", "Main");
            drawComp.setSprite("Main");

            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            //addComponent(new AnimationComponent(0.0005f));

            /*VELOCITY COMPONENT - Does it move?
             */
            //addComponent(new VelocityComponent(0, 0));

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.END_LEVEL_COLLIDER_TYPE), true);

            /*GRAVITY COMPONENT - Does it have Gravity?
             * There's a standard gravity in GlobalVars
             */
            //addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY));
        }
Esempio n. 14
0
        public void addMyComponents(float x, float y)
        {
            //Position Component
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //Draw component
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Foreground.GreenDrop", "RunningGame.Resources.Artwork.Foreground.GreenDrop.png", "Main");
            drawComp.setSprite("Main");


            //Velocity Component
            addComponent(new VelocityComponent(0, 0), true);

            //Collider
            addComponent(new ColliderComponent(this, GlobalVars.BOUNCE_PREGROUND_COLLIDER_TYPE), true);

            //Gravity Component
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);

            //Out of screen removal
            addComponent(new ScreenEdgeComponent(3, 3, 3, 3));
        }
Esempio n. 15
0
        //This creates the background entity for the level.
        public BackgroundEntity getMyBackgroundEntity()
        {
            string fullImageAddress = "RunningGame.Resources.Artwork.Background.Bkg11.png";
            string imageStub        = "Artwork.Background.Bkg";
            //string preColorImageStub = "Artwork.Background.BkgPreColor";
            //string fullImageAddress = "RunningGame.Resources.Artwork.Background.back21.png";
            //string imageStub = "Artwork.Background.back";


            Bitmap tempImg = getBkgImg();

            float newWidth  = tempImg.Width;
            float newHeight = tempImg.Height;

            if (!GlobalVars.fullForegroundImage)
            {
                float scaleFactor = 1.1f;

                while (newWidth / scaleFactor > levelWidth || newHeight / scaleFactor > levelHeight)
                {
                    newWidth  /= scaleFactor;
                    newHeight /= scaleFactor;
                }

                while (newWidth < levelWidth || newHeight < levelHeight)
                {
                    newWidth  *= scaleFactor;
                    newHeight *= scaleFactor;
                }
            }
            BackgroundEntity  bkgEnt   = new BackgroundEntity(this, 0, 0, newWidth, newHeight);
            DrawComponent     drawComp = ( DrawComponent )bkgEnt.getComponent(GlobalVars.DRAW_COMPONENT_NAME);
            PositionComponent posComp  = ( PositionComponent )bkgEnt.getComponent(GlobalVars.POSITION_COMPONENT_NAME);


            /*
             * //Static Background
             * if (sysManager.bkgPosSystem.scrollType == 0)
             * {
             *  float initWidth = drawComp.getImage().Width;
             *  float initHeight = drawComp.getImage().Height;
             *
             *  float xDiff = Math.Abs(initWidth - levelWidth);
             *  float yDiff = Math.Abs(initHeight - levelHeight);
             *
             *  //Make it fit horizontally
             *  if (xDiff < yDiff)
             *  {
             *      float ratio = initWidth / levelWidth;
             *      getMovementSystem().changeSize(posComp, levelWidth, initHeight * ratio);
             *      drawComp.resizeImages((int)levelWidth, (int)(initHeight * ratio));
             *      getMovementSystem().changePosition(posComp, levelWidth/2, levelHeight-initHeight*ratio/2, false);
             *  }
             *  //Make it fit vertically
             *  else
             *  {
             *      float ratio = initHeight / levelHeight;
             *      getMovementSystem().changeSize(posComp, initWidth*ratio , levelHeight);
             *      drawComp.resizeImages((int)(initWidth*ratio), (int)(levelHeight));
             *      getMovementSystem().changePosition(posComp, initWidth * ratio / 2, levelHeight / 2, false);
             *  }
             * }
             * else if (sysManager.bkgPosSystem.scrollType == 3)
             * {
             *  Bitmap tempImg = getBkgImg();
             *  float newWidth = tempImg.Width;
             *  float newHeight = tempImg.Height;
             *
             *  float scaleFactor = 1.1f;
             *
             *  while (newWidth/scaleFactor > levelWidth || newHeight/scaleFactor > levelHeight)
             *  {
             *      newWidth /= scaleFactor;
             *      newHeight /= scaleFactor;
             *  }
             *
             *  while (newWidth < levelWidth || newHeight < levelHeight)
             *  {
             *      newWidth *= scaleFactor;
             *      newHeight *= scaleFactor;
             *  }
             *
             *  getMovementSystem().changeSize(posComp, newWidth, newHeight);
             *  drawComp.width = newWidth;
             *  drawComp.height = newHeight;
             *  drawComp.resizeImages((int)newWidth, (int)newHeight);
             *  getMovementSystem().changePosition(posComp, newWidth / 2, newHeight / 2, false);
             * }
             * */
            /*
             * //Proportion Scrolling
             * if (sysManager.bkgPosSystem.scrollType == 1 || sysManager.bkgPosSystem.scrollType == 2)
             * {
             *  System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
             *  // THIS WONT WORK BECAUSE IT"S GETTING THE DEFAULT IMAGE NOT IMAGE STUB
             *  System.IO.Stream myStream = myAssembly.GetManifestResourceStream(fullImageAddress);
             *  Bitmap sprite = new Bitmap(myStream); //Getting an error here? Did you remember to make your image an embedded resource?
             *  myStream.Close();
             *
             *  float w = sprite.Width;
             *  float h = sprite.Height;
             *
             *  float multiplier = 0.5f;
             *
             *  while (w > levelWidth || (h > levelHeight && sysManager.bkgPosSystem.scrollType == 1))
             *  {
             *      w *= multiplier;
             *      h *= multiplier;
             *  }
             *
             *  getMovementSystem().changeSize(posComp, w, h);
             *
             * }
             */

            drawComp.addSprite(imageStub, fullImageAddress, "MainBkg");
            drawComp.setSprite("MainBkg");

            bkgEnt.isStartingEntity = true;

            return(bkgEnt);
        }
Esempio n. 16
0
        public void addMyComponents(float x, float y)
        {
            this.resetOnCheckpoint = true;

            //Position Component
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //Velocity Component
            addComponent(new VelocityComponent(0, 0), true);

            //Draw component
            DrawComponent drawComp = new DrawComponent(( int )defaultWidth, ( int )defaultHeight, level, false);

            drawComp.addSprite("Artwork.Creatures.player1", "RunningGame.Resources.Artwork.Creatures.player1.png", rightImageName);
            drawComp.addSprite("Artwork.Creatures.player1", "RunningGame.Resources.Artwork.Creatures.player2.png", leftImageName);
            drawComp.rotateFlipSprite(leftImageName, RotateFlipType.RotateNoneFlipX);
            addComponent(drawComp);

            addWalkAnimation("RunningGame.Resources.Artwork.Creatures.player", walkLeft, walkRight, drawComp);
            addWalkAnimation("RunningGame.Resources.Artwork.Creatures.PlayerBlue", walkBlueLeft, walkBlueRight, drawComp);
            addWalkAnimation("RunningGame.Resources.Artwork.Creatures.PlayerOrange", walkOrangeLeft, walkOrangeRight, drawComp);
            addWalkAnimation("RunningGame.Resources.Artwork.Creatures.PlayerGreen", walkGreenLeft, walkGreenRight, drawComp);

            drawComp.setSprite(rightImageName, true);

            setNormalImage();


            //Animation Component
            AnimationComponent animComp = ( AnimationComponent )addComponent(new AnimationComponent(GlobalVars.playerAnimatonSpeed), true);

            animComp.animationOn = false;

            //Player Component
            addComponent(new PlayerComponent(), true);

            //Player Input Component
            addComponent(new PlayerInputComponent(this), true);

            //Collider
            addComponent(new ColliderComponent(this, GlobalVars.PLAYER_COLLIDER_TYPE, defaultWidth - 4, defaultHeight - 4), true);

            /*
             * //Squish Component
             * SquishComponent sqComp = ( SquishComponent )addComponent( new SquishComponent( defaultWidth, defaultHeight, defaultWidth * 1.2f, defaultHeight * 1.2f, defaultWidth / 2f, defaultHeight / 2f, defaultWidth * defaultHeight * 1.1f, defaultWidth * defaultHeight / 1.5f ), true );
             * sqComp.maxHeight = defaultHeight;
             * sqComp.maxWidth = defaultWidth * 1.1f;
             * sqComp.minHeight = defaultHeight / 1.1f;
             * sqComp.minWidth = defaultWidth / 1.1f;
             * sqComp.maxSurfaceArea = defaultHeight * defaultWidth * 1.1f;
             * sqComp.minSurfaceArea = defaultHeight * defaultWidth / 1.1f;
             */


            //Gravity Component
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);

            //Health Component
            addComponent(new HealthComponent(100, true, 1, 0.5f, level), true);

            //Screen Edge Stop/Wrap/End Level
            addComponent(new ScreenEdgeComponent(1, 4, 1, 5), true);
        }
Esempio n. 17
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, int dir, int switchId)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = (DrawComponent)addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.SmushBlock", "RunningGame.Resources.Artwork.Foreground.SmushBlock.png", "Main");
            for (int i = 0; i < dir + 2; i++)
            {
                drawComp.rotateFlipAllSprites(System.Drawing.RotateFlipType.Rotate90FlipNone);
            }
            drawComp.setSprite("Main"); //Set image to active image


            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            //addComponent(new AnimationComponent(0.0005f), true);

            /*VELOCITY COMPONENT - Does it move?
             */
            addComponent(new VelocityComponent(0, 0));

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.SMUSH_BLOCK_COLLIDER), true);

            /*DIRECTION - It has a direction
             */
            DirectionalComponent dirComp = (DirectionalComponent)addComponent(new DirectionalComponent(dir));

            /*OFF SIDE OF SCREEN - Stop when it hits the side of the screen.
             */
            addComponent(new ScreenEdgeComponent(1, 1, 1, 1));

            /*SMUSH - It's a smusher!
             */
            SmushComponent smushComp = ( SmushComponent )addComponent(new SmushComponent(0.0f));

            if (dirComp.isUp())
            {
                smushComp.setToUp();
            }
            else if (dirComp.isRight())
            {
                smushComp.setToRight();
            }
            else if (dirComp.isDown())
            {
                smushComp.setToDown();
            }
            else if (dirComp.isLeft())
            {
                smushComp.setToLeft();
            }

            /*TIMER - It does stuff with a timer.
             */
            addComponent(new TimerComponent());

            /* SWITCH LISTENER - Can be linked to a switch to prevent it from falling.
             */
            addComponent(new SwitchListenerComponent(switchId, GlobalVars.SMUSH_SWITCH_EVENT));
        }
Esempio n. 18
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y)
        {
            this.resetOnCheckpoint = false;

            /*POSITION COMPONENT - it has a position
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             */
            DrawComponent drawComp = (DrawComponent)addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.Checkpoint.UncheckedCheckpoint", "RunningGame.Resources.Artwork.Foreground.Checkpoint.UncheckedCheckpoint.png", uncheckedImageName);
            drawComp.addSprite("Artwork.Foreground.Checkpoint.CheckedCheckpoint", "RunningGame.Resources.Artwork.Foreground.Checkpoint.CheckedCheckpoint.png", checkedImageName);
            drawComp.setSprite(uncheckedImageName); //Set image to active image


            List <string> animImgDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.UncheckedCheckpoint.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck1.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck2.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck3.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck4.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck3.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck2.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck1.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.UncheckedCheckpoint.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck5.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.animCheck6.png",
                "RunningGame.Resources.Artwork.Foreground.Checkpoint.CheckedCheckpoint.png",
            };
            List <string> animImg = new List <string>()
            {
                "Artwork.Foreground.Checkpoint.UncheckedCheckpoint",
                "Artwork.Foreground.Checkpoint.animCheck1",
                "Artwork.Foreground.Checkpoint.animCheck2",
                "Artwork.Foreground.Checkpoint.animCheck3",
                "Artwork.Foreground.Checkpoint.animCheck4",
                "Artwork.Foreground.Checkpoint.animCheck3",
                "Artwork.Foreground.Checkpoint.animCheck2",
                "Artwork.Foreground.Checkpoint.animCheck1",
                "Artwork.Foreground.Checkpoint.UncheckedCheckpoint",
                "Artwork.Foreground.Checkpoint.animCheck5",
                "Artwork.Foreground.Checkpoint.animCheck6",
                "Artwork.Foreground.Checkpoint.CheckedCheckpoint",
            };

            drawComp.addAnimatedSprite(animImg, animImgDefaults, animImageName);

            /* ANIMATION COMPONENT - Does it need animating?
             */
            AnimationComponent animComp = (AnimationComponent)addComponent(new AnimationComponent(0.001f), true);

            animComp.animationOn = false;
            animComp.pauseIndefinitelyAfterCycle = true;

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.CHECKPOINT_COLLIDER_TYPE), true);

            /*CHECKPOINT - It's a checkpoint
             */
            addComponent(new CheckPointComponent(uncheckedImageName, checkedImageName, animImageName, this), true);
        }
Esempio n. 19
0
        public void addMyComponents(float x, float y)
        {
            this.updateOutOfView = true;

            //Position Component
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            //Draw component
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            drawComp.addSprite("Artwork.Foreground.BlockSquare", "RunningGame.Resources.Artwork.Foreground.BlockSquare.png", blockNormName);
            drawComp.setSprite(blockNormName);


            List <string> animImgDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Foreground.BlockSquare.png",
                //"RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof1.png",
                "RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof2.png",
                //"RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof3.png",
                "RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof4.png",
                //"RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof5.png",
                "RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof6.png",
                "RunningGame.Resources.Artwork.Foreground.SpawnBlock.SpawnPoof7.png"
            };
            List <string> animImg = new List <string>()
            {
                "Artwork.Foreground.BlockSquare",
                //"Artwork.Foreground.SpawnBlock.SpawnPoof1",
                "Artwork.Foreground.SpawnBlock.SpawnPoof2",
                //"Artwork.Foreground.SpawnBlock.SpawnPoof3",
                "Artwork.Foreground.SpawnBlock.SpawnPoof4",
                //"Artwork.Foreground.SpawnBlock.SpawnPoof5",
                "Artwork.Foreground.SpawnBlock.SpawnPoof6",
                "Artwork.Foreground.SpawnBlock.SpawnPoof7"
            };

            drawComp.addAnimatedSprite(animImg, animImgDefaults, blockAnimationName);

            AnimationComponent animComp = (AnimationComponent)addComponent(new AnimationComponent(0.0001f), true);

            animComp.animationOn       = false;
            animComp.destroyAfterCycle = true;

            //Velocity Component
            addComponent(new VelocityComponent(0, 0), true);

            //Collider
            addComponent(new ColliderComponent(this, GlobalVars.SPAWN_BLOCK_COLLIDER_TYPE), true);

            //Gravity Component
            addComponent(new GravityComponent(0, GlobalVars.STANDARD_GRAVITY), true);

            //Spawn Block Component
            addComponent(new SpawnBlockComponent(), true);

            //Off side of screen
            addComponent(new ScreenEdgeComponent(3, 3, 3, 3), true);

            /*
             * //Pushable
             * PushableComponent pushComp = (PushableComponent)addComponent( new PushableComponent(), true );
             * pushComp.horiz = true;
             * pushComp.vert = false;
             */
        }
Esempio n. 20
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, float time, bool fill)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = (DrawComponent)addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Foreground.Grass", "RunningGame.Resources.Artwork.Foreground.Grass11.png", "Bkp");



            List <string> animMain = new List <string>()
            {
                "Artwork.Foreground.TimeDial.CTP1",
                "Artwork.Foreground.TimeDial.CTP2",
                "Artwork.Foreground.TimeDial.CTP3",
                "Artwork.Foreground.TimeDial.CTP4",
                "Artwork.Foreground.TimeDial.CTP5",
                "Artwork.Foreground.TimeDial.CTP6",
                "Artwork.Foreground.TimeDial.CTP7",
                "Artwork.Foreground.TimeDial.CTP8",
                "Artwork.Foreground.TimeDial.CTP9",
                "Artwork.Foreground.TimeDial.CTP10",
                "Artwork.Foreground.TimeDial.CTP11",
                "Artwork.Foreground.TimeDial.CTP12"
            };
            List <string> animDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP0.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP1.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP2.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP3.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP4.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP5.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP6.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP7.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP8.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP9.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP10.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP11.png",
                "RunningGame.Resources.Artwork.Foreground.TimeDial.CTP12.png"
            };

            if (!fill)
            {
                animMain.Reverse();
                animDefaults.Reverse();
            }

            drawComp.addAnimatedSprite(animMain, animDefaults, "Main");

            drawComp.setSprite("Main"); //Set image to active image

            float animationTime = time / animDefaults.Count();

            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            AnimationComponent animComp = (AnimationComponent)addComponent(new AnimationComponent(animationTime), true);

            animComp.destroyAfterCycle = true;
        }
Esempio n. 21
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Other.WhiteSquare.png", "Main");
            drawComp.setSprite("Main");   //Set image to active image

            /* ANIMATION COMPONENT - Does it need animating?
             * The float that this reads in is the amount of time (in seconds) between frames.
             * So, if it was 5, you would be on one frame for 5 seconds, then switch to the next, then 5 seconds later
             * It'd switch to the next etc, etc...
             */
            addComponent(new AnimationComponent(0.2f));


            List <string> anim = new List <string>()
            {
                "Artwork.Creatures.vision_orb1",
                "Artwork.Creatures.vision_orb2",
            };

            List <string> animDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Creatures.vision_orb1.png",
                "RunningGame.Resources.Artwork.Creatures.vision_orb2.png",
            };

            drawComp.addAnimatedSprite(anim, animDefaults, "MainAnim");
            drawComp.setSprite("MainAnim");

            /*VELOCITY COMPONENT - Does it move?
             */
            addComponent(new VelocityComponent(0, 0), true);

            /*VISION COMPONENT
             */
            addComponent(new VisionInputComponent(this), true);

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.VISION_COLLIDER_TYPE), true);

            /*HEALTH COMPONENT - Does it have health, can it die?
             * Parameters: maxHealth, startingHealth, draw a health bar?, recharge amount, recharge time
             * Basically, every rechargeTime, the entity regenerates rechargeAmount
             */
            addComponent(new HealthComponent(100, 100, true, 5, level), true);

            //Edge of screen component
            addComponent(new ScreenEdgeComponent(1, 1, 1, 1), true);
        }
Esempio n. 22
0

        
Esempio n. 23
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, float timeBetweenBursts, int shotsPerBurst, int dir, int switchId)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*VELOCITY - Just cuz'
             */
            addComponent(new VelocityComponent(), true);

            /* TIMED SHOOTER COMPONENT - It shoots at a given time interval.
             */
            TimedShooterComponent shooterComp = ( TimedShooterComponent )addComponent(new TimedShooterComponent(timeBetweenBursts, shotsPerBurst, this), true);

            startingSprite = shooterComp.badSpriteName;

            /*DRAW COMPONENT - Does it get drawn to the game world?
             */
            DrawComponent drawComp = (DrawComponent)addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image
            drawComp.addSprite("Artwork.Other.WhiteSquare", "RunningGame.Resources.Artwork.Other.WhiteSquare.png", "Bkp");

            List <string> shooterAnimation = new List <string>()
            {
                "Artwork.Foreground.Shooter.shooterp0",
                "Artwork.Foreground.Shooter.shooterp1",
                "Artwork.Foreground.Shooter.shooterp2",
                "Artwork.Foreground.Shooter.shooterp3",
                "Artwork.Foreground.Shooter.shooterp4",
                "Artwork.Foreground.Shooter.shooterp5",
                "Artwork.Foreground.Shooter.shooterp6",
                "Artwork.Foreground.Shooter.shooterp7",
                "Artwork.Foreground.Shooter.shooterp8",
                "Artwork.Foreground.Shooter.shooterp9",
                "Artwork.Foreground.Shooter.shooterp10",
                "Artwork.Foreground.Shooter.shooterp11",
                "Artwork.Foreground.Shooter.shooterp12"
            };
            List <string> shooterAnimDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp0.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp1.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp2.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp3.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp4.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp5.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp6.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp7.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp8.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp9.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp10.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp11.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.shooterp12.png"
            };


            List <string> goodShooterAnimation = new List <string>()
            {
                "Artwork.Foreground.Shooter.GoodShooter0",
                "Artwork.Foreground.Shooter.GoodShooter1",
                "Artwork.Foreground.Shooter.GoodShooter2",
                "Artwork.Foreground.Shooter.GoodShooter3",
                "Artwork.Foreground.Shooter.GoodShooter4",
                "Artwork.Foreground.Shooter.GoodShooter5",
                "Artwork.Foreground.Shooter.GoodShooter6",
                "Artwork.Foreground.Shooter.GoodShooter7",
                "Artwork.Foreground.Shooter.GoodShooter8",
                "Artwork.Foreground.Shooter.GoodShooter9",
                "Artwork.Foreground.Shooter.GoodShooter10",
                "Artwork.Foreground.Shooter.GoodShooter11",
                "Artwork.Foreground.Shooter.GoodShooter12"
            };
            List <string> goodShooterAnimDefaults = new List <string>()
            {
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter0.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter1.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter2.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter3.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter4.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter5.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter6.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter7.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter8.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter9.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter10.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter11.png",
                "RunningGame.Resources.Artwork.Foreground.Shooter.GoodShooter12.png"
            };

            drawComp.addAnimatedSprite(shooterAnimation, shooterAnimDefaults, shooterComp.badSpriteName);
            drawComp.addAnimatedSprite(goodShooterAnimation, goodShooterAnimDefaults, shooterComp.goodShooterName);
            drawComp.setSprite(startingSprite);   //Set image to active image

            float animationTime = timeBetweenBursts / shooterAnimDefaults.Count();

            /* ANIMATION COMPONENT - Does it need animating?
             */
            AnimationComponent animComp = (AnimationComponent)addComponent(new AnimationComponent(animationTime), true);

            /*COLLIDER - Does it hit things?
             */
            addComponent(new ColliderComponent(this, GlobalVars.TIMED_SHOOTER_COLLIDER_TYPE), true);

            /* TIMER COMPONENT - It makes use of timed method execution.
             */
            TimerComponent timeComp = ( TimerComponent )addComponent(new TimerComponent(), true);

            timeComp.addTimer(shooterComp.fireTimerString, timeBetweenBursts);

            /* DIRECTION COMPONENT - It points in a particular direciton.
             */
            addComponent(new DirectionalComponent(dir));

            /*VEL TO ZERO - If it's moving, it will try to stop moving.
             */
            addComponent(new VelToZeroComponent(100, 100));

            /*SWITCH LISTENER - It listens for switches.
             */
            addComponent(new SwitchListenerComponent(switchId, GlobalVars.TIMED_SHOOTER_SWITCH_EVENT));
        }
Esempio n. 24
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*DRAW COMPONENT - Does it get drawn to the game world?
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(imageWidth, imageHeight, level, true), true);

            drawComp.addSprite("Artwork.Foreground.newPlat", "RunningGame.Resources.Artwork.Foreground.newPlat11.png", "Main"); //Add image
            drawComp.setSprite("Main");                                                                                         //Set image to active image

            /*Animation
             * addComponent( new AnimationComponent( 0.05f ) );
             *
             *
             * List<string> anim = new List<string>()
             * {
             *  "Artwork.Foreground.MovPlat1",
             *  "Artwork.Foreground.MovPlat2",
             *  "Artwork.Foreground.MovPlat3",
             *  "Artwork.Foreground.MovPlat4",
             *  "Artwork.Foreground.MovPlat5",
             *  "Artwork.Foreground.MovPlat6",
             *  "Artwork.Foreground.MovPlat5",
             *  "Artwork.Foreground.MovPlat4",
             *  "Artwork.Foreground.MovPlat3",
             *  "Artwork.Foreground.MovPlat2",
             * };
             *
             * List<string> animDefaults = new List<string>()
             * {
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat111.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat211.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat311.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat411.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat511.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat611.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat511.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat411.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat311.png",
             *  "RunningGame.Resources.Artwork.Foreground.MovPLat211.png",
             * };
             *
             * drawComp.addAnimatedSprite( anim, animDefaults, "MainAnim" );
             * drawComp.setSprite( "MainAnim" );
             */
            /*VELOCITY COMPONENT - Does it move?
             */
            addComponent(new VelocityComponent(0, GlobalVars.MOVING_PLATFORM_SPEED), true);

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.MOVING_PLATFORM_COLLIDER_TYPE, defaultWidth, defaultHeight), true);

            /*MOVING PLATFORM COMPONENT
             */
            addComponent(new MovingPlatformComponent(this), true);
        }
Esempio n. 25
0
        //------------------------------------------------------------------------------------------------------------------

        //Here's where you add all the components the entity has.
        //You can just uncomment the ones you want.
        public void addMyComponents(float x, float y, int dir, int state)
        {
            /*POSITION COMPONENT - Does it have a position?
             */
            PositionComponent posComp = ( PositionComponent )addComponent(new PositionComponent(x, y, defaultWidth, defaultHeight, this), true);

            /*VELOCITY COMPONENT - It moves
             */
            addComponent(new VelocityComponent());

            /*DRAW COMPONENT - Does it get drawn to the game world?
             * You'll need to know the address for your image.
             * It'll probably be something along the lines of "RunningGame.Resources.[      ].png" ONLY png!!
             * First create the component
             * Then add the image
             * Then set the image to the active image
             */
            DrawComponent drawComp = ( DrawComponent )addComponent(new DrawComponent(defaultWidth, defaultHeight, level, true), true);

            //Add image - Use base name for first parameter (everything in file path after Resources. and before the numbers and .png)
            //Then second parameter is full filepath to a default image

            drawComp.addSprite("Artwork.Foreground.GoodSpike", "RunningGame.Resources.Artwork.Foreground.GoodSpike.png", goodSpikeImageName);
            drawComp.addSprite("Artwork.Foreground.BadSpike", "RunningGame.Resources.Artwork.Foreground.BadSpike.png", badSpikeImageName);

            if (state == 1)
            {
                drawComp.setSprite(goodSpikeImageName);
            }
            else
            {
                drawComp.setSprite(badSpikeImageName);   //Set image to active image
            }
            //Won't always be the same as spr name
            //Like if it's been de-colored as a result of being in a
            //World's 1st level before the color orb is obtained.
            string currentSprite = drawComp.activeSprite;

            //Rotate accordingly
            for (int i = 0; i < dir; i++)
            {
                drawComp.rotateFlipAllSprites(System.Drawing.RotateFlipType.Rotate90FlipNone);
            }


            /** GENERAL STATE COMPONENT - Need to store a state variable.
             * State = 0 --> Hurt Player
             * State = 1 --> Hurt Enemy
             */
            addComponent(new GeneralStateComponent(state), true);

            /*
             * DIRECTIONAL COMPONENT - it has a direction (used by collision)
             */
            addComponent(new DirectionalComponent(dir), true);

            /*COLLIDER - Does it hit things?
             * The second field is the collider type. Look in GlobalVars for a string with the right name.
             */
            addComponent(new ColliderComponent(this, GlobalVars.SHOOTER_BULLET_COLLIDER_TYPE), true);

            /* OUT OF SCREEN COOMPONENT - Destroy on exiting screen.
             */
            addComponent(new ScreenEdgeComponent(3, 3, 3, 3), true);
        }