Example #1
0
        public override void Initialize(ContentManager _Content)
        {
            base.Initialize(_Content);

            //Content = content;
            content.RootDirectory = "Content";

            longstrip = new Sprite("Story/Vesuvius/p1");
            longstrip.Initialize(content);
            finalimage = new Sprite("Story/Vesuvius/p2");
            finalimage.Initialize(content);

            finalimage.Dimension = BaseGame.Get.BackBufferDimensions;// / finalimage.Dimension;
            // finalimage.Width *= 2.0f;

            float oldWidth = longstrip.Width;

            longstrip.Width  = Jabber.BaseGame.Get.BackBufferWidth;// *2.0f;
            longstrip.Height = Jabber.BaseGame.Get.BackBufferHeight;
            // longstrip.PosX = Jabber.BaseGame.Get.BackBufferWidth / 2.0f;

            finalimage.PosX = Jabber.BaseGame.Get.BackBufferWidth / 2.0f;

            AudioManager.StopTheMusic();
            AudioManager.PlayMusic("vesuviusmusic");
        }
Example #2
0
        static void GetNewAd()
        {
            if (AdShowing)
            {
                //AdSprite.Texture.Dispose();
            }

            if (AdSprite == null)
            {
                somaAd         = new SomaAd();
                somaAd.Adspace = 65737880;
                somaAd.Pub     = 923834393;

                AdSprite = new Sprite("ui/ui");
                AdSprite.Initialize(BaseGame.Get.Content);
                textureSomaAd = thisContent.Load <Texture2D>("sampleAd");

                AdSprite.Texture = textureSomaAd;
                AdSprite.Width   = 480 * 0.7f;
                AdSprite.Height  = 79 * 0.7f;
                AdSprite.Handle  = BaseSprite.SpriteHandle.BOTTOMCENTER;
            }
            AdShowing = false;
            somaAd.GetAd();
            timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            AdDelayTillNext = BaseGame.Random.Next(20, 40);
        }
Example #3
0
        public override void Initialize(ContentManager Content)
        {
            base.Initialize(Content);

            CreateFramesFromXML("ui/ui_frames");

            CurrentFrame = "levelbutton";
            ResetDimensions();
            UniformScale = 0.8f * ScaleFactor / Camera.Get.UniformWorldScale;

            Colour = new Color(1, 1, 1, 0);

            text = new TextDrawer("ui/LevelFont");
            text.Initialize(Content);
            text.Text = Level.ToString();
            if (!ChicksnVixensGame.Get.LevelUnlocked(location, Level))
            {
                text.Text = "X";

                padLock.Initialize(Content);
                padLock.CreateFramesFromXML("ui/ui_frames");
                padLock.CurrentFrame = "lock";
                padLock.ResetDimensions();
                padLock.UniformScale = ScaleFactor;
            }

            stars = new Sprite("ui/ui");
            stars.Initialize(Content);
            stars.CreateFramesFromXML("ui/ui_frames");
            stars.CurrentFrame = "star";

            stars.ResetDimensions();
            stars.UniformScale = ScaleFactor * 0.3f;
        }
Example #4
0
        public override void LoadContent()
        {
            base.LoadContent();

            Texture2D spriteSheet = Game.Content.Load <Texture2D>(@"PlayerOneSpriteSheet");
            int       spriteSize  = 20;

            Initialize(spriteSheet, new Rectangle(0, 0, spriteSize, spriteSize), Vector2.Zero, Scale, false);  //Standing Right 0
            AddFrame(new Rectangle(spriteSize + 1, 0, spriteSize, spriteSize));                                //Standing Left 1
            AddFrame(new Rectangle(0, spriteSize * 2 + 2, spriteSize, spriteSize));                            //Breaking Right 2
            AddFrame(new Rectangle(spriteSize + 1, spriteSize * 2 + 2, spriteSize, spriteSize));               //Breaking Left 3
            m_RunRight.Initialize(spriteSheet, new Rectangle(0, spriteSize * 3 + 3, spriteSize, spriteSize),
                                  Vector2.Zero, Scale, true);                                                  //Running Right 0
            m_RunRight.AddFrame(new Rectangle(spriteSize + 1, spriteSize * 3 + 3, spriteSize, spriteSize));    //Running Right 1
            m_RunLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 2 + 2, spriteSize * 3 + 3, spriteSize, spriteSize),
                                 Vector2.Zero, Scale, true);                                                   //Running Left 0
            m_RunLeft.AddFrame(new Rectangle(spriteSize * 3 + 3, spriteSize * 3 + 3, spriteSize, spriteSize)); //Running Left 1
            m_FlyingRight.Initialize(spriteSheet, new Rectangle(0, spriteSize + 1, spriteSize, spriteSize), Vector2.Zero,
                                     Scale, true);
            m_FlyingRight.AddFrame(new Rectangle(spriteSize + 1, spriteSize + 1, spriteSize, spriteSize));
            m_FlyingRight.AddFrame(new Rectangle(spriteSize * 2 + 2, spriteSize + 1, spriteSize, spriteSize));
            m_FlyingLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 3 + 3, spriteSize + 1, spriteSize, spriteSize),
                                    Vector2.Zero, Scale, true);
            m_FlyingLeft.AddFrame(new Rectangle(spriteSize * 4 + 4, spriteSize + 1, spriteSize, spriteSize));
            m_FlyingLeft.AddFrame(new Rectangle(spriteSize * 5 + 5, spriteSize + 1, spriteSize, spriteSize));
            m_FlyWOPlayerRight.Initialize(spriteSheet, new Rectangle(0, spriteSize * 4 + 4, spriteSize, spriteSize),
                                          Vector2.Zero, Scale, false);
            m_FlyWOPlayerRight.AddFrame(new Rectangle(spriteSize + 1, spriteSize * 4 + 4, spriteSize, spriteSize));
            m_FlyWOPlayerRight.AddFrame(new Rectangle(spriteSize * 2 + 2, spriteSize * 4 + 4, spriteSize, spriteSize));
            m_FlyWOPlayerLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 3 + 3, spriteSize * 4 + 4, spriteSize, spriteSize),
                                         Vector2.Zero, Scale, false);
            m_FlyWOPlayerLeft.AddFrame(new Rectangle(spriteSize * 4 + 4, spriteSize * 4 + 4, spriteSize, spriteSize));
            m_FlyWOPlayerLeft.AddFrame(new Rectangle(spriteSize * 5 + 5, spriteSize * 4 + 4, spriteSize, spriteSize));
        }
