public BlockFactory(Runner runner, int defaultAnimNb, ContentManager content)
 {
     this._farthestBlock = null;
     this._runner = runner;
     this._defaultAnimNb = defaultAnimNb;
     this._content = content;
 }
 public SlidingBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount, Vector2 velocity)
     : base(tex, pos, r, spriteFrameCount, velocity)
 {
     if (pos.Y > 240)
         Direction = -1;
     else
         Direction = 1;
 }
 public SlidingBlock(Texture2D tex, Vector2 pos, Runner r)
     : base(tex, pos, r)
 {
     if (pos.Y > 240)
         Direction = -1;
     else
         Direction = 1;
 }
 public ChunkGenerator(Runner r, int mapW, int mapH, ContentManager Content)
     : base()
 {
     _mapHeight = mapH;
     _mapWidth = mapW;
     _runner = r;
     _content = Content;
     _blockFactory = new BlockFactory(_runner, 8, _content);
 }
Beispiel #5
0
 public Block(Texture2D tex, Vector2 position, Runner r)
     : base(true, 4)
 {
     _texture = tex;
     runner = r;
     IsBeingDestroyed = false;
     Destroyed = false;
     SpriteFrameCount = 1;
     Position = position;
     Velocity = new Vector2(-((float)GameSettings.ScrollSpeed), 0f);
     Dimensions = new Vector2(GameSettings.BlockWidth, GameSettings.BlockHeight);
 }
Beispiel #6
0
 public Block(Texture2D tex, Vector2 position, Runner r, int spriteFramesCount, Vector2 velocity)
     : base(true, 1)
 {
     _texture = tex;
     SpriteFrameCount = spriteFramesCount;
     IsBeingDestroyed = false;
     Destroyed = false;
     runner = r;
     Dimensions = new Vector2(GameSettings.BlockWidth, GameSettings.BlockHeight);
     Position = position;
     Velocity = velocity;
 }
 public ReboundBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount, Vector2 velocity)
     : base(tex, pos, r, spriteFrameCount, velocity)
 {
 }
 public ReboundBlock(Texture2D tex, Vector2 pos, Runner r)
     : base(tex, pos, r)
 {
 }
 public AutoDestructiveBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount, Vector2 velocity)
     : base(tex, pos, r, spriteFrameCount, velocity)
 {
 }
 public DestructibleBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount)
     : base(tex, pos, r, spriteFrameCount)
 {
 }
 public AutoDestructiveBlock(Texture2D tex, Vector2 pos, Runner r)
     : base(tex, pos, r)
 {
 }
 public TeleporterEntranceBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount, Vector2 velocity)
     : base(tex, pos, r, spriteFrameCount, velocity)
 {
     Exit = null;
     Blocking = false;
 }
 public TeleporterEntranceBlock(Texture2D tex, Vector2 pos, Runner r)
     : base(tex, pos, r)
 {
     Exit = null;
     Blocking = false;
 }
        public override void Initialize()
        {
            Blocks = new List<Block>();
            _toDelete = new List<Block>();

            /*bool toto = File.Exists("Content/Maps/0.txt");
            bool tata = File.Exists("../0.txt");
            StreamReader sr = new StreamReader("Content/Maps/0.txt");

            String s = sr.ReadLine();
            Console.WriteLine(s);
             */

            if (GameSettings.AllowMusic && GameSettings.VolumeOn)
            {
                MediaPlayer.Play(Content.Load<Song>("gamesound"));
                MediaPlayer.IsRepeating = true;
            }

            _buttonHitBox = new Rectangle(0, _mapHeight - 120, 120, 120);
            ScoreManager.getInstance().CurrentScore = 0;

            _runner = new Runner(_runnerTexture, new Vector2(_mapWidth / 2, _mapHeight / 2), Blocks);
            _runner.ZIndex = 5;
            //_blockGenerator = new LolBlockGenerator(_runner, _mapWidth, _mapHeight, Content);
            _blockGenerator = new ChunkGenerator(_runner, _mapWidth, _mapHeight, Content);

            _particleEmitter = new ParticleEmitter(new RainbowParticleGenerator(Content.Load<Texture2D>("star")), new Vector2(700, 240), GameSettings.ParticleGenerationCount);
            _particleEmitter.ZIndex = 2;
            _particleEmitter.Stop();

            #if WINDOWS
            _exitbutton = new Sprite(Content.Load<Texture2D>("ingameexitbutton"), new Vector2(0, 50));
            #endif

            _pausebutton = new Sprite(Content.Load<Texture2D>("pause"), new Vector2(_mapWidth - 75, 10));

            this.Components.Add(new Background(Content.Load<Texture2D>("background2"), GameSettings.BackGroundScrollSpeed / 2, true));
            this.Components.Add(new Background(Content.Load<Texture2D>("background1"), GameSettings.BackGroundScrollSpeed, true));

            this.Components.Add(_particleEmitter);
            this.Components.Add(_runner);
            base.Initialize();
        }
 public SpeedupBlock(Texture2D tex, Vector2 pos, Runner r, int spriteFrameCount)
     : base(tex, pos, r, spriteFrameCount)
 {
 }
 public SpeedupBlock(Texture2D tex, Vector2 pos, Runner r)
     : base(tex, pos, r)
 {
 }