当前位置: 首页>>代码示例>>C#>>正文


C# Image.CenterOrigin方法代码示例

本文整理汇总了C#中Image.CenterOrigin方法的典型用法代码示例。如果您正苦于以下问题:C# Image.CenterOrigin方法的具体用法?C# Image.CenterOrigin怎么用?C# Image.CenterOrigin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image的用法示例。


在下文中一共展示了Image.CenterOrigin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Ghost

        public Ghost(float x, float y, bool impostor)
        {
            X = x;
            Y = y;
            Impostor = impostor;

            mySprite = new Spritemap<string>(Assets.GFX_GHOST_SHEET, 22, 20);
            mySprite.Add("idle", new int[] { 0, 1, 2, 3 }, new float[] { 8f });
            mySprite.Add("distort", new int[] { 8, 9, 10 }, new float[] { 1f });
            mySprite.Play("idle");
            mySprite.CenterOrigin();

            mySpeed = new Speed(2);

            Image ghostShadow = new Image(Assets.GFX_SHADOW);
            ghostShadow.CenterOrigin();
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            AddCollider(new BoxCollider(22, 20, 0));
            Collider.CenterOrigin();
            Layer = 5;

            if(!impostor)
            {
                myController = Global.theController;
            }
        }
开发者ID:DrMelon,项目名称:UltimateDiscordInfinity,代码行数:29,代码来源:Ghost.cs

示例2: Note

 public Note(float x, float y)
 {
     X = x;
     Y = y;
     Graphic = new Image(Assets.GFX_NOTE_SINGLE);
     Graphic.CenterOrigin();
 }
开发者ID:DrMelon,项目名称:UltimateDiscordInfinity,代码行数:7,代码来源:Note.cs

示例3: Bullet

        public int NumBounces = 0; // number of bounces/ricochets

        #endregion Fields

        #region Constructors

        public Bullet(Vector2 fired, float x = 0, float y = 0)
        {
            X = x;
            Y = y;
            if(fired == null)
            {
                fired = new Vector2(1, 0);
            }
            maxSpeed.X = 50;
            maxSpeed.Y = 50;
            mySpeed = fired;

            // Create sprite
            mySprite = Image.CreateRectangle(16, 16, Color.Yellow);
            mySprite.CenterOrigin();
            mySprite.Angle = Util.Angle(mySpeed);
            AddGraphic(mySprite);

            // Create collider
            myCollider = new BoxCollider(16, 16, Tags.BULLET_COLLISION_PLAYER);
            myCollider.CenterOrigin();
            AddCollider(myCollider);

            Layer = Layers.BULLET;

            LifeSpan = 600.0f;
        }
开发者ID:DrMelon,项目名称:Slipshod,代码行数:33,代码来源:Bullet.cs

示例4: Drone

        public Drone(float x, float y, int hits)
        {
            X = x;
            Y = y;
            mySprite = new Spritemap<string>(Assets.GFX_DRONE, 32, 38);
            mySprite.CenterOrigin();
            mySprite.Add("open", new int[] { 0, 1, 2, 3, 4 }, new float[] { 6f, 6f, 6f, 6f, 24f });
            mySprite.Anim("open").NoRepeat();
            mySprite.Anim("open").OnComplete = this.PlayShineAnim;
            mySprite.Add("shine", new int[] { 5, 6, 7, 8, 9, 10, 11 }, new float[] { 3f });
            mySprite.Anim("shine").NoRepeat();
            mySprite.Anim("shine").OnComplete = this.ChargeUpLaser;
            mySprite.Add("charge", new int[] { 12, 13 }, new float[] { 8f });
            mySprite.Add("fire", new int[] { 14, 15 }, new float[] { 1f });
            mySprite.Add("dead", new int[] { 16, 17, 18, 19, 20 }, new float[] { 10f, 4f, 4f, 4f, 4f });
            mySprite.Anim("dead").NoRepeat();
            mySprite.Anim("dead").OnComplete = this.StopShaking;
            mySprite.Play("open");
            mySprite.FlippedX = Rand.Bool;

            Image ghostShadow = new Image(Assets.GFX_SHADOW);
            ghostShadow.CenterOrigin();
            ghostShadow.OriginY -= 25;
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            MaxChargeTime = Rand.Float(60.0f, 240.0f);

            AddCollider(new BoxCollider(32, 38, 2));
            Collider.CenterOrigin();
        }
开发者ID:DrMelon,项目名称:UltimateDiscordInfinity,代码行数:32,代码来源:Drone.cs

示例5: Tile

 public Tile(float x, float y) : base(x, y)
 {
     img = Image.CreateRectangle(32, Color.Grey);
     img.OutlineColor = Color.Black;
     img.OutlineThickness = 1;
     img.CenterOrigin();
     AddGraphic(img);
 }
开发者ID:KrissLaCross,项目名称:GlobalGameJam-2016,代码行数:8,代码来源:Tile.cs

示例6: Player

        public Player(float x, float y) : base(x, y)
        {
            img = Image.CreateRectangle(32, Color.Gray);
            img.CenterOrigin();


            this.AddGraphic(img);
            base.Layer = 0;
        }
开发者ID:KrissLaCross,项目名称:GlobalGameJam-2016,代码行数:9,代码来源:Player.cs

