本文整理汇总了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;
}
}
示例2: Note
public Note(float x, float y)
{
X = x;
Y = y;
Graphic = new Image(Assets.GFX_NOTE_SINGLE);
Graphic.CenterOrigin();
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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));
}
示例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);
}
示例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();
}