예제 #1
0
파일: Character.cs 프로젝트: Adhesion/ld22
        public Character(Texture2D _sprite, Vector2 _pos, Vector2 _vel, int _hp, LevelManager l)
        {
            sprite = _sprite;
            pos = _pos;
            vel = _vel;

            center = new Vector2(sprite.Width / 2.0f, sprite.Height / 2.0f);

            hp = _hp;
            hpMax = hp;
            alive = true;

            firing = false;
            fireCounter = 0;
            fireCounterMax = 15;

            scale = 1.0f;

            setBoxScale(new Vector2(1.0f, 1.0f));
            updateBBoxPos();
            boundingBox.X = (int)pos.X;
            boundingBox.Y = (int)pos.Y;

            friction = 0.9f;

            rotation = 0.0f;

            col = Color.White;
            effect = SpriteEffects.None;

            bounded = true;
            levelManager = l;
        }
예제 #2
0
파일: Camera.cs 프로젝트: Adhesion/ld22
 public Camera(GraphicsDevice graphics, Vector2 _pos, Player _player, LevelManager _levelManager)
 {
     screenPos.X = graphics.Viewport.Width / 2;
     screenPos.Y = graphics.Viewport.Height / 2;
     pos = _pos;
     player = _player;
     zoom = 0.9f;
     levelManager = _levelManager;
 }
예제 #3
0
파일: Player.cs 프로젝트: Adhesion/ld22
 public Player(Texture2D _sprite, Vector2 _pos, Vector2 _vel, int _hp, LevelManager l)
     : base(_sprite, _pos, _vel, _hp, l)
 {
     setBoxScale(new Vector2(0.25f, 0.25f));
     fireCounterMax = 10;
     numLives = 3;
     bombCooldown = 0;
     numEggs = 0;
 }
예제 #4
0
 public TileBackground(Texture2D _sprite, Vector2 _pos, Vector2 _vel, int _hp, LevelManager l)
     : base(_sprite, _pos, _vel, _hp, l)
 {
     rect = l.getCurrentLevelArea();
     rect.Inflate(10000, 10000);
     pos.X -= 5000;
     pos.Y -= 5000;
     center.X += 5000;
     center.Y += 5000;
     rotation = (float)Game1.random.NextDouble() * (float)Math.PI * 2.0f;
 }
예제 #5
0
파일: Bullet.cs 프로젝트: Adhesion/ld22
        public Bullet(Texture2D s, Vector2 p, Vector2 v, int _hp, LevelManager l, Color c, int d)
            : base(s, p, v, _hp, l)
        {
            friction = 1.0f;
            lifetimeThreshold = 20;
            lifetime = 90;

            damage = d;

            col = c;

            bounded = false;
            grow = false;
            stay = false;
            growScale = 0.0f;
        }
예제 #6
0
파일: Enemy1.cs 프로젝트: Adhesion/ld22
        public Enemy1(Texture2D s, Vector2 p, Vector2 v, int _hp, LevelManager l, int t)
            : base(s, p, v, _hp, l)
        {
            fireCounterMax = 30;
            aiCounter = 0;
            aiCounterMax = 40;
            faceCounter = 0;
            faceCounterMax = Game1.random.Next(10, 15);
            maxVel = 4.0f;

            setBoxScale(new Vector2(0.9f, 0.9f));
            type = t;

            chase = false;
            bulletDamage = type + 4;

            switch (type)
            {
                case 0:
                    fireCounterMax = 30;
                    hp = 30;
                    bulletColor = Color.OrangeRed;
                    break;
                case 1:
                    fireCounterMax = 20;
                    hp = 40;
                    bulletColor = Color.OrangeRed;
                    break;
                case 2:
                    fireCounterMax = 12;
                    hp = 60;
                    bulletColor = Color.OrangeRed;
                    break;
                case 3:
                    fireCounterMax = 10;
                    hp = 100;
                    scale = 3.0f;
                    setBoxScale(new Vector2(1.5f, 1.5f));
                    maxVel = 3.0f;
                    bulletColor = Color.White;
                    break;
            }
        }
예제 #7
0
파일: Game1.cs 프로젝트: Adhesion/ld22
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // load sprites and such
            playerSprite = Content.Load<Texture2D>("playership");
            playerBulletSprite = Content.Load<Texture2D>("playerbullet");

            starTex = new Texture2D[3];
            starTex[0] = Content.Load<Texture2D>("star1");
            starTex[1] = Content.Load<Texture2D>("star2");
            starTex[2] = Content.Load<Texture2D>("star3");

            backTex = new Texture2D[4];
            backTex[0] = Content.Load<Texture2D>("background1");
            backTex[1] = Content.Load<Texture2D>("background2");
            backTex[2] = Content.Load<Texture2D>("background3");
            backTex[3] = Content.Load<Texture2D>("background4");

            earthTex = Content.Load<Texture2D>("earth");

            enemySprites = new Texture2D[4];
            enemySprites[0] = Content.Load<Texture2D>("enemy1");
            enemySprites[1] = Content.Load<Texture2D>("enemy2");
            enemySprites[2] = Content.Load<Texture2D>("enemy3");
            enemySprites[3] = Content.Load<Texture2D>("boss");

            eggSprite = Content.Load<Texture2D>("egg");
            hollowEggSprite = Content.Load<Texture2D>("hollowegg");
            portalSprite = Content.Load<Texture2D>("portal");

            HPBoxSprite = Content.Load<Texture2D>("hpbox");

            arrowSprite = Content.Load<Texture2D>("arrow");
            sparkSprite = Content.Load<Texture2D>("spark");
            explosionSprite = Content.Load<Texture2D>("explosion");

            levelManager = new LevelManager(starTex, backTex, earthTex);

            player = new Player(playerSprite, new Vector2(0.0f, 0.0f),
                new Vector2(0.0f, 0.0f), 200, levelManager);
            characterManager = new CharacterManager(player);
            inputHandler = new InputHandler(player);

            player.setCharacterManager(characterManager);
            levelManager.setCharacterManager(characterManager);

            characterManager.setBulletSprite(playerBulletSprite);
            characterManager.setEnemySprites(enemySprites);
            characterManager.setEggSprite(eggSprite);
            characterManager.setPortalSprite(portalSprite);
            characterManager.setArrowSprite(arrowSprite);
            characterManager.setExplosionSprite(explosionSprite);
            characterManager.setSparkSprite(sparkSprite);
            characterManager.setLevelManager(levelManager);

            cam = new Camera(GraphicsDevice, new Vector2(0.0f, 0.0f), player, levelManager);
            characterManager.setCam(cam);

            soundManager = new SoundManager(Content);
            levelManager.setSoundManager(soundManager);
            characterManager.setSoundManager(soundManager);

            font = Content.Load<SpriteFont>("font");

            intro = new string[6];
            intro[0] = "This is ground control... your circuit's dead, there's something wrong...\n\n\n";
            intro[1] = "On a routine mission, you stumble into a strange portal and find yourself";
            intro[2] = "-alone-";
            intro[3] = "in a parallel dimension.";
            intro[4] = "Search for the space eggs to survive and find your way home.";
            intro[5] = "Good luck !";

            end = new string[4];
            end[0] = "In your absence, the earth was destroyed.";
            end[1] = "You are now";
            end[2] = "-alone-";
            end[3] = "\n\nTHE END";

            gameOver = false;

            levelManager.initLevel(0);
            Game1.points = 0;
        }
예제 #8
0
 public void setLevelManager(LevelManager l)
 {
     levelManager = l;
 }