Example #5
0
        public override void Initialize(ContentManager content)
        {
            base.Initialize(content);
            AsType.CreateFramesFromXML("fox_frames");

            AsType.ResetDimensions();
            AsType.UniformScale = 1.0f;

            AsType.Animation = "Idle";

            AsType.FrameChanges += OnFrameChange;

            AsType.Width  = 128;
            AsType.Height = 128;

            //  if (screen.location == "bavaria")
            {
                locationHat = screen.location;
                locationHat = LocationToHat;
            }

            hat = new Sprite("hats/" + locationHat);
            hat.Initialize(content);
            hat.CreateFramesFromXML("hats/" + locationHat + "_frames");
            hat.CurrentFrame = locationHat + "-idle-000";
            hat.ResetDimensions();
        }
Example #6
0
        void LoadTNT(XElement elements)
        {
            List <BaseSprite> l = CreateBaseSprites(elements);
            List <JabActor>   b = CreateBodies(elements);

            for (int i = 0; i < l.Count; i++)
            {
                Sprite s = new Sprite("misc");
                s.Initialize(Content);
                s.CreateFramesFromXML("misc_frames");
                s.CurrentFrame = "tnt";
                s.ResetDimensions();
                s.Position = l[i].Position;
                s.Rot      = l[i].Rot;

                TNT t = new TNT(this);
                t.World           = World;
                t.Body            = World.CreateBox(s.Dimension * l[i].Scale, s.Position, JabActor.BodyType.DYNAMIC);
                t.Body.Rot        = s.Rot;
                t.Body.Mass       = 2.0f;
                t.Sprite          = s;
                t.DoDimensions    = false;
                t.PhysicsPosition = true;
                t.PhysicsRotate   = true;
                t.Initialize(Content);

                AddNode(t);
            }
        }
        /// <summary>
        /// Initialize the sprite
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            for (Int32 i = 0; i < _toolTypes.Length; i++)
            {
                _tools[i].Initialize();
            }
            _selection.Initialize();
        }
 /// <summary>
 /// Assigns a special version of a sprite that uses the Sprite Atlas.
 /// Only really used on the Prepare screen at the moment.
 /// </summary>
 /// <param name="name"></param>
 public void AssignAtlasSprite(string name)
 {
     if (sprite == null)
     {
         sprite = ((GameObject)Instantiate(Resources.Load("atlasspr"), this.transform)).GetComponent <Sprite>();
         sprite.Initialize();
     }
     //
     sprite.AssignSprite(name);
 }
Example #9
0
        protected virtual Sprite CreateFeather()
        {
            Sprite s = new Sprite("ui/ui");

            s.Initialize(BaseGame.Get.Content);
            s.CreateFramesFromXML("ui/ui_frames");
            s.CurrentFrame = "circle";
            s.ResetDimensions();
            s.Position = Body.Position;
            return(s);
        }
Example #10
0
        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the orientation at launch
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface window availability events
            ApplicationServices.WindowInteractive    += OnWindowInteractive;
            ApplicationServices.WindowNoninteractive += OnWindowNoninteractive;
            ApplicationServices.WindowUnavailable    += OnWindowUnavailable;

            // Setup the UI to transform if the UI is rotated.
            // Create a rotation matrix to orient the screen so it is viewed correctly
            // when the user orientation is 180 degress different.
            Matrix inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                              Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width,
                                                       graphics.GraphicsDevice.Viewport.Height,
                                                       0);

            if (currentOrientation == UserOrientation.Top)
            {
                screenTransform = inverted;
            }

            screenWidth  = Program.WindowSize.Width;
            screenHeight = Program.WindowSize.Height;

            manager           = new Manager();
            manager.Behaviour = new Behaviour(screenWidth, screenHeight);
            manager.Initialize(this, touchTarget, Manager.SelectionMode.NONE);

            batLeft = new Sprite("raquette1", "raquette1");
            batLeft.Initialize(touchTarget);
            batLeft.Weight = 1;
            manager.register(batLeft);

            batRight = new Sprite("raquette2", "raquette2");
            batRight.Initialize(touchTarget);
            batRight.Weight   = 1;
            batRight.Position = new Vector2(screenWidth - 140, screenHeight - 455);
            manager.register(batRight);

            bignou = new Sprite("bignou", "paletGame");
            bignou.Initialize(touchTarget);
            bignou.Position = new Vector2((screenWidth - 250) / 2, (screenHeight - 250) / 2);
            manager.register(bignou);

            base.Initialize();
        }
Example #11
0
        public override void Initialize(ContentManager content)
        {
            base.Initialize(content);

            bgSprite = new Sprite(bgdir);
            bgSprite.Initialize(content);
            bgSprite.DrawIn = BaseSprite.DrawSpace.SCREENSPACE;
            bgSprite.Handle = BaseSprite.SpriteHandle.TOPLEFT;

            bgSprite.Width = bgSprite.Height = 1.0f;
        }
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Sprite.Initialize(Content, GraphicsDevice);
            Font.Initialize(Content);

            #if DEBUG
            //var window = System.Windows.Forms.Form.FromHandle(Window.Handle);
            //window.Location = new System.Drawing.Point(-1366, 200);
            #endif

            base.Initialize();
        }
        // Recherche la cible
        public override void SearchTarget()
        {
            double distance = Math.Pow(target.Origin.X - ai.Origin.X, 2) + Math.Pow(target.Origin.Y - ai.Origin.Y, 2);

            if (target.Map.Name != ai.Map.Name || distance > Math.Pow(ai.Tenacity, 2))
            {
                ai.Sprites = new List <Sprite>();
                Sprite sprite = new Sprite(ai, "boutonStandard");
                ai.Sprites.Add(sprite);
                sprite.Initialize();

                ai.State = new StandardState(ai);
            }
        }
Example #14
0
        /// <summary>
        /// Initializes all underlying sprites
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            _placingSprite.Initialize();
            _cursorStandard.Initialize();
            _cursorDelete.Initialize();
            _spriteLogo.Initialize();
            _spriteTime.Initialize();
            _spriteHappyPoints.Initialize();

            _cursorStandard.Visible = _source.Type != BlockType.Delete;
            _cursorDelete.Visible   = _source.Type == BlockType.Delete;

            _timeController = this.SceneLayer.Game.Services.GetService(typeof(TimeController)) as TimeController;
        }
