public Box(SpriteBatch batch, ContentManager manager, int type, Point position) : base(batch, manager, "sprites/box") { FrameAnimation anim = new FrameAnimation(3, 16, 16, 0, 0); anim.FramesPerSecond = 6; animations.Add("box1", anim); anim = new FrameAnimation(1, 16, 16, 48, 0); anim.FramesPerSecond = 1; animations.Add("box2", anim); CurrentAnimationName = "box1"; this.position = position; this.batch = batch; this.manager = manager; SoundEffect tmp; if (type == 1) { tmp = manager.Load<SoundEffect>("sounds/coin"); } else { tmp = manager.Load<SoundEffect>("sounds/powerupa"); } this.type = type; if (type == 4) visable = false; sound1 = tmp.CreateInstance(); tmp = manager.Load<SoundEffect>("sounds/bump"); sound2 = tmp.CreateInstance(); }
public object Clone() { FrameAnimation anim = new FrameAnimation(); anim.framelength = framelength; anim.frames = frames; return anim; }
public Mario(SpriteBatch batch, ContentManager manager, Point position, ColissionLayer colission, List<Sprite> staticobjects, List<Sprite> movableobjects) : base(batch, manager, "sprites/marios") { FrameAnimation anim = new FrameAnimation(3, 15, 16, 0, 0); anim.FramesPerSecond = 20; animations.Add("runright", anim); anim = new FrameAnimation(3, 15, 16, 0, 17); anim.FramesPerSecond = 20; animations.Add("runleft", anim); anim = new FrameAnimation(1, 16, 16, 48, 0); anim.FramesPerSecond = 20; animations.Add("jumpright", anim); anim = new FrameAnimation(1, 16, 16, 48, 17); anim.FramesPerSecond = 20; animations.Add("jumpleft", anim); anim = new FrameAnimation(1, 16, 16, 66, 0); anim.FramesPerSecond = 20; animations.Add("frictionright", anim); anim = new FrameAnimation(1, 16, 16, 66, 17); anim.FramesPerSecond = 20; animations.Add("frictionleft", anim); anim.FramesPerSecond = 20; anim = new FrameAnimation(1, 16, 16, 80 , 0); anim.FramesPerSecond = 20; animations.Add("stopright", anim); anim = new FrameAnimation(1, 16, 16, 80, 17); anim.FramesPerSecond = 20; animations.Add("stopleft", anim); anim = new FrameAnimation(1, 16, 16, 0, 34); anim.FramesPerSecond = 20; animations.Add("die", anim); anim = new FrameAnimation(1, 16, 16, 16, 34); animations.Add("slideright", anim); anim = new FrameAnimation(1, 16, 16, 32, 34); animations.Add("slideleft", anim); //anim = new FrameAnimation(4, 33, 33, 66, 66); //animations.Add("swimright", anim); //anim = new FrameAnimation(4, 33, 33, 0, 99); //animations.Add("swimleft", anim); CurrentAnimationName = "stopright"; this.position = position; this.colission = colission; this.staticobjects = staticobjects; this.movableobjects = movableobjects; sounds = new List<SoundEffectInstance>(); SoundEffect tmp = manager.Load<SoundEffect>("sounds/jump"); SoundEffectInstance sound = tmp.CreateInstance(); sounds.Add(sound); tmp = manager.Load<SoundEffect>("sounds/death"); sound = tmp.CreateInstance(); sounds.Add(sound); }
public Coin(SpriteBatch batch, ContentManager manager, int type, Point position) : base(batch, manager, "sprites/coin2") { FrameAnimation anim = new FrameAnimation(3, 16, 16, 0, 0); anim.FramesPerSecond = 6; animations.Add("Coin", anim); CurrentAnimationName = "Coin"; this.position = position; SoundEffect tmp = manager.Load<SoundEffect>("sounds/coin"); sound1 = tmp.CreateInstance(); }
int type = 5; // 5 - brick 6 - coinsbrick #endregion Fields #region Constructors public Brick(SpriteBatch batch, ContentManager manager, int type, Point position) : base(batch, manager, "sprites/brick") { FrameAnimation anim = new FrameAnimation(1, 16, 16, 0, 0); anim.FramesPerSecond = 6; animations.Add("brick", anim); CurrentAnimationName = "brick"; IsAnimating = false; this.position = position; SoundEffect tmp = manager.Load<SoundEffect>("sounds/bump"); sound1 = tmp.CreateInstance(); tmp = manager.Load<SoundEffect>("sounds/breakblock"); sound2 = tmp.CreateInstance(); }
int type; // 1 - Upshroom 2 - Lvlshroom 3 - Plant 4 - Star #endregion Fields #region Constructors public Powerup(SpriteBatch batch, ContentManager manager, ColissionLayer collision, int type, Point position) : base(batch, manager, "sprites/powerups") { FrameAnimation anim = new FrameAnimation(1, 16, 16, 0, 0); anim.FramesPerSecond = 6; animations.Add("Lvlshroom", anim); anim = new FrameAnimation(1, 16, 16, 16, 0); animations.Add("Upshroom", anim); anim = new FrameAnimation(4, 16, 16, 0, 16); animations.Add("Plant", anim); anim = new FrameAnimation(4, 16, 16, 0, 32); animations.Add("Star", anim); this.collision = collision; this.type = type; switch (type) { case 1: CurrentAnimationName = "Upshroom"; break; case 2: CurrentAnimationName = "Lvlshroom"; break; case 3: CurrentAnimationName = "Plant"; break; case 4: CurrentAnimationName = "Star"; break; } this.position = position; this.oldpos = position; SoundEffect tmp; if (type == 4) tmp = manager.Load<SoundEffect>("sounds/starman10"); else if (type == 2) tmp = manager.Load<SoundEffect>("sounds/1up"); else tmp = manager.Load<SoundEffect>("sounds/powerup"); sound1 = tmp.CreateInstance(); }
int type = 7; // Goomba #endregion Fields #region Constructors public Goomba(SpriteBatch batch, ContentManager manager, ColissionLayer colission, int type, Point position) : base(batch, manager, "sprites/goomba") { FrameAnimation anim = new FrameAnimation(2, 16, 16, 0, 0); anim.FramesPerSecond = 6; animations.Add("walk", anim); anim = new FrameAnimation(1, 16, 16, 32, 0); anim.FramesPerSecond = 1; animations.Add("stomp", anim); CurrentAnimationName = "walk"; IsAnimating = true; this.position = position; this.oldpos = position; this.colission = colission; SoundEffect tmp = manager.Load<SoundEffect>("sounds/stomp"); sound1 = tmp.CreateInstance(); }
public void SetSize(Mario.Size size) { if (size == Size.small) { position.Y += 16; feetoffset = 16; flagpole1 = 169; centeroffset = new Point(8, 8); curstate3 = Size.small; ReloadTexture("marios"); animations.Clear(); FrameAnimation anim = new FrameAnimation(3, 15, 16, 0, 0); anim.FramesPerSecond = 20; animations.Add("runright", anim); anim = new FrameAnimation(3, 15, 16, 0, 17); anim.FramesPerSecond = 20; animations.Add("runleft", anim); anim = new FrameAnimation(1, 16, 16, 48, 0); anim.FramesPerSecond = 20; animations.Add("jumpright", anim); anim = new FrameAnimation(1, 16, 16, 48, 17); anim.FramesPerSecond = 20; animations.Add("jumpleft", anim); anim = new FrameAnimation(1, 16, 16, 66, 0); anim.FramesPerSecond = 20; animations.Add("frictionright", anim); anim = new FrameAnimation(1, 16, 16, 66, 17); anim.FramesPerSecond = 20; animations.Add("frictionleft", anim); anim.FramesPerSecond = 20; anim = new FrameAnimation(1, 16, 16, 80, 0); anim.FramesPerSecond = 20; animations.Add("stopright", anim); anim = new FrameAnimation(1, 16, 16, 80, 17); anim.FramesPerSecond = 20; animations.Add("stopleft", anim); anim = new FrameAnimation(1, 16, 16, 0, 34); anim.FramesPerSecond = 20; animations.Add("die", anim); anim = new FrameAnimation(1, 16, 16, 16, 34); animations.Add("slideright", anim); anim = new FrameAnimation(1, 16, 16, 32, 34); animations.Add("slideleft", anim); } else if (size == Size.big) { position.Y -= 16; feetoffset = 32; flagpole1 = 169-16; centeroffset = new Point(8, 16); curstate3 = Size.big; ReloadTexture("mariob"); animations.Clear(); FrameAnimation anim = new FrameAnimation(3, 16, 32, 0, 0); anim.FramesPerSecond = 20; animations.Add("runright", anim); anim = new FrameAnimation(3, 16, 32, 0, 32); anim.FramesPerSecond = 20; animations.Add("runleft", anim); anim = new FrameAnimation(1, 16, 32, 48, 0); anim.FramesPerSecond = 20; animations.Add("jumpright", anim); anim = new FrameAnimation(1, 16, 32, 48, 32); anim.FramesPerSecond = 20; animations.Add("jumpleft", anim); anim = new FrameAnimation(1, 16, 32, 64, 0); anim.FramesPerSecond = 20; animations.Add("frictionright", anim); anim = new FrameAnimation(1, 16, 32, 64, 32); anim.FramesPerSecond = 20; animations.Add("frictionleft", anim); anim.FramesPerSecond = 20; anim = new FrameAnimation(1, 16, 32, 80, 0); anim.FramesPerSecond = 20; animations.Add("stopright", anim); anim = new FrameAnimation(1, 16, 32, 80, 32); anim.FramesPerSecond = 20; animations.Add("stopleft", anim); anim = new FrameAnimation(1, 16, 32, 0, 64); anim.FramesPerSecond = 20; animations.Add("duck", anim); anim = new FrameAnimation(1, 16, 32, 16, 64); animations.Add("slideright", anim); anim = new FrameAnimation(1, 16, 32, 32, 64); animations.Add("slideleft", anim); } }