예제 #1
0
 public CollisionManager(Game game, JumperMain main, JumperMan man, JumperTile tile, Vector2 stage) : base(game)
 {
     this.man   = man;
     this.tile  = tile;
     this.stage = stage;
     this.game  = game;
     this.main  = main;
     jumpEffect = game.Content.Load <SoundEffect>("Sound/jump");
 }
예제 #2
0
파일: Explosion.cs 프로젝트: xbh/Jumper
 public Explosion(Game game, SpriteBatch spriteBatch, Texture2D tex, Vector2 position, int delay, JumperMan man) : base(game)
 {
     this.spriteBatch = spriteBatch;
     this.tex         = tex;
     this.Position    = position;
     this.delay       = delay;
     this.man         = man;
     dimention        = tex.Width / COL;
     hide();
     createFrames();
 }
예제 #3
0
        public JumperMain(GameSocket socket, SpriteBatch spriteBatch, GraphicsDeviceManager graphics, string levelName = "level1", int score = 0) : base(socket)
        {
            //_graphics = new GraphicsDeviceManager(this);
            //Content.RootDirectory = "Content";
            //IsMouseVisible = true;
            _spriteBatch   = spriteBatch;
            this.socket    = socket;
            _graphics      = graphics;
            this.levelName = levelName;
            this.score     = score;

            //_graphics.PreferredBackBufferHeight = 800;
            //_graphics.PreferredBackBufferWidth = 600;

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            stage = new Vector2(_graphics.PreferredBackBufferWidth,
                                _graphics.PreferredBackBufferHeight);

            levels = new List <string>()
            {
                "level1", "level2", "level3"
            };
            ReadLevel(levelName);

            Texture2D manTex = socket.Content.Load <Texture2D>("Image/jumper");


            Vector2 manInitPos = new Vector2(_tiles[0].Position.X, _tiles[0].Position.Y - manTex.Height);

            man = new JumperMan(socket, _spriteBatch, manTex, manInitPos, stage);
            this.Components.Add(man);



            foreach (var i in _tiles)
            {
                CollisionManager cm = new CollisionManager(socket, this, man, i, stage);
                this.Components.Add(cm);
            }


            texExplo  = Game.Content.Load <Texture2D>("Image/explosion");
            explosion = new Explosion(socket, _spriteBatch, texExplo, man.Position, 3, man);
            this.Components.Add(explosion);
        }