Beispiel #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //this.graphics.PreferredBackBufferHeight = 900;
            //this.graphics.PreferredBackBufferWidth = 1600;
            //this.graphics.IsFullScreen = true;

            //Dimensionen vom Spiel festlegen(Bildschirmgroesse):
            statsGame.dimensions = new int[] { this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight };
            statsGame.ViewRectangle = new Rectangle(0, 0, statsGame.dimensions[0], statsGame.dimensions[1]);

            //Gameplaywerte mit Dimensions relativieren:
            statsGame.PlayerSpeed = statsGame.dimensions[0] / 250;

            //Umgebung erzeugen:
            env = new enviroment();
            env.initialize();
            NPCStats.mobSize = statsGame.lineSize;

            //Spieler erzeugen:
            player = new Player(env);
            env.PlayerRegister(player);

            //Fps:
            fps = new FpsMonitor();

            //HUD:
            hud = new HUD(env);
        }
Beispiel #2
0
        public HUD(enviroment env)
        {
            anzeige = new sprite();
            anzeige.setPosition(0, 0);
            anzeige.setSize(new int[]{statsGame.dimensions[0],(statsGame.dimensions[1])});
            this.env = env;
            lifePosition = new Vector2((statsGame.dimensions[0] / 5) * 4, (statsGame.dimensions[1] / 6) * 5);

            //Item-Plätze:
            itemHolders = new sprite[8];
            for (int i = 0; i < 8; i++)
            {
                itemHolders[i] = new sprite();
                itemHolders[i].setPosition(
                    statsGame.dimensions[0] - (int)(statsGame.dimensions[0] / 1.4) + i*45,
                    statsGame.dimensions[1] - (statsGame.dimensions[0] / 20));

                itemHolders[i].setSize(new int[] { 40, 40 });

                aktItem = 0;

                env.registerHud(this);
            }
            items = new sprite[8];

            mouseScrollValue = Mouse.GetState().ScrollWheelValue;
        }
Beispiel #3
0
        public Player(enviroment env)
        {
            anzeige = new animatedSprite();
            int[] temp = {
                    statsGame.PlayerSpawnpoint[0]*statsGame.lineSize[0],
                    statsGame.PlayerSpawnpoint[1]*statsGame.lineSize[1]
                };
            anzeige.setPosition(temp,false);
            anzeige.setSize(statsGame.lineSize);

            //Gameplayeinstellungen:
            maxLife = statsGame.playerStartLife;
            invincible = false;
            life = maxLife;
            invincibleTime = 0;
            maxInvincibleTime = statsGame.PlayerMaxInvincibleTime;

            int aktDirection = 0;

            //Verweise:
            this.env = env;

            //Inventar:
            inventory = new Inventory(8);
            inventory.setPlayer(this);
            inventory.setEnviroment(env);
        }
Beispiel #4
0
 public NPCSnake(int[] position,enviroment env)
     : base(position,env,1,1)
 {
     anzeige.setSize(NPCStats.mobSize);
     anzeige.setPosition(
         new int[]{
             position[0]*statsGame.lineSize[0],
             position[1]*statsGame.lineSize[1]},
         false);
 }
Beispiel #5
0
        public NPC(int[] position,enviroment env,int damage,int speed)
        {
            anzeige = new animatedSprite();
            anzeige.setPosition(position, false);
            //anzeige.setSize(NPCStats.mobSize);

            r = new Random();
            nextTurn = r.Next(1000);

            this.env = env;
            this.damage = damage;
            this.speed = speed;
        }
 public void setEnviroment(enviroment env)
 {
     this.env = env;
 }