示例#1
0
        public cCritter3DPlayer(cGame pownergame)
            : base(pownergame)
        {
            BulletClass           = new cCritter3DPlayerBullet( );
            Sprite                = new cSpriteSphere();
            Sprite.FillColor      = Color.DarkGreen;
            Sprite.SpriteAttitude = cMatrix3.scale(2, 0.8f, 0.4f);
            setRadius(cGame3D.PLAYERRADIUS);               //Default cCritter.PLAYERRADIUS is 0.4.
            setHealth(10);
            moveTo(_movebox.LoCorner.add(new cVector3(0.0f, 0.0f, 2.0f)));
            WrapFlag             = cCritter.CLAMP; //Use CLAMP so you stop dead at edges.
            Armed                = true;           //Let's use bullets.
            MaxSpeed             = cGame3D.MAXPLAYERSPEED;
            AbsorberFlag         = true;           //Keeps player from being buffeted about.
            ListenerAcceleration = 160.0f;         //So Hopper can overcome gravity.  Only affects hop.

            Listener = new cListenerScooterYHopper(0.2f, 12.0f);
            // the two arguments are walkspeed and hop strength -- JC

            addForce(new cForceGravity(50.0f));    /* Uses  gravity. Default strength is 25.0.
                                                    * Gravity	will affect player using cListenerHopper. */
            AttitudeToMotionLock = false;          //It looks nicer is you don't turn the player with motion.
            Attitude             = new cMatrix3(new cVector3(0.0f, 0.0f, -1.0f), new cVector3(-1.0f, 0.0f, 0.0f),
                                                new cVector3(0.0f, 1.0f, 0.0f), Position);
        }
示例#2
0
        public override cSprite copy()
        {
            cSpriteSphere s = new cSpriteSphere();

            s.copy(this);
            return(s);
        }
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     Sprite           = new cSpriteSphere();
     Sprite.FillColor = Color.Orange;
     setRadius(minRadius);
 }
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     _hitstrength = 1;
     Sprite       = new cSpriteSphere();
     //Maybe add some kind of bitmap to bullet
     Sprite.FillColor = Color.Red;
     setRadius(radius);
 }
示例#5
0
        public static readonly float CHASEACCELERATION = 20.0f; //Rate you accelerate towards player.

        public cCritterBulletSilverMissile()
        {
            _value      = cCritterBulletSilverMissile.SCOREVALUE;
            _maxspeed   = cCritterBulletSilverMissile.MAXSPEED;
            _dieatedges = false; //Make them particularly vicious and long-lived.
            cSpriteSphere bulletsprite = new cSpriteSphere(cCritter.BULLETRADIUS, 6, 6);

            bulletsprite.FillColor = Color.LightBlue;
            Sprite = bulletsprite; /* Also sets cSprite._prismdz to CritterBullet.BULLETPRISMDZ. */
        }
        public override void initialize(cCritterArmed pshooter)
        {
            base.initialize(pshooter);

            _hitstrength     = 0;
            Sprite           = new cSpriteSphere();
            Sprite.FillColor = Color.Orange;
            setRadius(0.4f);
            this._fixedlifetime = 10.0f;
            this.Speed          = 3.0f;
        }
示例#7
0
        public cCritterBulletSilver()
        {
            _value           = cCritterBulletSilver.SCOREVALUE;
            _collidepriority = cCollider.CP_SILVERBULLET; /* Want this to have a lower priority than
                                                           * CP_BULLET, so that bullets can kill it in their collide call.
                                                           * Don't use the setCollidePriority mutator, as that forces a call to
                                                           * pgame()->buildCollider(); */
            cSpriteSphere bulletsprite = new cSpriteSphere(cCritter.BULLETRADIUS, 6, 6);

            bulletsprite.FillColor = Color.LightGreen;
            Sprite = bulletsprite; /* Also sets cSprite._prismdz to CritterBullet.BULLETPRISMDZ. */
        }
