Ejemplo n.º 1
0
        Vector2 levelSize; // in pixels, after scaling

        #endregion Fields

        #region Constructors

        public Level(GameplayScreen g, String bgKey, String bmKey, int size_x, int size_y)
            : base(g, 1280 / 2, 720 / 2, (int)(size_x / LEVEL_SCALE), 300, bgKey, LEVEL_SCALE)
        {
            this.background = g.textureDict["room2"];
            Texture2D bitmap = g.textureDict["room2-collision-map"];

            Color[] colormap = new Color[bitmap.Width * bitmap.Height];
            this.bitmap = new bool[bitmap.Width * bitmap.Height];
            bitmap.GetData<Color>(colormap);

            for (int i = 0; i < colormap.Length; i++)
            {
                if (colormap[i] == Color.Black)
                {
                    this.bitmap[i] = true;
                } else {
                    this.bitmap[i] = false;
                }
            }

            bitmapWidth = bitmap.Width;
            bitmapHeight = bitmap.Height;

            this.levelSize = new Vector2(size_x, size_y);
        }
Ejemplo n.º 2
0
 public AttackingDude(GameplayScreen g, int posX, int posY, int frameWidth, int attackFrameWidth, String textureLeft, String textureRight, String textureAttackLeft, String textureAttackRight, float scale)
     : base(g, posX, posY, frameWidth, textureLeft, textureRight, scale)
 {
     this.textureAttackLeft = textureAttackLeft;
     this.textureAttackRight = textureAttackRight;
     this.attackFrameWidth = attackFrameWidth;
 }
Ejemplo n.º 3
0
        public Entity(GameplayScreen g, int posX, int posY, int frameWidth, String textureName, float scale)
        {
            this.context = g;

            this.scaleBack = scale;

            id = next_id;
            next_id++;

            worldPosBack = new Vector2(posX, posY);

            changeAnimation(frameWidth, textureName);
        }
Ejemplo n.º 4
0
        public DoctorWall(GameplayScreen g, Vector2 position, bool horizontal)
            : base(g, (int)position.X, (int)position.Y, frameWidth, textureName, SCALE)
        {
            this.frameTime = 30;

            // Change parameters if actually horizontal
            this.horizontal = horizontal;
            if (horizontal)
            {

                StateChange sc = StateChangeFactory.createChangeSpriteStateChange(id, 255, textureName, GetFrameTime());
                notifyStateChangeListeners(sc);
            }
        }
Ejemplo n.º 5
0
 public Wizard(GameplayScreen g, int posX, int posY)
     : base(g, posX, posY, FRAME_WIDTH, ATK_FRAME_WIDTH,
     TEXTURE_LEFT, TEXTURE_RIGHT, TEXTURE_ATTACK_LEFT, TEXTURE_ATTACK_RIGHT)
 {
 }
Ejemplo n.º 6
0
 public Laser(GameplayScreen g, Vector2 position, Vector2 velocity)
     : base(g, (int)position.X, (int)position.Y, frameWidth, textureName, SCALE)
 {
     this.velocity = velocity;
     this.frameTime = 30;
 }
Ejemplo n.º 7
0
 public PlayerCharacter(GameplayScreen g, int posX, int posY, int frameWidth, int attackFrameWidth,
     String textureLeft, String textureRight, String textureAttackLeft, String textureAttackRight)
     : base(g, posX, posY, frameWidth, attackFrameWidth, textureLeft, textureRight, textureAttackLeft, textureAttackRight, SCALE)
 {
 }
Ejemplo n.º 8
0
 public MageAttack(GameplayScreen g, Vector2 position, Vector2 velocity)
     : base(g, (int)position.X, (int)position.Y, frameWidth, textureName, 3)
 {
     this.velocity = velocity;
     this.frameTime = 30;
 }
Ejemplo n.º 9
0
 public GameState(GameplayScreen g)
 {
     context = g;
 }
Ejemplo n.º 10
0
 // TODO: we can use this to build levels with various params
 public static Level generateLevel(GameplayScreen g)
 {
     //return new Level(g, "room2", "room2-collision-map", 1920, 1800);
     return new Level(g, "room2", "room2-collision-map", 1826,1530);
 }
Ejemplo n.º 11
0
 public Bullet(GameplayScreen g, Vector2 position, Vector2 velocity)
     : base(g, (int)position.X, (int)position.Y, frameWidth, textureName, SCALE)
 {
     this.velocity = velocity;
 }
Ejemplo n.º 12
0
 public OrientalDude(GameplayScreen g, int posX, int posY, int frameWidth, String textureLeft, String textureRight, float scale)
     : base(g, posX, posY, frameWidth, textureLeft, scale)
 {
     this.textureLeft = textureLeft;
     this.textureRight = textureRight;
 }
Ejemplo n.º 13
0
 public HealthBar(GameplayScreen context, Entity parent)
     : base(context, (int)parent.worldPosition.X, (int)(parent.worldPosition.Y - 45), frameWidthBack, backTextureName, 1)
 {
     healthBatch = context.textureDict[chunkTextureName];
 }
Ejemplo n.º 14
0
 public Dude(GameplayScreen g, int posX, int posY, int frameWidth, String defaultTexture, float scale)
     : base(g, posX, posY, frameWidth, defaultTexture, scale)
 {
     health = getMaxHealth();
     this.defaultTexture = defaultTexture;
 }