Beispiel #1
0
 public Puck(PuckDef pd)
 {
     _type     = pd._type;
     _charge   = pd._charge;
     _positive = true;
     if (_charge < 0)
     {
         _positive = false;
     }
     _bmpId = pd._bmpId;
 }
Beispiel #2
0
        public static Puck GetPuck(PuckType type)
        {
            List <PuckDef> defs = new List <PuckDef>();

            foreach (PuckDef pd in puckDefs)
            {
                if (pd._type == type)
                {
                    defs.Add(pd);
                    break;
                }
            }

            Puck p = new Puck(defs[0]);

            p.XAcceleration = 0;
            p.XVelocity     = 0;
            p.YAcceleration = 0;
            p.YVelocity     = 0;


            return(p);
        }
Beispiel #3
0
        private void CreatePuck(float x, float y, PuckType type)
        {
            Puck p = Puck.GetPuck(type);

            p.XPosition = x;
            p.YPosition = y;

            p.XPositionPrevious = x;
            p.YPositionPrevious = y;

            if (_levelSelected == 5)
            {
                p.XVelocity = 10;
            }

            p.Trail = new List <Point>();
            p.Trail.Add(new Point((int)x, (int)y));
            p.Trail.Add(new Point((int)x, (int)y));

            p.Bitmap = _puckBitmaps[p.BmpID];

            _activeGameObjects.Add(p);
            _activePucks.Add(p);
        }
Beispiel #4
0
 public PuckDef(PuckType type, float charge, int bmpId)
 {
     _type   = type;
     _charge = charge;
     _bmpId  = bmpId;
 }