示例#8
0
        public cCritterBulletRubber()
        {
            _dieatedges      = cCritterBulletRubber.DIEATEDGES;
            Density          = cCritterBulletRubber.DENSITY; /* Use setDensity so you fixMass. */
            _collidepriority = cCollider.CP_CRITTER;         /* This acts just like a critter, so doesn't
                                                              * need any special priority.  In fact we want a low priority so regular bullets
                                                              * have higher priority and can kill it in their own collide calls.
                                                              * Don't use the setCollidePriority mutator, as that forces a call to pgame()->buildCollider(); */
            cSpriteSphere bulletsprite = new cSpriteSphere(cCritter.BULLETRADIUS, 6, 6);

            bulletsprite.FillColor = Color.Red; //From colornames.h, should make these static readonlys.
            Sprite = bulletsprite;              /* Also sets cSprite._prismdz to CritterBullet.BULLETPRISMDZ. */
        }
示例#9
0
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     if (((cCritter3DPlayer)pshooter).Mode == 'K')
     {
         Sprite           = new cSpriteSphere();
         Sprite.FillColor = Color.Blue;
         setRadius(0.4f);
         HitStrength = 2;
     }
     else if (((cCritter3DPlayer)pshooter).Mode == 'S')
     {
         Sprite.FillColor = Color.Crimson;
         // can use setSprite here too
         setRadius(0.1f);
     }
 }
示例#10
0
        // Try jumping through this hoop
        public cCritterDragonball(cGame pownergame) :
            base(pownergame)
        {
            _game = pownergame as cGame3D;

            /* The sprites look nice from afar, but bitmap speed is really slow
             *  when you get close to them, so don't use this. */
            cSpriteSphere sphere = new cSpriteSphere(20, 16, 16);

            sphere.FillColor       = Color.Orange;
            sphere.Filled          = true;
            sphere.LineWidthWeight = 0.5f;
            Sprite = sphere;
            //rotate(new cSpin((float)Math.PI / 2.0f, new cVector3(0.0f, 0.0f, 1.0f)));
            setRadius(0.5f);
            this.clearForcelist();
            addForce(new cForceDrag(100.0f));
        }
示例#11
0
        public cCritterBulletKamehameha()
        {
            _shooterindex     = cBiota.NOINDEX;
            _hitstrength      = 2;
            _dieatedges       = true;
            _defaultprismdz   = cSprite.BULLETPRISMDZ;
            _value            = 0;
            _usefixedlifetime = true;
            _fixedlifetime    = FIXEDLIFETIME;
            _collidepriority  = cCollider.CP_BULLET; /* Don't use the setCollidePriority mutator, as that
                                                      * forces a call to pgame()->buildCollider(); */
            _maxspeed         = cCritterBullet.MAXSPEED;
            Speed             = cCritterBullet.BULLETSPEED;
            cSpriteSphere bulletsprite = new cSpriteSphere(cCritter.BULLETRADIUS * 2, 6, 6);

            bulletsprite.FillColor = Color.Aqua;
            Sprite = bulletsprite; /* Also sets cSprite._prismdz to cCritter._defaultprismdz, which we
                                    * set to CritterWall.BULLETPRISMDZ above. */
        }
示例#12
0
        public virtual void draw(cGraphics pgraphics, int drawflags)
        { /* This is an example of the Template Method.  For the primitive (non-composite)
           *     sprites we only overload the imagedraw method and use this template code. */
            if ((drawflags & ACView.DF_WIREFRAME) != 0)
            {
                if (IsKindOf("cSpriteQuake"))
                {
                    cSpriteSphere sphere = new cSpriteSphere(_radius, 6, 6);
                    sphere.LineColor = Color.Black;
                    sphere.draw(pgraphics, drawflags);
                }
            }
            pgraphics.pushMatrix();
            pgraphics.multMatrix(_spriteattitude);

            /* If I don't have UNCONDITIONAL_ADJUSTATTRIBUTES turned on in
             * cGraphicsOpenGL, then I should actually call pgraphics.adjustAttributes(this);
             * right here instead of down inside the display list --- see the comment where
             * UNCONDITIONAL_ADJUSTATTRIBUTES is defined. */
            if (EnabledDisplayList && pgraphics.SupportsDisplayList)
            {
                if (!pgraphics.activateDisplayList(this)) /* If you plan to use display lists,
                                                           * look if one's ready, and if not, open one and draw into it. */
                {
                    pgraphics.adjustAttributes(this);     //See comment above.
                    imagedraw(pgraphics, drawflags);
                }
                pgraphics.callActiveDisplayList(this); //Now call the display list.
            }
            else //Not trying to use display lists for this kind of sprite.  Just draw it.
            {
                pgraphics.adjustAttributes(this); //See comment above.
                imagedraw(pgraphics, drawflags);
            }
            pgraphics.popMatrix();
            //After the draw, tell the sprite that its current geometry has now been drawn once.
            NewGeometryFlag = false; /* This is for use by the cGraphicsOpenGL for
                                      * knowing when it may need to change any display list id being used for the sprites.  */
        }