Example #15
0
        static public void Decors(ContentManager content, Sprite Back, out Sprite[] Entite, int numbDecor, Vector2 PosDepart) //Definie les caracteristiques du decor choisi
        {
            Back.Initialize(Vector2.Zero + PosDepart);

            // Decor 1 : Arbres en Diagonales
            if (numbDecor == 1)
            {
                Entite = new Sprite[15];
                Back.LoadContent(content, "Sprites/BackGrounds/Fond2");

                for (int i = 0; i < Entite.Length; i++)
                {
                    Entite[i] = new Sprite();
                    Entite[i].Initialize(new Vector2(80 * i) + PosDepart);
                }
                for (int i = 0; i < Entite.Length; i++)
                {
                    Entite[i].LoadContent(content, "Sprites/Decors/Arbrebeta");
                }
            }
            // Decor 2 : Axe d'arbres
            else
            {
                Entite = new Sprite[50];
                Back.LoadContent(content, "Sprites/BackGrounds/Fond2");

                for (int i = 0; i < Entite.Length / 2; i++)
                {
                    Entite[i] = new Sprite();
                    Entite[i].Initialize(new Vector2(80 * i + PosDepart.X, PosDepart.Y));
                }
                for (int i = 0; i < Entite.Length / 2 - 1; i++)
                {
                    Entite[i + Entite.Length / 2] = new Sprite();
                    Entite[i + Entite.Length / 2].Initialize(new Vector2(PosDepart.X, 80 * i + PosDepart.Y));
                }
                Entite[Entite.Length - 1] = new Sprite();
                Entite[Entite.Length - 1].Initialize(new Vector2(MainGame.ScreenX / 2, MainGame.ScreenY / 2));
                for (int i = 0; i < Entite.Length; i++)
                {
                    Entite[i].LoadContent(content, "Sprites/Decors/Arbrebeta");
                }
            }
        }
        // Recherche une cible
        public virtual void SearchTarget()
        {
            foreach (Character npc in ai.Map.Decors.GetCharacters())
            {
                if (npc.Type != ai.Type)
                {
                    double distance = Math.Pow(npc.Origin.X - ai.Origin.X, 2) + Math.Pow(npc.Origin.Y - ai.Origin.Y, 2);
                    if (distance < Math.Pow(ai.Vigilance, 2))
                    {
                        ai.Sprites = new List <Sprite>();
                        Sprite sprite = new Sprite(ai, "boutonTrack");
                        ai.Sprites.Add(sprite);
                        sprite.Initialize();

                        ai.State = new TrackingState(ai, npc);
                        break;
                    }
                }
            }
        }
Example #17
0
        public override void Initialize(ContentManager _Content)
        {
            base.Initialize(_Content);

            //Content = content;
            content.RootDirectory = "Content";

            longstrip = new Sprite("Story/france/p1");
            longstrip.Initialize(content);
            finalimage = new Sprite("Story/france/p2");
            finalimage.Initialize(content);

            finalimage.Dimension = Jabber.BaseGame.Get.BackBufferDimensions;


            longstrip.Width  = Jabber.BaseGame.Get.BackBufferWidth * 2.0f;
            longstrip.Height = Jabber.BaseGame.Get.BackBufferHeight;

            longstrip.PosX = Jabber.BaseGame.Get.BackBufferWidth / 2.0f;
        }
        // Recherche de la prochaine case à atteindre
        public override void NextCase()
        {
            if (distance <= 0)
            {
                velocityOrigin = joestar.NextCase(target, ai.Map.Game.player.Height);
                distance       = 1;
                if (joestar.near)
                {
                    distance = 0;
                }
                if (velocityOrigin.X > 0.5f)
                {
                    velocityOrigin.X = 1;
                }
                else if (velocityOrigin.X < -0.5f)
                {
                    velocityOrigin.X = -1;
                }
                if (velocityOrigin.Y > 0.5f)
                {
                    velocityOrigin.Y = 1;
                }
                else if (velocityOrigin.Y < -0.5f)
                {
                    velocityOrigin.Y = -1;
                }


                if (!joestar.couldFind)
                {
                    ai.Sprites = new List <Sprite>();
                    Sprite sprite = new Sprite(ai, "boutonSearch");
                    ai.Sprites.Add(sprite);
                    sprite.Initialize();

                    ai.State = new SearchState(ai);
                }
            }
        }
Example #19
0
        public override void Initialize()
        {
            base.Initialize();

            // Hook our input handler
            InputHandler = (InputHandler)Game.Services.GetService(typeof(InputHandler));

            // Setup the border
            BorderTexture         = new Sprite(Game);
            BorderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, BorderColor, Width + BorderSize, Height + BorderSize);
            BorderTexture.Initialize();

            // Setup the Interior of the text box
            InsideTexture         = new Sprite(Game);
            InsideTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, BorderColor, Width, Height);
            InsideTexture.Initialize();

            // Inside label text
            label           = new Label(Game, fontName);
            label.FontColor = FontColor;
            label.Initialize();
        }
Example #20
0
        public override void LoadContent()
        {
            base.LoadContent();

            Texture2D spriteSheet = Game.Content.Load <Texture2D>(@"EnemyOneSpriteSheet");
            int       spriteSize  = 20;

            Initialize(spriteSheet, new Rectangle(0, spriteSize * 3 + 3, spriteSize, spriteSize), Vector2.Zero, Scale, false); //Flying Left One
            m_FlyingRight.Initialize(spriteSheet, new Rectangle(0, 0, spriteSize, spriteSize), Vector2.Zero, Scale, false);
            m_FlyingRight.AddFrame(new Rectangle(spriteSize + 1, 0, spriteSize, spriteSize));
            m_FlyingLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 2 + 2, 0, spriteSize, spriteSize), Vector2.Zero, Scale, false);
            m_FlyingLeft.AddFrame(new Rectangle(spriteSize * 3 + 3, 0, spriteSize, spriteSize));
            m_WalkingRight.Initialize(spriteSheet, new Rectangle(0, spriteSize + 1, spriteSize, spriteSize), Vector2.Zero, Scale, false);
            m_WalkingRight.AddFrame(new Rectangle(spriteSize + 1, spriteSize + 1, spriteSize, spriteSize));
            m_WalkingLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 2 + 2, spriteSize + 1, spriteSize, spriteSize),
                                     Vector2.Zero, Scale, false);
            m_WalkingLeft.AddFrame(new Rectangle(spriteSize * 3 + 3, spriteSize + 1, spriteSize, spriteSize));
            m_NoRiderRight.Initialize(spriteSheet, new Rectangle(0, spriteSize * 2 + 2, spriteSize, spriteSize), Vector2.Zero, Scale, false);
            m_NoRiderRight.AddFrame(new Rectangle(spriteSize + 1, spriteSize * 2 + 2, spriteSize, spriteSize));
            m_NoRiderLeft.Initialize(spriteSheet, new Rectangle(spriteSize * 2 + 2, spriteSize * 2 + 2, spriteSize, spriteSize),
                                     Vector2.Zero, Scale, false);
            m_NoRiderLeft.AddFrame(new Rectangle(spriteSize * 3 + 3, spriteSize * 2 + 2, spriteSize, spriteSize));
        }
