Пример #1
0
        public Punch(Vector2 p)
        {
            pos = p;

            Bounds bounds = new Bounds(20, 20);
            boundingBox = new BoundingBox(pos, bounds);

            rectangle = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            rectangle.setColor(255, 0, 0, 255);
        }
Пример #2
0
        public static void LoadImage(ImageName name, string path)
        {
            Image newImage = new Image(path);
            newImage.SetName(name);
            images.Add(name, newImage);

            // Create a rectangle object, make it have 0 alpha, and stream it over to CalVR to pre-load the textures
            Rectangle r = new Rectangle(0, 0, newImage.width, newImage.height);
            r.setTexture(path);
            r.Hide();
            Mugic.MugicObjectManager.Register(r);
        }
Пример #3
0
        public Building(Vector2 pos, Bounds bounds)
        {
            health = 5;

            this.pos = pos;
            this.boundingBox = new BoundingBox(pos.X, pos.Y, bounds);

            standing000 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            standing001 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            standing002 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            standing000.setTexture("../../res/tex/building/standing000.png");
            standing001.setTexture("../../res/tex/building/standing001.png");
            standing002.setTexture("../../res/tex/building/standing002.png");
            List<Rectangle> standingFrames = new List<Rectangle>();
            standingFrames.Add(standing000);
            standingFrames.Add(standing001);
            standingFrames.Add(standing002);
            standingAnim = new Animation(standingFrames, 100, AnimationMode.LOOP);

            hit000 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            hit001 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            hit002 = new Rectangle(pos.X, pos.Y, bounds.width, bounds.height);
            hit000.setTexture("../../res/tex/building/hit000.png");
            hit001.setTexture("../../res/tex/building/hit001.png");
            hit002.setTexture("../../res/tex/building/hit002.png");
            List<Rectangle> hitFrames = new List<Rectangle>();
            hitFrames.Add(hit000);
            hitFrames.Add(hit001);
            hitFrames.Add(hit002);
            hitAnim = new Animation(hitFrames, 8, AnimationMode.LOOP);

            hit = false;
            hitAnimTimer = new Timer(30);

            currentAnim = standingAnim;
        }
Пример #4
0
 public void AddFrame(Image newFrame, int w, int h)
 {
     Rectangle newRect = new Rectangle(0, 0, w, h);
     newRect.setTexture(newFrame.name);
     frames.Add(newRect);
     loopTo = frames.Count - 1;
 }
Пример #5
0
 public void AddFrame(Image newFrame)
 {
     Rectangle newRect = new Rectangle(0, 0, newFrame.width, newFrame.height);
     newRect.setTexture(newFrame.name);
     frames.Add(newRect);
     loopTo = frames.Count - 1;
 }
Пример #6
0
 public FrameUpdate(Rectangle draw, Rectangle clear)
 {
     this.draw = draw;
     this.clear = clear;
 }