Exemple #1
0
        public Exit(int idxX, int idxY, KulaLevel.Orientation o)
        {
            surfacesPhysicInit(Constants.BlockWidth, 8, -RotationUtilities.getAngleFromDownOrientation(o));
            PointF newCenter = suggestedCenter(idxX, idxY, o);

            startingX       = newCenter.X;
            startingY       = newCenter.Y;
            currentX        = startingX;
            currentY        = startingY;
            isLandingNeeded = true;
        }
Exemple #2
0
        public Spikes(int idxX, int idxY, KulaLevel.Orientation o, Bitmap img)
        {
            surfacesPhysicInit(Constants.BlockWidth * 0.875f, 24, -RotationUtilities.getAngleFromDownOrientation(o));
            surfacesDrawInit(img, (int)(Constants.BlockWidth * 0.875f), 24);
            PointF newCenter = suggestedCenter(idxX, idxY, o);

            startingX       = newCenter.X;
            startingY       = newCenter.Y;
            currentX        = startingX;
            currentY        = startingY;
            isLandingNeeded = false;
            isEnabled       = true;
        }
Exemple #3
0
        public Ice(int idxX, int idxY, KulaLevel.Orientation o)
        {
            type = SurfType.Ice;
            surfacesPhysicInit(Constants.BlockWidth, 8, -RotationUtilities.getAngleFromDownOrientation(o));
            surfColor = Color.FromArgb(200, Color.Azure);
            PointF newCenter = suggestedCenter(idxX, idxY, o);

            startingX       = newCenter.X;
            startingY       = newCenter.Y;
            currentX        = startingX;
            currentY        = startingY;
            isLandingNeeded = true;
        }
Exemple #4
0
        protected PointF suggestedCenter(int idxX, int idxY, KulaLevel.Orientation o)
        {
            float  d   = Constants.BlockWidth;
            PointF off = new PointF(0, -d / 2.0f);

            Matrix m   = new Matrix();
            float  rot = -RotationUtilities.getAngleFromDownOrientation(o);

            m.Rotate(rot);
            off = m.TransformAndThenRound(off);

            float cX = d / 2.0f + d * idxX;
            float cY = d / 2.0f + d * idxY;

            off = new PointF((float)Math.Round(cX + off.X), (float)Math.Round(cY + off.Y));
            return(off);
        }
Exemple #5
0
        public GravityChanger(int idX, int idY, float persp, Bitmap img, KulaLevel.Orientation o)
        {
            initPlaceable(idX, idY, persp, img);
            rot = RotationUtilities.getAngleFromDownOrientation(o);

            float angle = (float)Math.Round(rot - perspective) % 360;

            if (angle < 0f)
            {
                while ((angle += 360f) < 0f)
                {
                    ;
                }
            }

            if (angle % 360 == 0)
            {
                toDraw.RotateFlip(RotateFlipType.RotateNoneFlipNone);
            }
            else if (angle % 360 == 270)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate90FlipNone);
            }
            else if (angle % 360 == 180)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate180FlipNone);
            }
            else if (angle % 360 == 90)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate270FlipNone);
            }
            else
            {
                throw new Exception("What is " + angle + "deg?");
            }
        }