Example #21
0
        public override void Initialize(ContentManager manager)
        {
            base.Initialize(manager);

            content.RootDirectory = "Content";

            for (int i = 0; i < PageDirs.Count; i++)
            {
                Sprite s = new Sprite(PageDirs[i]);
                Frame  f = new Frame();
                s.Initialize(content);
                f.sprite = s;
                if (i == 0)
                {
                    f.timer = 0.1f;
                }
                else
                {
                    f.timer = 1.0f;
                }
                f.sprite.Dimension = Jabber.BaseGame.Get.BackBufferDimensions;
                frames.Add(f);
            }

            shiftWhen.Add(4);
            shiftWhen.Add(9);
            shiftWhen.Add(14);
            shiftWhen.Add(20);
            shiftWhen.Add(25);
            shiftWhen.Add(30);
            shiftWhen.Add(35);
            shiftWhen.Add(40);


            AudioManager.StopTheMusic();
            AudioManager.PlayMusic("australiamusic");
        }
Example #22
0
        public override void Initialize(ContentManager Content)
        {
            base.Initialize(Content);

            CreateFramesFromXML("misc_frames");
            Animation = "FanSpin";
            ResetDimensions();
            Width      *= 2.0f;
            Height     *= 2.0f;
            placeholder = new Sprite("ui/ui");
            placeholder.Initialize(Content);
            placeholder.CreateFramesFromXML("ui/ui_frames");
            placeholder.CurrentFrame = "whitecore";
            placeholder.Width        = Width;
            placeholder.Height       = 500;
            placeholder.Handle       = SpriteHandle.BOTTOMCENTER;

            box = world.CreateBox(placeholder.Dimension + new Vector2(0, 100), placeholder.GetAbsoluteCenter(), JabActor.BodyType.STATIC);
            box.CollisionGroup = FanEntitySpaceGroup;
            box.IgnoreRayCast  = true;
            box.UserData       = this;

            m_Animations[Animation].curFrame = Jabber.BaseGame.Random.Next(0, m_Animations[Animation].animFrames.Count);
        }
Example #23
0
        //todo: add left/right extreme values for create[location] functions!
        public static void CreateParis(GameScene scene, int leftmostpos, int rightmostpos)
        {
            if (content != null)
            {
                content.Dispose();
                content = null;
            }
            if (LastMusicPlayed != "paris")
            {
                LastMusicPlayed = "paris";
                AudioManager.PlayMusic("paris");
            }
            content = new ContentManager(BaseGame.Get.Services);
            content.RootDirectory = "Content";

            int j = 0;

            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/paris/paris");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
                s.CurrentFrame = "underground";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;

                s.Layer = BaseSprite.SpriteLayer.LAYER8;

                s.PosX = i;// +s.Width * s.ScaleX / 1.01f;
                s.PosY = -s.Height * s.ScaleY / 2.0f;

                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }

            j = 0;


            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/paris/paris");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
                s.CurrentFrame = "distantbg";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.05f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER3;

                s.PosX = i;// j++ * s.Width * s.ScaleX / 1.01f;
                s.PosY = s.Height * s.ScaleY / 2.0f;


                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;


            {
                MenuObj s = new MenuObj("textures/backgrounds/paris/paris");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
                s.CurrentFrame = "rawbg";
                s.ResetDimensions();
                s.UniformScale = 1.5f;
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER6;

                s.Width    = BaseGame.Get.BackBufferWidth;
                s.Height   = BaseGame.Get.BackBufferHeight;
                s.Position = Vector2.Zero;

                scene.AddNode(s);
            }

            /*
             *
             * for (int i = leftmostpos - 5000; i < rightmostpos + 5000; )
             * {
             *  Sprite s = new Sprite("textures/backgrounds/paris/paris");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
             *  s.CurrentFrame = "cloud1";
             *  s.ResetDimensions();
             *  s.UniformScale = 2.0f;
             *  s.Handle = BaseSprite.SpriteHandle.CENTER;
             *  s.CamPosScale = new Vector2(0.05f, 1.0f);
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER4;
             *
             *  s.PosX = (j++ * 1.5f) * s.Width * s.ScaleX / 1.01f;
             *  s.PosY = s.Height * s.ScaleY / 2.0f + 150;
             *
             *  i += (int)(s.Width * s.ScaleX);
             *
             *  scene.AddNode(s);
             * }*/


            /* {
             *   Sprite s = new Sprite("textures/backgrounds/paris/paris");
             *   s.Initialize(content);
             *   s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
             *   s.CurrentFrame = "rawbg";
             *   s.ResetDimensions();
             *   s.UniformScale = 2.0f;
             *   s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5;
             *
             *   s.Width = 1000000;
             *   s.PosY = s.Height * s.ScaleY / 2.0f;
             *
             *   scene.AddNode(s);
             * }*/
            /*
             * {
             *  Sprite s = new Jabber.Util.UI.MenuObj("textures/backgrounds/paris/paris");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
             *  s.CurrentFrame = "skycore";
             *  s.ResetDimensions();
             *  s.UniformScale = 1.0f;
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6;
             *
             *  s.Width = BaseGame.Get.BackBufferWidth;
             *  s.Height = BaseGame.Get.BackBufferHeight;
             *  s.Position = Vector2.Zero;
             *
             *  scene.AddNode(s);
             * }*/
            {
                Sprite s = new Sprite("textures/backgrounds/paris/paris");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
                s.CurrentFrame = "eiffel";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER2;

                s.PosY        = s.Height * s.ScaleY / 2.0f;
                s.CamPosScale = new Vector2(0.8f, 1.0f);

                scene.AddNode(s);
            }

            /*
             * for (int i = -100; i < 100; i++)
             * {
             *  Sprite s = new Sprite("parisbg");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames");
             *  s.CurrentFrame = "closebuildings";
             *  s.ResetDimensions();
             *  s.UniformScale = 2.0f;
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER2;
             *
             *  s.PosX = i * s.Width * s.ScaleX * 0.999f;
             *  s.PosY = s.Height * s.ScaleY / 2.0f;
             *
             *  s.CamPosScale = new Vector2(0.4f, 1.0f);
             *
             *  scene.AddNode(s);
             * }*/
            /*
             * {
             *  Sprite s = new Sprite("parisbg");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("Content/paris_frames.xml");
             *  s.CurrentFrame = "SkyGradient";
             *  s.ResetDimensions();
             *  s.UniformScale = 2.0f;
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER3;
             *
             *  s.Width = 1000000;
             *  s.PosY = s.Height * s.ScaleY / 2.0f;
             *
             *  scene.AddNode(s);
             * }
             * {
             *  Sprite s = new Sprite("parisbg");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("Content/paris_frames.xml");
             *  s.CurrentFrame = "Sky";
             *  s.ResetDimensions();
             *  s.UniformScale = 2.0f;
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5;
             *
             *  s.Width = 1000000;
             *  s.Height = 1000000;
             *  s.PosY = s.Height * s.ScaleY / 2.0f + 100;
             *
             *  scene.AddNode(s);
             * }*/
        }
