public void MoveToNextPos() { nextNode = FP.Next(nextNode, positionNodes, true); //set the animation if (nextNode.X - this.X > 0) { spritemap.FlippedX = true; } else if (nextNode.X - this.X < 0) { spritemap.FlippedX = false; } if (!isAttacking) { if (nextNode.X - this.X == 0) { spritemap.Play("Idle"); } else { spritemap.Play("Move"); } } var twoon = new MultiVarTween(MoveToNextPos, ONESHOT); twoon.Tween(this, new { X = nextNode.X, Y = nextNode.Y }, 5.0f); AddTween(twoon, true); }
public Rocket(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0", 4); spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7, 8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10, 11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = scene.random.Next(60 * 4, 60 * 5); scene.Add(this); SetHitbox(124, 110, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Mortar(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0", 4); spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = scene.random.Next(60 * 1, 60 * 2); scene.Add(this); SetHitbox(40, 42, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Minigun(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0, 1, 2, 3", 4); spritemap.Add(Animation.Shoot, "4-20", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); scene.Add(this); this.cooldown = scene.random.Next(60 * 4, 60 * 6); SetHitbox(128, 63, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Turret(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0, 1", 4); spritemap.Add(Animation.Shoot, "2-17", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); scene.Add(this); cooldown = scene.random.Next(2 * 60, 3 * 60); SetHitbox(170, 80, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public FatTonk(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0, 1", 4); spritemap.Add(Animation.Shoot, "2-17", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = scene.random.Next(60 * 1, 60 * 2); scene.Add(this); SetHitbox(130, 62, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Soldier(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, scene.GetAnimationString(0, 0), 5).NoRepeat(); spritemap.Add(Animation.Throw, scene.GetAnimationString(0, 11), 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); runtime = (int)spritemap.Anim(Animation.Idle).TotalDuration *scene.random.Next(3, 4); AddGraphic(spritemap); scene.Add(this); SetHitbox(43, 42, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public BiggestTonk(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0", 4); spritemap.Add(Animation.Shoot, "0-16", 4).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = scene.random.Next(60 * 2, 60 * 3); scene.Add(this); SetHitbox(187, 80, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Sniper(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0", 4); spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22", 3).NoRepeat(); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = scene.random.Next(60 * 2, 60 * 3); scene.Add(this); SetHitbox(66, 27, ColliderTags.Garbage); Hitbox.CenterOrigin(); }
public Chest(float x, float y) : base(x, y) { SetHitbox(21, 23, ColliderTags.EnemyUnit); Hitbox.SetPosition(6, 5); this.prize = scene.stage.GetTreasureGold(); spritemap.Add(Animation.Open, "6-9", 4).NoRepeat(); spritemap.Add(Animation.Close, "9-6", 4).NoRepeat(); spritemap.Add(Animation.Idle, "0-5", 4); spritemap.Play(Animation.Idle); AddGraphic(spritemap); scene.Add(this); }
public override void Update() { if (this.Timer >= this.delay) { if (this.Timer == this.delay) { spritemap.Play(Animation.rotate); AddGraphic(spritemap); //Throw.Volume = Sound.GlobalVolume * 0.2f; Throw.Play(); } if (this.Timer <= this.delay + 60) { //Y -= ((start.Y - hight) /1830)*counter; spritemap.Angle += (68f / 1830) * counter; Y -= ((start.Y - height) / 1830) * counter; counter--; } else { spritemap.Angle += (68f / 1830) * counter; Y += ((destination.Y - height) / 1830) * counter; counter++;; } X -= (start.X - destination.X) / 120; } if (X <= destination.X) { scene.Add(new Explosions(X, Y, Explosions.ExplosionType.small, 0, false)); RemoveSelf(); } base.Update(); }
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; } }
public Player(float x = 0, float y = 0) { // When creating a new player, the desired X,Y coordinates are passed in. If excluded, we start at 0,0 X = x; Y = y; // Create a new spritemap, with the player.png image as our source, 32 pixels wide, and 40 pixels tall sprite = new Spritemap <string>(Assets.PLAYER, 32, 40); // We must define each animation for our spritemap. // An animation is made up of a group of frames, ranging from 1 frame to many frames. // Each 32x40 box is a single frame in our particular sprite map. // The frames start counting from 0, and count from left-to-right, top-to-bottom sprite.Add("standLeft", new int[] { 0, 1 }, new float[] { 10f, 10f }); sprite.Add("standRight", new int[] { 0, 1 }, new float[] { 10f, 10f }); sprite.Add("standDown", new int[] { 3, 4 }, new float[] { 10f, 10f }); sprite.Add("standUp", new int[] { 6, 7 }, new float[] { 10f, 10f }); sprite.Add("walkLeft", new int[] { 0, 1 }, new float[] { 10f, 10f }); sprite.Add("walkRight", new int[] { 0, 1 }, new float[] { 10f, 10f }); sprite.Add("walkDown", new int[] { 3, 4 }, new float[] { 10f, 10f }); sprite.Add("walkUp", new int[] { 6, 7 }, new float[] { 10f, 10f }); // Tell the spritemap which animation to play when the scene starts sprite.Play("standDown"); // Lastly, we must set our Entity's graphic, otherwise it will not display Graphic = sprite; }
public AnimatedEntity(string entityName, string twitchHeadName, bool isAvatar, string twitchUseranme, Color tintColor) { string EntityFilePath = Utility.CONTENT_DIR + "/entities/" + entityName; AnimatedEntityData = JsonLoader.Load <AnimatedEntityData>(EntityFilePath); var defaultAnim = AnimatedEntityData.Animations[AnimatedEntityData.DefaultAnimation]; Sprite = new Spritemap(Library.GetTexture(EntityFilePath + ".png"), defaultAnim.FrameWidth, defaultAnim.FrameHeight) { OriginX = defaultAnim.OriginX, OriginY = defaultAnim.OriginY }; foreach (var animation in AnimatedEntityData.Animations.Values) { Sprite.Add(animation.Name, animation.Frames, animation.FPS, true); } if (AnimatedEntityData.ShaderName != null) { Shader shader = new Shader(Shader.ShaderType.Fragment, Library.GetText("content/shaders/" + AnimatedEntityData.ShaderName)); Sprite.Shader = shader; //chromaKey.SetAsCurrentTexture("sampler2D"); shader.SetParameter("color", tintColor); } Sprite.Play(AnimatedEntityData.DefaultAnimation); AddComponent(Sprite); CreateHead(twitchHeadName, isAvatar); CreateName(twitchUseranme); }
public Enemy_Mummy(float x, float y) : base(x, y) { Layer = -500; this.MaxHP = scene.stage.MaxHP; this.CurrentHP = this.MaxHP; SetHitbox(35, 46, ColliderTags.EnemyUnit); Hitbox.SetPosition(9, 17); spritemap.Add(Animation.Shoot, scene.GetAnimationString(0, 21), 3).NoRepeat(); spritemap.Add(Animation.Death, scene.GetAnimationString(22, 67), 3).NoRepeat(); spritemap.Add(Animation.Run, scene.GetAnimationString(68, 85), 3); spritemap.Play(Animation.Run); AddGraphic(spritemap); scene.Add(this); scene.enemyList.Add(this); runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12); }
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; } }
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(); }
private void Initialize(float scale) { _spritemap.Add(PlayerAnimation.Breath, "1,2,3,4,5,5,4,3,2,1", 4); _spritemap.Add(PlayerAnimation.Idle, "7,8,9,10,11,12", 4); _spritemap.Add(PlayerAnimation.Walk, "14,15,16,17,18,19,20,21,22,23,24", 4); _spritemap.Add(PlayerAnimation.Roll, "26,27,28,29,30", 4).NoRepeat(); _spritemap.Add(PlayerAnimation.Run, "32,33,34,34,33,32", 4); _spritemap.Add(PlayerAnimation.Jumping, "36,37,38", 4).NoRepeat(); _spritemap.Add(PlayerAnimation.Falling, "38,37,36", 4); _spritemap.Add(PlayerAnimation.Attacking, "40,41,42,43", 4).NoRepeat(); _spritemap.Play(PlayerAnimation.Idle); _spritemap.CenterOrigin(); _spritemap.Scale = scale; AddGraphic(_spritemap); }
public override void Update() { if (FP.Distance(X, Y, World.Camera.X, World.Camera.Y) < 400) { cloak.Play("Reveal"); } }
public Monster1Blue(float x = 0, float y = 0) : base(baseSpeed:600) { X = x; Y = y; HurtSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_HIT); HurtSound.Volume = 0.1f; DeathSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_EXPLOSION); DeathSound.Volume = 0.7f; Sprite = new Spritemap<string>(Resources.Sprites.Monsters.ENEMY_1_BLUE, 46, 46); Sprite.Add("walk", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 10f, 2f, 1f, 10f, 2f, 1f }); Sprite.Play("walk"); Graphic = Sprite; Graphic.CenterOrigin(); Health = new Life(10); Health.OnDeath = OnDeath; Health.OnHurt = OnHurt; Direction = Vector2.Zero; var c = new LinkedListNode<Vector2>(new Vector2(50.0f, 50.0f)); var t = new LinkedList<Vector2>(); Path = c; t.AddLast(c); t.AddLast(new Vector2(Global.GAME.Width - 50.0f, 50.0f)); t.AddLast(new Vector2(Global.GAME.Width - 50.0f, Global.GAME.Height - 50.0f)); t.AddLast(new Vector2(50, Global.GAME.Height - 50.0f)); AddComponent(new CheckPointMovement(this, Path)); AddComponent(new Rotation(this, 90)); AddComponent(Health); SetHitbox(23, 23, Global.HitBoxTag.Enemy); }
public Enemy_Cokka(float x, float y) : base(x, y) { Layer = -500; this.MaxHP = scene.stage.MaxHP * 2; this.CurrentHP = this.MaxHP; SetHitbox(72, 57, ColliderTags.EnemyUnit); Hitbox.SetPosition(12, 20); spritemap.Add(Animation.Shoot, scene.GetAnimationString(0, 16), 4).NoRepeat(); spritemap.Add(Animation.Death, scene.GetAnimationString(17, 25), 4).NoRepeat(); spritemap.Add(Animation.WeaponOut, scene.GetAnimationString(32, 38), 4).NoRepeat(); spritemap.Add(Animation.Run, scene.GetAnimationString(26, 31), 4); spritemap.Play(Animation.Run); AddGraphic(spritemap); scene.Add(this); scene.enemyList.Add(this); runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12); }
public Enemy_Shield(float x, float y) : base(x, y) { Layer = -500; this.MaxHP = scene.stage.MaxHP / 4; this.CurrentHP = this.MaxHP; SetHitbox(33, 40, ColliderTags.EnemyUnit); Hitbox.SetPosition(28, 27); spritemap.Add(Animation.Death1, scene.GetAnimationString(0, 21), 4).NoRepeat(); spritemap.Add(Animation.Death2, "22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31", 4).NoRepeat(); spritemap.Add(Animation.Death3, scene.GetAnimationString(33, 41), 4).NoRepeat(); spritemap.Add(Animation.Death4, scene.GetAnimationString(42, 52), 4).NoRepeat(); spritemap.Add(Animation.Death5, scene.GetAnimationString(53, 67), 4).NoRepeat(); spritemap.Add(Animation.Death6, scene.GetAnimationString(68, 80), 4).NoRepeat(); spritemap.Add(Animation.Death7, scene.GetAnimationString(81, 95), 4).NoRepeat(); spritemap.Add(Animation.WeaponOut, "96-99", 4).NoRepeat(); spritemap.Add(Animation.WeaponBack, "99-96", 4).NoRepeat(); spritemap.Add(Animation.Idle, "100-105", 8); spritemap.Add(Animation.Run, "106-117", 4); spritemap.Add(Animation.Shoot, "118-123", 4).NoRepeat(); spritemap.Play(Animation.Run); AddGraphic(spritemap); scene.Add(this); scene.enemyList.Add(this); runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12); }
public BulletTrail(float x, float y) : base(x, y) { destroyFrame = DESTROY_FRAME; sprite = new Spritemap <string>(Assets.BULLET_PARTICLE, 32, 40); sprite.Add("Emit", new int[] { 0, 1, 2, 3 }, new float[] { 10f, 10f, 10f, 10f }); sprite.Play("Emit"); Graphic = sprite; }
public Heli(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0-15", 1); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); cooldown = 40; scene.Add(this); fire = scene.random.Next(60 * 1, 60 * 2); }
public Enemy_high_tonk(float x, float y) : base(x, y) { Layer = -500; this.MaxHP = scene.stage.MaxHP * 4; this.CurrentHP = this.MaxHP; SetHitbox(72, 97, ColliderTags.EnemyUnit); Hitbox.SetPosition(40, 10); spritemap.Add(Animation.Death, "43, 44, 45, 0", 8).NoRepeat(); spritemap.Add(Animation.Run, "1-6", 4); spritemap.Add(Animation.Idle, "7, 8", 4); spritemap.Add(Animation.Shoot, "19-35,9-18", 4).NoRepeat(); //spritemap.Add(Animation.Shoot, "9-35", 4).NoRepeat(); spritemap.Add(Animation.Stop, "36-42", 4).NoRepeat(); spritemap.Play(Animation.Run); AddGraphic(spritemap); scene.Add(this); scene.enemyList.Add(this); runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12); }
public BasicBulletExplosionParticle(float x, float y) : base(x, y) { EndFrame = 3; Sprite = new Spritemap<string>(Resources.Sprites.Turrets.TOWER_BULLET_EXPLOSION, 32, 40); Sprite.Add("Emit", new int[] { 0, 1, 2, 3 }, new float[] { 10f, 10f, 10f, 10f }).NoRepeat(); Graphic = Sprite; Graphic.CenterOrigin(); Sprite.Play("Emit"); }
public override void UpdateFirst() { base.UpdateFirst(); aliveTime++; // Drift up and down from shadow. mySprite.OriginY = 22 - (float)Math.Sin(aliveTime * 0.3f); if (hurtTime > 0) { hurtTime--; mySprite.Play("distort"); } else { // Global.theMusic.Pitch = 1.0f; mySprite.Play("idle"); } }
public Heli(float x, float y, Random random, Sound Sound) : base(x, y) { spritemap = new Spritemap <Animation>("Assets/Img/heli.png", 88, 91); spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15", 4); this.random = random; this.Sound = Sound; spritemap.CenterOrigin(); spritemap.Play(Animation.Shoot); AddGraphic(spritemap); }
public Soldier(float x, float y, Random random, Sound Sound) : base(x, y) { spritemap = new Spritemap <Animation>("Assets/Img/soldier.png", 64, 29); spritemap.Add(Animation.Shoot, "0,1,2,3", 4); this.random = random; this.Sound = Sound; spritemap.CenterOrigin(); spritemap.Play(Animation.Shoot); AddGraphic(spritemap); }
public Hover(float x, float y) : base(x, y) { spritemap.Add(Animation.Idle, "0", 4); spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33", 2); spritemap.CenterOrigin(); spritemap.Play(Animation.Shoot); AddGraphic(spritemap); scene.Add(this); fire = scene.random.Next(60 * 2, 60 * 3); }
public Minigun(float x, float y, Random random, Sound Sound) : base(x, y) { spritemap = new Spritemap <Animation>("Assets/Img/minigun.png", 110, 45); spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7,8,9,10,11", 4); this.random = random; this.Sound = Sound; spritemap.CenterOrigin(); spritemap.Play(Animation.Shoot); AddGraphic(spritemap); }
public Mortar(float x, float y, Random random, Sound Sound) : base(x, y) { spritemap = new Spritemap <Animation>("Assets/Img/mortar2.png", 53, 54); spritemap.Add(Animation.Shoot, "18,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", 4).NoRepeat(); spritemap.Add(Animation.Idle, "18", 4).NoRepeat(); this.random = random; this.Sound = Sound; spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); }
public MonsterExplosionParticle(float x, float y) : base(x, y) { EndFrame = 23; Sprite = new Spritemap<string>(Resources.Sprites.Monsters.ENEMY_EXPLOSION, 130, 130); //Sprite.Shader = new Shader(Resources.Shaders.BLAST_SHADER); Sprite.Add("explode", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, new float[] { 0.1f, 0.1f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.4f, 0.5f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f }).NoRepeat(); Sprite.Play("explode"); Graphic = Sprite; Graphic.CenterOrigin(); }
public override void Update() { if (this.Timer == delay) { this.LifeSpan = this.Timer + (int)spritemap.Anim(Animation.explosion).TotalDuration; AddGraphic(spritemap); sound.Play(); spritemap.Play(Animation.explosion); } base.Update(); }
public MyPlayer(int x, int y) { this.level = 0; //this.stage = 0; this.gold = 0; this.honor = 0; spritemap.Add(Animation.Idle, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15", 4); spritemap.Add(Animation.IdleToShooting, "16,17,18,19", 2).NoRepeat(); spritemap.Add(Animation.Spin, "19", 2).NoRepeat(); spritemap.Add(Animation.ShootingToIdle, "19,18,17,16", 2).NoRepeat(); spritemap.Add(Animation.Shoot, "20,21,22,23,24", 2); spritemap.CenterOrigin(); spritemap.Play(Animation.Idle); AddGraphic(spritemap); this.X = x; this.Y = y; SetHitbox(140, 61, ColliderTags.Garbage); Hitbox.CenterOrigin(); //Sound.GlobalVolume = 0.1f; }
public void Break() { Status = 2; Spritemap<string> newMap = new Spritemap<string>(Assets.GFX_FIRE, 64, 64); newMap.Add("fire", new Anim(new int[] { 0, 1, 2, 3, 4 }, new float[] { 3f })); newMap.Play("fire"); myFire = new Entity(X, Y, newMap); myFire.Graphic.CenterOrigin(); myFire.Graphic.Shake = 4; myFire.Layer = 20; this.Scene.Add(myFire); }
public Player(float x, float y) { X = x; Y = y; // load player sheet mySprite = new Spritemap<string>(Assets.GFX_PLAYER, 32, 32); mySprite.Add("idle", new int[] { 0 }, new float[] { 60.0f }); mySprite.Add("run", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 6f, 6f, 6f, 6f, 6f, 6f }); mySprite.Add("dead", new int[] { 6 }, new float[] { 6f }); mySprite.Play("run"); mySprite.CenterOrigin(); AddGraphic(mySprite); mySpeed = new Speed(5); // Load inventory images hand = new Image(Assets.GFX_HAND); boots = new Image(Assets.GFX_BOOTS); circuit = new Image(Assets.GFX_CIRCUIT); wrench = new Image(Assets.GFX_WRENCH); crisps = new Image(Assets.GFX_CRISPS); donut = new Image(Assets.GFX_DONUT); o2tank = new Image(Assets.GFX_O2TANK); fireextinguisher = new Image(Assets.GFX_EXTINGUISHER); battery = new Image(Assets.GFX_BATTERY); tiles = new Image(Assets.GFX_TILE); StartInspect = Global.theGame.Timer; AddCollider(new CircleCollider(8, 2)); Collider.CenterOrigin(); crossHair = new Entity(X, Y, new Image(Assets.XHAIR)); crossHair.Graphic.CenterOrigin(); crossHair.AddCollider(new CircleCollider(8, 4)); crossHair.Collider.CenterOrigin(); // Default vars NoShoes = false; HP = 100; O2Level = 100; Hunger = 0; InsideShip = true; }
public Star(float x, float y, float xspd, float yspd) { X = x; Y = y - 10; XSpeed = xspd; YSpeed = yspd; LifeSpan = 60.0f; Spritemap<string> myGfx = new Spritemap<string>(Assets.GFX_STAR, 20, 19); myGfx.Add("default", new int[] {0, 1, 2, 3}, new float[] {1f}); myGfx.Play("default"); myGfx.Smooth = false; myGfx.CenterOrigin(); //myGfx.Angle = Otter.Rand.Float(-180.0f, 180.0f); AddGraphic(myGfx); AddCollider(new BoxCollider(20, 19, 1)); Collider.CenterOrigin(); }
public MissileEntity(float x, float y, BulletDirection bulletDirection) { _bulletDirection = bulletDirection; var projectilePath = (bulletDirection == BulletDirection.Up) ? @".\Assets\Graphics\PlayerProjectile256.png" : @".\Assets\Graphics\AlienProjectile256.png"; var animation = new Spritemap<string>(projectilePath, 256, 256); animation.Add("firing", new[] { 0, 1 }, new[] { 5f, 5f }); animation.Play("firing"); SetGraphic(animation); SetCollider(_hitBox); animation.OriginX = 0; animation.OriginY = 0; X = x; Y = y; }
public Ship() { // Create Graphics myShipSprite = new Spritemap<string>(Assets.SHIP_GFX_TEST, 33, 33); myShipSprite.Add("ship", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, new float[] { 2f }); myShipSprite.Play("ship"); myShipSprite.CurrentFrame = 0; myFlameSprite = new Spritemap<string>(Assets.SHIP_GFX_TEST_FLAME, 33, 33); myFlameSprite.Add("ship", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, new float[] { 2f }); myFlameSprite.Play("ship"); myFlameSprite.CurrentFrame = 0; myFlameSprite.CenterOrigin(); Graphic = myShipSprite; Graphics.Add(myFlameSprite); Graphic.CenterOrigin(); // Create Components myMovement = new ShipMovement(128 * 20, 128 * 20, EnginePower); myShipController = new ShipController(this); AddComponent(myMovement); }
private void Initialize() { this.SetHitbox(30, 30, new[] { (int)CollisionTag.Player }); _bomberImages = new Spritemap<string>("Assets/Images/player.png", Global.GridSize, Global.GridSize); _bomberImages.Add("standDown", new int[] { 2 }, new int[] { 10 }); _bomberImages.Add("standUp", new int[] { 3 }, new int[] { 10 }); _bomberImages.Add("standRight", new int[] { 6 }, new int[] { 10 }); _bomberImages.Add("standLeft", new int[] { 6 }, new int[] { 10 }); _bomberImages.Add("walkDown", new int[] { 1, 2 }, new int[] { 10, 10 }); _bomberImages.Add("walkUp", new int[] { 4, 5 }, new int[] { 10, 10 }); _bomberImages.Add("walkRight", new[] { 7, 8 }, new int[] { 10, 10 }); _bomberImages.Add("walkLeft", new[] { 7, 8 }, new int[] { 10, 10 }); _bomberImages.Play("standDown"); this.Graphic = this._bomberImages; this.Speed = 250; this.BombsAvailable = 1; this.Session.Controller = Controller.Get360Controller(Session.Id); //Directionals this.Session.Controller.AxisDPad.AddKey(Key.W, Direction.Up); this.Session.Controller.AxisDPad.AddKey(Key.A, Direction.Left); this.Session.Controller.AxisDPad.AddKey(Key.S, Direction.Down); this.Session.Controller.AxisDPad.AddKey(Key.D, Direction.Right); this.Session.Controller.AxisLeft.AddKey(Key.W, Direction.Up); this.Session.Controller.AxisLeft.AddKey(Key.A, Direction.Left); this.Session.Controller.AxisLeft.AddKey(Key.S, Direction.Down); this.Session.Controller.AxisLeft.AddKey(Key.D, Direction.Right); //Bombing this.Session.Controller.B.AddKey(Key.Space); this.Movement = new BasicMovement(this.Speed, this.Speed, 50); this.Movement.Collider = this.Hitbox; this.Movement.Axis = this.Session.Controller.AxisDPad; this.Movement.AddCollision((int)CollisionTag.Brick); this.Movement.AddCollision((int)CollisionTag.Bomb); this.Movement.AddCollision((int)CollisionTag.Wall); this.Movement.AddCollision((int)CollisionTag.Player); Image color = Image.CreateRectangle(Global.GridSize, this.Color); color.Blend = BlendMode.Multiply; this.Graphics.Add(color); this.AddComponent(this.Movement); this.AddCollider(this.Hitbox); }
protected void SetUpSpriteMap(string path) { var spriteMap = new Spritemap<string>(path, 256, 256); spriteMap.Add("Invading", new[] { 0, 1 }, new[] { 20f, 20f }); spriteMap.Play("Invading"); SetGraphic(spriteMap); }