示例#1
0
        /// <summary>
        /// Constructor, player initially in standing state
        /// </summary>
        public cPlayer()
            : base(26,46,1)
        {
            _instance = this;
            Position = Vector2.Zero;
            _state = (int)STATES.STANDING;
            _vel = Vector2.Zero;

            //RigidBody.IsPlayer = true;
            //this.CanAttachPortalTo = false;
            //this.IsPortalTransparrent = true;

            // Make sure all the correct graphics get loaded
            cSpriteManager.Instance.addAnimation(@"Resources/Sprites/egon_anim.xml", "egon_anim");
            cEffectManager.Instance.defineEffect(@"Resources/Sprites/player_spawn_anim.xml", "player_spawn");
            //cSpriteManager.Instance.addTexture(@"Resources/Sprites/bazooka", "portal_gun");
            cSpriteManager.Instance.addTexture(@"Resources/Sprites/portalblob", "portal_target");
            base.setAnimatedSprite("egon_anim");
            ((cAnimatedSprite)_sprite).play("stand");
            _sprite.Origin = new Vector2(15, 23);
            //_portalGunSprite = new cSprite("portal_gun");
            _targeter = new cSprite("portal_target");
        }
示例#2
0
        public void loadLevel(String levelName)
        {
            // Very quick and dirty way of removing all objects!
            _scene = new cScene();
            _physics = new cPhysics();
            _player = new cPlayer();
            _particleEngine = new cParticleEngine();
            _effectManager = cEffectManager.Instance;
            _lightMapManager = new cLightMapManager();
            _portalManager = new cPortalManager();

            _gameTimer = 0;
            _scene.loadLevel(levelName);
            _scene.initLevel();
            cCamera.Instance.FocusObject = _player;
            _player.LivesRemain = 3;
            _gameState = GAME_STATE.INTRO;
        }