Example #24
0
        /// <summary>
        /// creates a new raindrop under the cloud after every interval (defined by dropDelay)
        /// </summary>
        public void releaseRainDrops()
        {
            if (rainDropsTimer.ElapsedMilliseconds > dropDelay)
            {
                Sprite drop = new Sprite();
                drop.Initialize();
                drop.Texture = Game1.contentManager.Load<Texture2D>(@"Images\Drop");
                float xValue = rand.Next((int)(player.Position.X +  0.2*player.GetSize().X) , (int)(player.Position.X + (player.GetSize().X) * 0.8));
                float yValue = player.Position.Y + player.GetSize().Y;
                drop.Position = new Vector2(xValue, yValue);

                lock(dropLock)
                    raindropsList.Add(drop);

                rainDropsTimer.Restart();
            }
        }
Example #25
0
        public void Initialize(SpriteBatch batch)
        {
            rainDropsTimer.Start();

            Plant plant = new Plant();
            plant.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 8, Game1.graphics.PreferredBackBufferHeight - plant.GetSize().Y);
            plantList.Add(plant);

            Plant plant2 = new Plant();
            plant2.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth * 6    / 8, Game1.graphics.PreferredBackBufferHeight - plant2.GetSize().Y);
            plantList.Add(plant2);

            DeathFactory factory = new DeathFactory(this);
            factory.Position = new Vector2(Game1.graphics.PreferredBackBufferWidth / 2, Game1.graphics.PreferredBackBufferHeight - factory.GetSize().Y);
            deathFactoryList.Add(factory);

            graphicsHandler = new GraphicsHandler();
            graphicsHandler.Initialize(batch);
            oldState = new KeyboardState();

            background = new Sprite();
            background.Initialize();
            background.Texture = Game1.contentManager.Load<Texture2D>(@"Images\Gradient");
            background.Size = new Vector2(Game1.graphics.PreferredBackBufferWidth, Game1.graphics.PreferredBackBufferHeight);
            background.Layer = 0;

            player = new Player(background.Size);

            backgroundSprites.Add(background);

            notCarrie = Game1.contentManager.Load<SoundEffect>(@"Sounds/carrie2");
            notCarrieInstance = notCarrie.CreateInstance();
        }
Example #26
0
 public Plant()
 {
     plantSprite = new Sprite();
     plantSprite.Initialize();
     plantSprite.Texture = Game1.contentManager.Load<Texture2D>(@"Images\growthStage1");
 }
Example #27
0
        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the orientation at launch
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface window availability events
            ApplicationServices.WindowInteractive    += OnWindowInteractive;
            ApplicationServices.WindowNoninteractive += OnWindowNoninteractive;
            ApplicationServices.WindowUnavailable    += OnWindowUnavailable;

            // Setup the UI to transform if the UI is rotated.
            // Create a rotation matrix to orient the screen so it is viewed correctly
            // when the user orientation is 180 degress different.
            Matrix inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                              Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width,
                                                       graphics.GraphicsDevice.Viewport.Height,
                                                       0);

            if (currentOrientation == UserOrientation.Top)
            {
                screenTransform = inverted;
            }

            screenWidth  = Program.WindowSize.Width;
            screenHeight = Program.WindowSize.Height;

            manager = new Manager();
            manager.Initialize(this, touchTarget, Manager.SelectionMode.MONO);
            manager.Behaviour = new BehaviourPlane(screenWidth, screenHeight, _serverIP);

            aircraftCarrier = new Sprite("aircraftCarrier", "aircraftCarrier");
            aircraftCarrier.Initialize(touchTarget);
            aircraftCarrier.Touchable = false;
            manager.Register(aircraftCarrier);

            plane1 = new enib.pa.Plane("plane1");
            plane1.Initialize(touchTarget);
            plane1.Scale            = 0.13f;
            plane1.Weight           = 1;
            plane1.Rotation         = -(float)0;
            plane1.ShowBoundingRect = true;
            plane1.Dragable         = false;
            manager.Register(plane1);

            plane2 = new enib.pa.Plane("plane2");
            plane2.Initialize(touchTarget);
            plane2.Scale            = 0.13f;
            plane2.Weight           = 1;
            plane2.Rotation         = (float)Math.PI / 2;
            plane2.ShowBoundingRect = true;
            plane2.Dragable         = false;
            manager.Register(plane2);

            plane3 = new enib.pa.Plane("plane3");
            plane3.Initialize(touchTarget);
            plane3.Scale            = 0.13f;
            plane3.Weight           = 1;
            plane3.Rotation         = (float)Math.PI;
            plane3.ShowBoundingRect = true;
            plane3.Dragable         = false;
            manager.Register(plane3);

            plane4 = new enib.pa.Plane("plane4");
            plane4.Initialize(touchTarget);
            plane4.Scale            = 0.13f;
            plane4.Weight           = 1;
            plane4.Rotation         = -(float)Math.PI / 2;
            plane4.ShowBoundingRect = true;
            plane4.Dragable         = false;
            manager.Register(plane4);

            menu_pt1 = new Plane_Menu_Elevator("ascenseur1");
            menu_pt1.setPlaneur(plane1);

            menu_pt2 = new Plane_Menu_Catapulte1("catapulte1");
            menu_pt2.setPlaneur(plane1);

            menu_pt3 = new Plane_Menu_Catapulte2("catapulte2");
            menu_pt3.setPlaneur(plane1);

            menu = new Enib.SurfaceLib.Menu(manager, plane1);
            menu.Initialize(touchTarget);
            menu.addMenuEntry(menu_pt1);
            menu.addMenuEntry(menu_pt2);
            menu.addMenuEntry(menu_pt3);
            menu.Hide();

            base.Initialize();
        }
