Ejemplo n.º 1
0
 /// <summary>
 /// Creates the basic movement.
 /// </summary>
 /// <param name="xMax">The maximum speed allowed in the x axis.</param>
 /// <param name="yMax">The maximum speed allowed in the y axis.</param>
 /// <param name="accel">The acceleration.</param>
 public BasicMovement(float xMax, float yMax, float accel)
     : base()
 {
     Speed = new Speed(xMax, yMax);
     TargetSpeed = new Speed(xMax, yMax);
     Accel = accel;
 }
Ejemplo n.º 2
0
        public Ghost(float x, float y, bool impostor)
        {
            X = x;
            Y = y;
            Impostor = impostor;

            mySprite = new Spritemap<string>(Assets.GFX_GHOST_SHEET, 22, 20);
            mySprite.Add("idle", new int[] { 0, 1, 2, 3 }, new float[] { 8f });
            mySprite.Add("distort", new int[] { 8, 9, 10 }, new float[] { 1f });
            mySprite.Play("idle");
            mySprite.CenterOrigin();

            mySpeed = new Speed(2);

            Image ghostShadow = new Image(Assets.GFX_SHADOW);
            ghostShadow.CenterOrigin();
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            AddCollider(new BoxCollider(22, 20, 0));
            Collider.CenterOrigin();
            Layer = 5;

            if(!impostor)
            {
                myController = Global.theController;
            }
        }
Ejemplo n.º 3
0
 public CannonShot(Ship parentShip, float Ang, int Level, Speed AddSpeed)
 {
     AdditionalSpeed = AddSpeed;
     LaserLevel = Level;
     Graphic = new Image(Assets.GFX_FX_LASER);
     Graphic.CenterOrigin();
     Graphic.Angle = 360 - Ang;
     myParent = parentShip;
     X = myParent.X;
     Y = myParent.Y;
 }
Ejemplo n.º 4
0
        public Item(float x, float y, int type)
        {
            X = x;
            Y = y;
            itemType = type;
            switch(type)
            {
                case 1:
                    mySprite = new Image(Assets.GFX_BOOTS);
                    break;
                case 2:
                    mySprite = new Image(Assets.GFX_CIRCUIT);
                    break;
                case 3:
                    mySprite = new Image(Assets.GFX_TILE);
                    break;
                case 4:
                    mySprite = new Image(Assets.GFX_WRENCH);
                    break;
                case 5:
                    mySprite = new Image(Assets.GFX_BATTERY);
                    break;
                case 6:
                    mySprite = new Image(Assets.GFX_DONUT);
                    break;
                case 7:
                    mySprite = new Image(Assets.GFX_CRISPS);
                    break;
                case 8:
                    mySprite = new Image(Assets.GFX_EXTINGUISHER);
                    break;
                case 9:
                    mySprite = new Image(Assets.GFX_O2TANK);
                    break;
                default:
                    return;
            }
            AddGraphic(mySprite);
            Graphic.CenterOrigin();
            mySpeed = new Speed(4);

            AddCollider(new CircleCollider(8, 1));
            Collider.CenterOrigin();
            Layer = 30;
        }
Ejemplo n.º 5
0
        public Player(float x, float y)
        {
            X = x;
            Y = y;
            // load player sheet
            mySprite = new Spritemap<string>(Assets.GFX_PLAYER, 32, 32);
            mySprite.Add("idle", new int[] { 0 }, new float[] { 60.0f });
            mySprite.Add("run", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 6f, 6f, 6f, 6f, 6f, 6f });
            mySprite.Add("dead", new int[] { 6 }, new float[] { 6f });
            mySprite.Play("run");
            mySprite.CenterOrigin();
            AddGraphic(mySprite);
            mySpeed = new Speed(5);

            // Load inventory images
            hand = new Image(Assets.GFX_HAND);
            boots = new Image(Assets.GFX_BOOTS);
            circuit = new Image(Assets.GFX_CIRCUIT);
            wrench = new Image(Assets.GFX_WRENCH);
            crisps = new Image(Assets.GFX_CRISPS);
            donut = new Image(Assets.GFX_DONUT);
            o2tank = new Image(Assets.GFX_O2TANK);
            fireextinguisher = new Image(Assets.GFX_EXTINGUISHER);
            battery = new Image(Assets.GFX_BATTERY);
            tiles = new Image(Assets.GFX_TILE);

            StartInspect = Global.theGame.Timer;

            AddCollider(new CircleCollider(8, 2));
            Collider.CenterOrigin();

            crossHair = new Entity(X, Y, new Image(Assets.XHAIR));
            crossHair.Graphic.CenterOrigin();
            crossHair.AddCollider(new CircleCollider(8, 4));
            crossHair.Collider.CenterOrigin();

            // Default vars
            NoShoes = false;
            HP = 100;
            O2Level = 100;
            Hunger = 0;
            InsideShip = true;
        }
        /// <summary>
        /// Create a new PlatformingMovement.
        /// </summary>
        /// <param name="xSpeedMax">The maximum X input speed.</param>
        /// <param name="ySpeedMax">The maximum Y speed from jumping and gravity.</param>
        /// <param name="gravity">The acceleration caused by gravity.</param>
        public PlatformingMovement(float xSpeedMax, float ySpeedMax, float gravity)
        {
            Speed = new Speed(xSpeedMax, ySpeedMax);
            ExtraSpeed = new Speed(xSpeedMax, ySpeedMax);

            Speeds.Add(Speed);
            Speeds.Add(ExtraSpeed);

            TargetSpeed = new Speed(xSpeedMax, ySpeedMax);

            Gravity = gravity;

            JustJumped = false;

            Acceleration.Add(AccelType.Ground, DefaultAccleration);
            Acceleration.Add(AccelType.Air, DefaultAccleration / 4);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a new PlatformingMovement.
        /// </summary>
        /// <param name="xSpeedMax">The maximum X input speed.</param>
        /// <param name="ySpeedMax">The maximum Y speed from jumping and gravity.</param>
        /// <param name="gravity">The acceleration caused by gravity.</param>
        public PlatformingMovement(float xSpeedMax, float ySpeedMax, float gravity) {
            Speed = new Speed(xSpeedMax, ySpeedMax);
            ExtraSpeed = new Speed(xSpeedMax, ySpeedMax);

            Speeds.Add(Speed);
            Speeds.Add(ExtraSpeed);

            TargetSpeed = new Speed(int.MaxValue, int.MaxValue);

            Gravity = gravity;

            JustJumped = false;

            CollisionsJumpThrough = new List<int>();

            Acceleration.Add(AccelType.Ground, DefaultAccleration);
            Acceleration.Add(AccelType.Air, DefaultAccleration / 4);
        }