コード例 #1
0
        // Constructor
        public HorizontalThwomp(float x, float y, Graphics.Flip flip = Graphics.Flip.None) : base(x, y, flip)
        {
            height  /= 2;
            target.X = 0.0f;
            speed.X  = 0.0f;

            waving = false;
            shake  = false;
        }
コード例 #2
0
        // Constructor
        public VerticalThwomp(float x, float y, Graphics.Flip flip = Graphics.Flip.None) : base(x, y, flip)
        {
            width   /= 2;
            target.Y = 0.0f;
            speed.Y  = 0.0f;

            waving = false;
            shake  = false;
        }
コード例 #3
0
        // Constructor
        public Enemy(float x, float y, Graphics.Flip flip = Graphics.Flip.None)
        {
            const float DEFAULT_WAVE_SPEED = 0.15f;

            pos.X    = x;
            pos.Y    = y;
            startPos = pos;

            wave      = (float)((new Random()).NextDouble() * Math.PI * 2);
            waveSpeed = DEFAULT_WAVE_SPEED;
            waving    = true;

            exist        = true;
            inCamera     = true;
            getCollision = true;

            width  = Stage.TILE_SIZE;
            height = Stage.TILE_SIZE;

            speed.X  = 0.0f;
            speed.Y  = 0.0f;
            target.X = 0.0f;
            target.Y = 0.0f;
            acc.X    = 1.0f;
            acc.Y    = 1.0f;

            moveDir = 1;

            // Create sprite
            spr       = new Sprite(SPRITE_WIDTH, SPRITE_HEIGHT);
            this.flip = flip;

            // Animate (to get the correct frame for rendering
            // before updated)
            Animate(0.0f);
        }
コード例 #4
0
 // Draw a scaled sprite
 public void Draw(Graphics g, Bitmap bmp, int dx, int dy, int dw, int dh,
                  Graphics.Flip flip = Graphics.Flip.None)
 {
     DrawFrame(g, bmp, frame, row, dx, dy, dw, dh, flip);
 }
コード例 #5
0
 // Draw a frame
 public void DrawFrame(Graphics g, Bitmap bmp, int frame, int row,
                       int dx, int dy, Graphics.Flip flip)
 {
     DrawFrame(g, bmp, frame, row, dx, dy, w, h, flip);
 }
コード例 #6
0
 // Draw a scaled frame
 public void DrawFrame(Graphics g, Bitmap bmp, int frame, int row,
                       int dx, int dy, int dw, int dh,
                       Graphics.Flip flip = Graphics.Flip.None)
 {
     g.DrawScaledBitmapRegion(bmp, w * frame, h * row, w, h, dx, dy, dw, dh, flip);
 }
コード例 #7
0
 // Constructor
 public FallingFly(float x, float y, Graphics.Flip flip = Graphics.Flip.None) : base(x, y, flip)
 {
     width   /= 2;
     target.Y = 0.0f;
     speed.Y  = 0.0f;
 }