Example #28
0
        public override void Initialize(ContentManager _Content)
        {
            base.Initialize(_Content);
            ResetDimensions();

            CreateFramesFromXML("Chickens_Frames");

            //Animation = "Fire";
            ResetDimensions();
            baseBarrel = new Sprite("chickens");
            baseBarrel.Initialize(_Content);
            baseBarrel.CreateFramesFromXML("Chickens_Frames");
            baseBarrel.UniformScale = 2.0f;

            baseBarrel.CurrentFrame = "cannon-base00000";
            Animation    = "Barrel";
            CurrentFrame = "cannon-seq-00000";


            baseBarrel.ResetDimensions();
            ResetDimensions();
            baseBarrel.UniformScale = 2.0f;
            UniformScale            = 2.0f;

            RayCastHit ah = screen.scene.World.RayCast(Position, new Vector2(0, -500) + Position);

            if (ah.actor != null)
            {
                Vector2 worldPos = ah.worldImpact + new Vector2(0, Height * UniformScale) / 2.7f;
                Position = worldPos;
            }

            Handle       = SpriteHandle.CUSTOM;
            CustomOrigin = new Vector2(Width / 2.0f, Height / 2.0f + 7);

            FrameChanges += OnFrameChange;

            smoke = new AnimSprite("chickens");
            smoke.Initialize(_Content);
            smoke.CreateFramesFromXML("Chickens_Frames");
            smoke.Animation    = "Barrel";
            smoke.UniformScale = UniformScale;
            smoke.Width        = Width;
            smoke.Height       = Height;
            smoke.Handle       = SpriteHandle.CENTERLEFT;
            smoke.RaiseFlag(Jabber.Flags.PASSRENDER);

            smoke.FrameChanges += OnSmokeFrameChange;


            trajectory = new AnimSprite("chickens");
            trajectory.Initialize(_Content);
            trajectory.CreateFramesFromXML("Chickens_Frames");
            trajectory.CurrentFrame = "feather-00000";
            trajectory.ResetDimensions();
            trajectory.UniformScale = 6.0f;
            trajectory.Width        = 10;
            trajectory.Height       = 10;
            trajectory.Handle       = SpriteHandle.CENTER;


            arrow = new AnimSprite("ui/ui");
            arrow.Initialize(_Content);
            arrow.CreateFramesFromXML("ui/ui_frames");
            arrow.CurrentFrame = "arrow_dir";
            arrow.ResetDimensions();
            arrow.UniformScale = 1.0f;
            arrow.Width        = 10;
            arrow.Height       = 10;
            arrow.Handle       = SpriteHandle.CENTER;
        }
Example #29
0
        public static void CreateAustralia(GameScene scene, int leftmostpos, int rightmostpos)
        {
            if (content != null)
            {
                content.Dispose();
                content = null;
            }
            if (LastMusicPlayed != "uluru")
            {
                LastMusicPlayed = "uluru";
                AudioManager.PlayMusic("uluru");
            }
            content = new ContentManager(BaseGame.Get.Services);
            content.RootDirectory = "Content";

            int j = 0;

            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "underground";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;

                s.Layer = BaseSprite.SpriteLayer.LAYER8;

                s.PosX = i;// +s.Width * s.ScaleX / 1.01f;
                s.PosY = -s.Height * s.ScaleY / 2.0f;

                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;

            //for (int i = leftmostpos - 5000; i < rightmostpos + 5000; )
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "distantmountain";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.05f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER4;

                s.PosX = 0;// j++ * s.Width * s.ScaleX / 1.01f;
                s.PosY = s.Height * s.ScaleY / 2.0f;


                //i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;

            float height = 0;

            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "skycloud";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.05f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER5;

                s.PosX = i;// (j++ * 1.0f) * s.Width * s.ScaleX / 1.01f;
                s.PosY = s.Height * s.ScaleY / 2.0f;

                i     += (int)(s.Width * s.ScaleX / 1.01f);
                height = s.Height * s.ScaleY;
                scene.AddNode(s);
            }
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "topsky";
                s.ResetDimensions();
                s.UniformScale = 2.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.05f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER5;

                s.PosX = 0;                                   // (j++ * 1.0f) * s.Width * s.ScaleX / 1.01f;
                s.PosY = height + s.Height * s.ScaleY / 2.1f; // *2.0f;

                s.Width = 1000000;

                scene.AddNode(s);
            }

            {
                MenuObj s = new MenuObj("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "rawbg";
                s.ResetDimensions();
                s.UniformScale = 1.5f;
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER6;

                s.Width    = BaseGame.Get.BackBufferWidth;
                s.Height   = BaseGame.Get.BackBufferHeight;
                s.Position = Vector2.Zero;

                scene.AddNode(s);
            }

            /*
             * {
             *  Sprite s = new Sprite("textures/backgrounds/australia/australia");
             *  s.Initialize(content);
             *  s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
             *  s.CurrentFrame = "rawbg";
             *  s.ResetDimensions();
             *  s.UniformScale = 2.0f;
             *  s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6;
             *
             *  s.Width = 1000000;
             *  s.Height = 1000000;
             *  s.PosY = s.Height * s.ScaleY / 2.0f + 100;
             *
             *  scene.AddNode(s);
             * }*/



            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "bgstripclose";
                s.ResetDimensions();
                s.UniformScale = 2.6f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;

                s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER2;

                s.PosX        = i;// +s.Width * s.ScaleX / 1.01f;
                s.PosY        = s.Height * s.ScaleY / 2.0f;
                s.CamPosScale = new Vector2(0.3f, 1.0f);
                i            += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;


            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/australia/australia");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames");
                s.CurrentFrame = "bgstripfar";
                s.ResetDimensions();
                s.UniformScale = 2.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;

                s.Layer       = BaseSprite.SpriteLayer.BACKGROUND_LAYER3;
                s.CamPosScale = new Vector2(0.1f, 1.0f);

                s.PosX = i;// +s.Width * s.ScaleX / 1.01f;
                s.PosY = s.Height * s.ScaleY / 2.0f;

                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;
        }