示例#13
0
        /// <summary>
        /// A factory method to return one of the various kinds of sprites randomly forned.
        /// </summary>
        /// <param name="spritetypeindex">An index for the type of sprite.  To select the type of
        /// sprite, use cGame and select a type that begins with ST_. </param>
        /// <returns></returns>
        public cSprite randomSprite(int spritetypeindex)
        {
            cPolygon      newpoly;
            cSpriteBubble newbubble;
            cPolyPolygon  newpolypoly;
            cSpriteSphere psphere;

            if (spritetypeindex == cGame.ST_ASSORTED)
            {
                spritetypeindex = (int)Framework.randomOb.random((uint)cGame.ST_ASSORTED);
            }
            //Select a random index less than cGame.ST_ASSORTED

            /* This next block should be a switch, but the compiler won't let me use the cGame constants
             * in a switch. */
            if (spritetypeindex == cGame.ST_SIMPLEPOLYGONS)
            {
                newpoly = new cPolygon(Framework.randomOb.random(3, 5));
                newpoly.randomize( //cSprite.MF_RADIUS |
                    cPolygon.MF_COLOR);
                return(newpoly);
            }
            else if (spritetypeindex == cGame.ST_FANCYPOLYGONS)
            {
                newpoly = new cPolygon();
                newpoly.randomize( //cSprite.MF_RADIUS |
                    cPolygon.MF_COLOR | cPolygon.MF_LINEWIDTH | cPolygon.MF_DOTS | cPolygon.MF_VERTCOUNT);
                return(newpoly);
            }
            else if (spritetypeindex == cGame.ST_ASTEROIDPOLYGONS)
            {
                newpoly = new cPolygon();
                newpoly.setRandomAsteroidPolygon(5, 20, Framework.randomOb.randomReal(0.0f, 0.4f));
                newpoly.randomize( //cSprite.MF_RADIUS
                    cPolygon.MF_COLOR);
                return(newpoly);
            }
            else if (spritetypeindex == cGame.ST_BUBBLES)
            {
                newbubble = new cSpriteBubble();
                newbubble.randomize( //cSprite.MF_RADIUS |
                    cPolygon.MF_COLOR | cPolygon.MF_LINEWIDTH);
                return(newbubble);
            }
            else if (spritetypeindex == cGame.ST_SPHERES)
            {
                psphere = new cSpriteSphere();
                psphere.randomize(cPolygon.MF_COLOR);
                Color fill = psphere.FillColor;
                return(psphere);
            }
            else if (spritetypeindex == cGame.ST_POLYPOLYGONS)
            {
                newpolypoly = new cPolyPolygon();
                newpolypoly.randomize( //cSprite.MF_RADIUS |
                    cPolygon.MF_COLOR | cPolygon.MF_LINEWIDTH | cPolygon.MF_DOTS |
                    cPolygon.MF_VERTCOUNT);
                return(newpolypoly);
            }
            else if (spritetypeindex == cGame.ST_TRIPLEPOLYPOLYGONS)
            {
                newpolypoly = new cPolyPolygon();
                newpolypoly.randomize(cPolygon.MF_VERTCOUNT);
                newpolypoly.TipShape = new cPolyPolygon();
                newpolypoly.randomize( //cSprite.MF_RADIUS |
                    cPolygon.MF_COLOR | cPolygon.MF_LINEWIDTH | cPolygon.MF_DOTS | cPolygon.MF_VERTCOUNT);
                return(newpolypoly);
            }

            return(new cSprite()); //Default in the cGame.ST_SPRITETYPENOTUSED case
        }
示例#14
0
        //Default constructor calls initializer
        //Overloaded cSprite methods

        public void copy(cSpriteSphere pspritesphere)
        {
            base.copy(pspritesphere);
            _slices = pspritesphere._slices;
            _stacks = pspritesphere._stacks;
        }