示例7: CannonShot

 public CannonShot(Ship parentShip, float Ang, int Level, Speed AddSpeed)
 {
     AdditionalSpeed = AddSpeed;
     LaserLevel = Level;
     Graphic = new Image(Assets.GFX_FX_LASER);
     Graphic.CenterOrigin();
     Graphic.Angle = 360 - Ang;
     myParent = parentShip;
     X = myParent.X;
     Y = myParent.Y;
 }
开发者ID:DrMelon,项目名称:intrepid,代码行数:11,代码来源:CannonShot.cs

示例8: ImageEntity

        public ImageEntity(float x, float y, string imagePath)
            : base(x, y)
        {
            // Create an Image using the path passed in with the constructor
            var image = new Image(imagePath);
            // Center the origin of the Image
            image.CenterOrigin();

            // Add the Image to the Entity's Graphic list.
            AddGraphic(image);
        }
开发者ID:sjvcompsci,项目名称:GrimmGameJustin,代码行数:11,代码来源:Program.cs

示例9: Explosion

        public Explosion(Vector2 position)
        {
            Position = position;

            image = new Image(TestProject.Assets.GetTexture("ExplosionTexture"), false);
            image.CenterOrigin();
            image.Scale *= 2;
            Add(image);

            Collider = new CircleMask(image.Width / 2);
            Tag(TAG);

            Tween.Add(this, 15, Ease.SineIn, FadeOut).OnComplete = Destroy;
            Alarm.Add(this, SetNoCollidable, 2);
        }
开发者ID:BeauPrime,项目名称:Networking,代码行数:15,代码来源:Explosion.cs

示例10: MenuScene

        public MenuScene()
            : base()
        {
            e = new Entity();

            img = new Image(Resources.PaperLlamaLogo);

            img.CenterOrigin();
            img.X = Game.Instance.HalfWidth;
            img.Y = Game.Instance.HalfHeight;

            e.SetGraphic(img);

            Add(e);
        }
开发者ID:GaryTheLlama,项目名称:LilTyping,代码行数:15,代码来源:MenuScene.cs

示例11: Cat

        public Cat(float x, float y)
            : base()
        {
            img = new Image(Resources.CatSprite);

            SetGraphic(img);

            img.CenterOrigin();

            this.X = x;
            this.Y = y;

            img.Scale = 1;
            img.Visible = true;
        }
开发者ID:GaryTheLlama,项目名称:LilTyping,代码行数:15,代码来源:Cat.cs

示例12: Logo

        public Logo(float X, float Y, string filename, float maxDistance = 20.0f)
            : base(X, Y)
        {
            baseY = Y;

            this.maxDistance = maxDistance;

            //sprite = Image.CreateRectangle(100, 50);
            sprite = new Image(filename);
            sprite.CenterOrigin();
            AddGraphic(sprite);

            lerpSpeed += Rand.Float(0.0f, 0.01f);

            PreloadFloat();
        }
开发者ID:amiruqdah,项目名称:ToFightTheSea,代码行数:16,代码来源:Logo.cs

示例13: Laser

        public Laser(float x, float y, float xspd, float yspd)
        {
            X = x;
            Y = y;
            XSpeed = xspd;
            YSpeed = yspd;
            LifeSpan = 20.0f;

            Image laserImg = new Image(Assets.GFX_LASER);
            laserImg.CenterOrigin();
            laserImg.Smooth = true;

            AddGraphic(laserImg);
            AddCollider(new BoxCollider(8, 8, 3));
            Collider.CenterOrigin();
            Graphic.Angle = 360 - ((float)Math.Atan2(YSpeed, XSpeed) * (float)(180.0f / Math.PI));
        }
开发者ID:DrMelon,项目名称:UltimateDiscordInfinity,代码行数:17,代码来源:Laser.cs

示例14: Tank

        public Tank(float xPos, float yPos)
            : base(xPos, yPos)
        {
            Console.WriteLine("simpleTank");
            _image = new Image("Resources/tank.png");
            _image.CenterOrigin();
            AddGraphic(_image);
            Weapon = new Weapon(this);
            Weapon.addDecorator(ProjectileDecorators.TestBullet);
            Weapon.addDecorator(ProjectileDecorators.BulletWallCollider);

            //define this entity as part of the game pause group
            Group = (int)PauseGroups.NotMenu;

            //logic can now be instantiated here already
            Logic = new ProtoLogic(this);
        }
开发者ID:JOCP9733,项目名称:tank,代码行数:17,代码来源:Tank.cs

示例15: Missile

        public Missile(float x, float y)
        {
            X = x;
            Y = y - 10;
            MissileSpeed = 0.5f;

            LifeSpan = 240.0f;

            Image myGfx = new Image(Assets.GFX_MISSILE);

            myGfx.Smooth = false;
            myGfx.CenterOrigin();
            //myGfx.Angle = Otter.Rand.Float(-180.0f, 180.0f);
            AddGraphic(myGfx);

            AddCollider(new BoxCollider(20, 19, 1));
            Collider.CenterOrigin();
        }
开发者ID:DrMelon,项目名称:UltimateDiscordInfinity,代码行数:18,代码来源:Missile.cs


注:本文中的Image.CenterOrigin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。