Example #30
0
        protected override void Initialize()
        {
            // Teddy
            joueur = new Sprite();
            joueur.Initialize(new Vector2(ScreenX / 2 , ScreenY / 2),new Rectangle(0,0,50,69));

            //Definie la vie et le mana de base
            life = 100;
            mana = 200;

            SLife = new Sprite[life];
            SMana = new Sprite[mana];
            for (int i = 0; i < SLife.Length; i++)
            {
                SLife[i] = new Sprite();
                SLife[i].Initialize(new Vector2(i * 2.5F,0));
            }
            for (int i = 0; i < SMana.Length; i++)
            {
                SMana[i] = new Sprite();
                SMana[i].Initialize(new Vector2(i * 2.5F, 20));
            }
            // Teddy
            GameOver = new Sprite();
            GameOver.Initialize(Vector2.Zero);
            base.Initialize();
        }
        public List <Sprite> CreateSprites(XElement elements)
        {
            BaseSprite sprite  = null;
            var        items   = elements.Descendants("Items");
            var        element = elements.Descendants("CustomProperties").Descendants("Property");

            float layerDepth = 0;

            foreach (var property in element)
            {
                if (property.Attribute("Name") != null)
                {
                    string name = property.Attribute("Name").Value;
                    if (name == "LayerDepth")
                    {
                        layerDepth = float.Parse(property.Descendants("string").First <XElement>().Value, CultureInfo.InvariantCulture);
                    }
                }
            }

            List <Sprite> lsSprites = new List <Sprite>();

            foreach (var item in items)
            {
                var parts = item.Descendants("Item");

                foreach (var part in parts)
                {
                    if (part.Name == "Item")
                    {
                        element = part.Descendants("Position");
                        float posx = float.Parse(element.Elements("X").ElementAt(0).Value, CultureInfo.InvariantCulture);
                        float posy = float.Parse(element.Elements("Y").ElementAt(0).Value, CultureInfo.InvariantCulture);

                        float rot = float.Parse(part.Elements("Rotation").ElementAt(0).Value, CultureInfo.InvariantCulture);

                        element = part.Descendants("Scale");
                        float width  = float.Parse(element.Elements("X").ElementAt(0).Value, CultureInfo.InvariantCulture);
                        float height = float.Parse(element.Elements("Y").ElementAt(0).Value, CultureInfo.InvariantCulture);

                        element = part.Descendants("asset_name");
                        string textureDir = element.ElementAt(0).Value;

                        textureDir = "textures\\" + textureDir;

                        bool continueLoad = true;
                        if (GetInterception(textureDir) != null)
                        {
                            SingleTextureToMassTexture s = GetInterception(textureDir);
                            string newTextureDir         = s.newTextureDir;
                            string newTextureDirXML      = s.newTextureDirXML;

                            sprite = new Sprite(newTextureDir);
                            sprite.Initialize(Content);
                            (sprite as Sprite).CreateFramesFromXML(newTextureDirXML);
                            (sprite as Sprite).CurrentFrame = s.FrameName;
                            (sprite as Sprite).ResetDimensions();
                        }
                        else if (HasObjInterceptor(textureDir))
                        {
                            sprite = new BaseSprite();
                        }
                        else
                        {
                            continueLoad = false;
                            sprite       = null;

                            /*
                             * try
                             * {
                             *  Texture2D texture = Content.Load<Texture2D>(textureDir);
                             *  sprite = new Sprite(textureDir);
                             *  sprite.Initialize(Content);
                             *
                             * }
                             * catch (Exception e)
                             * {
                             *  sprite = null;
                             *  int k = 0;
                             * }*/
                        }

                        if (sprite != null)// && !HasObjInterceptor(sprite.TextureDir))
                        {
                            sprite.Rot      = rot;
                            sprite.PosZ     = layerDepth;
                            sprite.Position = new Vector2(posx, -posy);
                            sprite.Scale    = new Vector2(width, height);

                            if (HasObjInterceptor(textureDir))
                            {
                                AddNode(ObjInterceptor(textureDir)(sprite, textureDir, part));
                            }
                            else
                            {
                                lsSprites.Add(sprite as Sprite);
                            }
                        }
                    }
                }
            }

            return(lsSprites);
        }
Example #32
0
        private void InitSprites()
        {
            spriteDict = new Dictionary<PlayerSprites, Sprite>();

            foreach (PlayerSprites sprite in Enum.GetValues(typeof(PlayerSprites)))
            {
                spriteDict.Add(sprite, new Sprite());
                spriteDict[sprite].Initialize();
            }
            windPuff = new Sprite();
            windPuff.Initialize();

            cloudTextures = new Dictionary<Direction, Texture2D>();
            cloudTextures.Add(Direction.None, Game1.contentManager.Load<Texture2D>(@"Images\Cloud"));
            cloudTextures.Add(Direction.Left, Game1.contentManager.Load<Texture2D>(@"Images\Cloud_Move_Left"));
            cloudTextures.Add(Direction.Right, Game1.contentManager.Load<Texture2D>(@"Images\Cloud_Move_Right"));

            windPuff.Texture = Game1.contentManager.Load<Texture2D>(@"Images\wind");
            spriteDict[PlayerSprites.Cloud].Texture = cloudTextures[Direction.None];
            spriteDict[PlayerSprites.LeftHumerus].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Humerus_left");
            spriteDict[PlayerSprites.LeftHand].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Hand_left");
            spriteDict[PlayerSprites.RightHumerus].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Humerus_right");
            spriteDict[PlayerSprites.RightHand].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Hand_right");
            spriteDict[PlayerSprites.LeftUlna].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Ulna_left");
            spriteDict[PlayerSprites.RightUlna].Texture = Game1.contentManager.Load<Texture2D>(@"Images\Ulna_right");

            spriteDict[PlayerSprites.Cloud].Scale = Vector2.One * 0.6f;

            // Origin to right mid
            spriteDict[PlayerSprites.LeftHumerus].Origin = new Vector2(spriteDict[PlayerSprites.LeftHumerus].Size.X, spriteDict[PlayerSprites.LeftHumerus].Size.Y / 2);
            spriteDict[PlayerSprites.LeftUlna].Origin = new Vector2(spriteDict[PlayerSprites.LeftUlna].Size.X, spriteDict[PlayerSprites.LeftUlna].Size.Y / 2);
            spriteDict[PlayerSprites.LeftHand].Origin = new Vector2(spriteDict[PlayerSprites.LeftHand].Size.X, spriteDict[PlayerSprites.LeftHand].Size.Y * 5 / 7);
            /*
            //Scale Left
            spriteDict[PlayerSprites.LeftHumerus].Scale = new Vector2(armScale);
            spriteDict[PlayerSprites.LeftUlna].Scale = new Vector2(armScale);
            spriteDict[PlayerSprites.LeftHand].Scale = new Vector2(armScale);
            */

            //Origin to left mid
            spriteDict[PlayerSprites.RightHumerus].Origin = new Vector2(0, spriteDict[PlayerSprites.RightHumerus].Size.Y / 2);
            spriteDict[PlayerSprites.RightUlna].Origin = new Vector2(0, spriteDict[PlayerSprites.RightUlna].Size.Y / 2);
            spriteDict[PlayerSprites.RightHand].Origin = new Vector2(0, spriteDict[PlayerSprites.RightHand].Size.Y * 5 / 7);
            /*
            //Scale Right
            spriteDict[PlayerSprites.RightHumerus].Scale = new Vector2(armScale);
            spriteDict[PlayerSprites.RightUlna].Scale = new Vector2(armScale);
            spriteDict[PlayerSprites.RightHand].Scale = new Vector2(armScale);
            */
            //Origin center
            windPuff.Origin = new Vector2(windPuff.Size.X / 2, windPuff.Size.Y / 2);
        }
Example #33
0
 protected override void LoadContent()
 {
     _spriteBatch = new SpriteBatch(GraphicsDevice);
     Sprite.Initialize(Content, GraphicsDevice);
     Font.Initialize(Content);
 }
Example #34
0
        public override void LoadContent()
        {
            base.LoadContent();

            InputHandler = (InputHandler)Game.Services.GetService(typeof(InputHandler));

            // Load these gestures to the game screen that this control requires
            GameScreen.EnabledGestures = GameScreen.EnabledGestures | GestureType.FreeDrag | GestureType.DragComplete;

            // Setup our slider texture
            SliderTexture            = new Sprite(Game, false);
            SliderTexture.Position   = Position;
            SliderTexture.GameScreen = GameScreen;

            if (!string.IsNullOrEmpty(sliderTextureName))
            {
                GameScreen.Content.Load <Texture2D>(AssetFolder + "/" + Path.GetFileNameWithoutExtension(AssetName));
            }
            else
            {
                if (SliderType == SliderType.Horizontal)
                {
                    SliderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.White, Width, Height);
                }
                else
                {
                    SliderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.White, Height, Width);
                }
            }

            SliderTexture.Initialize();

            // Button Texture
            Button            = new Sprite(Game, false);
            Button.Color      = ButtonColor;
            Button.GameScreen = GameScreen;

            if (!string.IsNullOrEmpty(AssetName))
            {
                Button.Texture = GameScreen.Content.Load <Texture2D>(Path.GetFileNameWithoutExtension(AssetName));
            }
            else
            {
                Button.Texture = Utilitys.GenerateTexture(GraphicsDevice, Color.White, 15, 15);
            }

            switch (SliderType)
            {
            case SliderType.Horizontal:
            {
                // Width of slider bar in pixels
                float sliderWidth = (SliderTexture.Texture.Width * SliderTexture.Scale.X);

                // Percentage of slider position
                float percent = (CurrentSliderPosition / sliderWidth) * 100;

                // Position of current button on slider factoring in slider percentage
                float x = (Position.X - ((Button.Texture.Width * Button.Scale.X) / 2)) + percent;

                Button.Position = new Vector2(x, Position.Y - ((Button.Texture.Height * Button.Scale.Y) / 2));
            }
            break;

            case SliderType.Vertical:
            {
                float y = Position.Y - ((Button.Texture.Height * Button.Scale.Y) / 2);

                Button.Position = new Vector2(Position.X - ((Button.Texture.Width * Button.Scale.X) / 2), y);
            }
            break;
            }



            Button.Initialize();
        }
Example #35
0
        //todo: add left/right extreme values for create[location] functions!
        public static void CreateVesuvius(GameScene scene, int leftmostpos, int rightmostpos)
        {
            if (content != null)
            {
                content.Dispose();
                content = null;
            }
            if (LastMusicPlayed != "vesuvius")
            {
                LastMusicPlayed = "vesuvius";
                AudioManager.PlayMusic("vesuvius");
            }

            content = new ContentManager(BaseGame.Get.Services);
            content.RootDirectory = "Content";

            int j = 0;

            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "underground";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;

                s.Layer = BaseSprite.SpriteLayer.LAYER8;

                s.PosX = i;
                s.PosY = -s.Height * s.ScaleY / 2.0f;

                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;

            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "closehill";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.4f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER2;

                s.PosX = i;
                s.PosY = s.Height * s.ScaleY / 2.0f;


                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;



            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "cloud";
                s.ResetDimensions();
                s.UniformScale = 2.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.1f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER2;

                s.PosX = i;
                s.PosY = s.Height * s.ScaleY / 2.0f + 400;


                i += (int)((s.Width * s.ScaleX / 1.01f * 1.8f) * JabJect.RandomFloatInRange(1.5f, 2.0f));

                scene.AddNode(s);
            }
            j = 0;



            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "hill";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.3f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER3;

                s.PosX = i;
                s.PosY = s.Height * s.ScaleY / 2.0f;


                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;



            for (int i = leftmostpos - 5000; i < rightmostpos + 5000;)
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "midmountain";
                s.ResetDimensions();
                s.UniformScale = 4.0f;
                s.Handle       = BaseSprite.SpriteHandle.CENTER;
                s.CamPosScale  = new Vector2(0.3f, 1.0f);
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER4;

                s.PosX = i;
                s.PosY = s.Height * s.ScaleY / 2.0f;


                i += (int)(s.Width * s.ScaleX / 1.01f);

                scene.AddNode(s);
            }
            j = 0;


            {
                Sprite s = new Jabber.Util.UI.MenuObj("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "sky";
                s.ResetDimensions();
                s.UniformScale = 2.0f;
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER6;

                s.Width    = BaseGame.Get.BackBufferWidth;
                s.Height   = BaseGame.Get.BackBufferHeight;
                s.Position = Vector2.Zero;

                scene.AddNode(s);
            }
            {
                Sprite s = new Sprite("textures/backgrounds/vesuvius/vesuvius");
                s.Initialize(content);
                s.CreateFramesFromXML("textures/backgrounds/vesuvius/vesuvius_frames");
                s.CurrentFrame = "vesuvius";
                s.ResetDimensions();
                s.UniformScale = 7.0f;
                s.Layer        = BaseSprite.SpriteLayer.BACKGROUND_LAYER5;

                s.PosY        = s.Height * s.ScaleY / 2.0f;
                s.CamPosScale = new Vector2(0.2f, 1.0f);

                scene.AddNode(s);
            }
        }