public cCritterArmedPlayer(cGame pownergame = null) : base(pownergame) { _sensitive = false; _collidepriority = cCollider.CP_PLAYER; /* Don't use the setCollidePriority mutator, as that * forces a call to pgame()->buildCollider(); */ // setDensity(cCritter.INFINITEDENSITY); //So it can bull through. But it's wiser to let the individual games do this. AttitudeToMotionLock = false; /* We want the player's * attitude to be controlled by the listner actions and not by bumping into things, * or moving with gravity. */ AimToAttitudeLock = true; /* Normally * we want a player to shoot in the dirction of his attitude. */ cPolygon ppolygon = new cPolygon(3); /* Now make it a thin isoceles triangle, with the apex at the 0th vertex. * All that matters at first is the ratios of the numbers, as we will use * seRadius to make the thing the right size. */ ppolygon.setVertex(0, new cVector3(4.0f, 0.0f)); ppolygon.setVertex(1, new cVector3(0.0f, 1.0f)); ppolygon.setVertex(2, new cVector3(0.0f, -1.0f)); ppolygon.Radius = cCritter.PLAYERRADIUS; //Make it to a good size. Sprite = ppolygon; /* Normally the _prismdz will get changed to PLAYERPRISMDZ * by the cGame.setPlayer call */ PrismDz = cSprite.PLAYERPRISMDZ; }
public cCritter3DBoss(cGame pownergame = null) : base(pownergame) { if (pownergame != null) { rand = new Random(); BulletClass = new cCritterBulletRubber(); //Sets the boss sprite Sprite = new cSpriteQuake(ModelsMD2.Vegeta); setHealth(20); WrapFlag = cCritter.CLAMP; //Prevents boss from going through walls Armed = true; //Allows the character to use bullets MaxSpeed = cGame3D.MAXPLAYERSPEED; //sets max speed AbsorberFlag = true; //Keeps boss from being buffered out addForce(new cForceGravity(50.0f)); //gravity AttitudeToMotionLock = false; //First param determines direction facing (forward/backward) 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); AimToAttitudeLock = true; //aims in the direction of the attitude setMoveBox(_movebox); moveTo(new cVector3(_movebox.Midx, _movebox.Loy, _movebox.Midz + 2.0f)); //Sets the direction the boss is moving to the direction they are facing addForce(new cForceObjectSeek(Player, 3.0f)); _waitshoot = (float)rand.NextDouble(); setMoveBox(_movebox); } }
public cCritterWall(cVector3 enda, cVector3 endb, float thickness, cGame pownergame) : base(pownergame) { _pskeleton = null; _defaultfillcolor = WALLFILLCOLOR; initialize(enda, endb, thickness, WALLPRISMDZ, pownergame); }
public cCritter3DPlayer(cGame pownergame) : base(pownergame) { BulletClass = new cCritter3DPlayerBullet( ); Sprite = new cSphere(1.0f, 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 + 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. // YHopper hop strength 12.0 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); }
public ACDoc() { _pgame = null; setGameClass("cGame3D"); // I'm allowing for the programmer to // make some other game class, possibly, and put it here -- // if the programmer does this, they should derive it from cGame -- JC }
public cCritterShape(cGame pownergame) : base(pownergame) { FixedFlag = true; moveTo(new cVector3(_movebox.Midx, _movebox.Midy, _movebox.Midz)); rotate(new cSpin((float)Math.PI / 2.0f, new cVector3(1.0f, 0.0f, 0.0f))); }
public cCritter3Dcharacter(cGame pownergame) : base(pownergame) { _health = 2; addForce(new cForceObjectSeek(Player, 15.5f)); addForce(new cForceGravity(25.0f, new cVector3(0.0f, -1, 0.00f))); addForce(new cForceDrag(2.0f)); // default friction strength 0.5 Density = 2.0f; MaxSpeed = 30.0f; if (pownergame != null) //Just to be safe. { Sprite = new cSpriteQuake(Framework.models.selectRandomCritter()); } // example of setting a specific model // setSprite(new cSpriteQuake(ModelsMD2.Knight)); if (Sprite.IsKindOf("cSpriteQuake")) //Don't let the figurines tumble. { AttitudeToMotionLock = false; 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); /* Orient them so they are facing towards positive Z with heads towards Y. */ } Bounciness = 0.0f; //Not 1.0 means it loses a bit of energy with each bounce. setRadius(1.0f); MinTwitchThresholdSpeed = 4.0f; //Means sprite doesn't switch direction unless it's moving fast randomizePosition(new cRealBox3(new cVector3(_movebox.Lox, _movebox.Loy, _movebox.Loz + 4.0f), new cVector3(_movebox.Hix, _movebox.Loy, _movebox.Midz - 1.0f))); /* I put them ahead of the player */ randomizeVelocity(0.0f, 30.0f, false); if (pownergame != null) //Then we know we added this to a game so pplayer() is valid { addForce(new cForceObjectSeek(Player, 0.5f)); } int begf = Framework.randomOb.random(0, 171); int endf = Framework.randomOb.random(0, 171); if (begf > endf) { int temp = begf; begf = endf; endf = temp; } Sprite.setstate(State.Other, begf, endf, StateType.Repeat); _wrapflag = cCritter.BOUNCE; }
public cCritterBoss(cGame pownergame, cVector3 position, int model, cCritterBullet bullet, float firerate, int health) : base(pownergame) { addForce(new cForceGravity(25.0f, new cVector3(0.0f, -1, 0.00f))); addForce(new cForceDrag(20.0f)); // default friction strength 0.5 addForce(new CenteringForce()); Density = 2.0f; MaxSpeed = 30.0f; facing = false; if (pownergame != null) //Just to be safe. { Sprite = new cSpriteQuake(model); } // example of setting a specific model // setSprite(new cSpriteQuake(ModelsMD2.Knight)); if (Sprite.IsKindOf("cSpriteQuake")) //Don't let the figurines tumble. { AttitudeToMotionLock = false; 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); /* Orient them so they are facing towards positive Z with heads towards Y. */ } Bounciness = 0.0f; //Not 1.0 means it loses a bit of energy with each bounce. setRadius(1.0f); MinTwitchThresholdSpeed = 4.0f; //Means sprite doesn't switch direction unless it's moving fast moveTo(position); /* I put them ahead of the player */ randomizeVelocity(0.0f, 30.0f, false); int begf = Framework.randomOb.random(0, 171); int endf = Framework.randomOb.random(0, 171); if (begf > endf) { int temp = begf; begf = endf; endf = temp; } setTarget(Player); Sprite.setstate(State.Other, begf, endf, StateType.Repeat); BulletClass = bullet; WaitShoot = firerate; Health = health; _wrapflag = cCritter.BOUNCE; }
public cCritterWallGate(cVector3 moveToPosition, float moveSpeed, cVector3 enda, cVector3 endb, float thickness = THICKNESS, float height = WALLPRISMDZ, cGame pownergame = null) : base(enda,endb,thickness,height,pownergame) { _pskeleton = null; _defaultfillcolor = WALLFILLCOLOR; initialize(enda, endb, thickness, height, pownergame); _startPosition = _position; _moveToPosition = moveToPosition; _moveSpeed = moveSpeed; }
public void setGameClass(string str) { Framework.setRunspeed(1.0f); /* Restore this in case * you changed in a game constructor, like cGameSpacewarSun. */ _pgame = null; if (str == "cGame3D") { _pgame = new cGame3D(); } _pgame.seedCritters(); _pgame.processServiceRequests(); /* To process all the add requests made by * critter constructors in the construtor and the seedCritters call. */ }
public cCritterWank(cGame pownergame) : base(pownergame) { //Sets the sprite Sprite = new cSpriteQuake(ModelsMD2.Wank); WrapFlag = cCritter.CLAMP; //Prevent from going through walls MaxSpeed = cGame3D.MAXPLAYERSPEED; //sets max speed AbsorberFlag = true; //Keep from being buffered out addForce(new cForceGravity(50.0f)); //gravity AttitudeToMotionLock = false; //First param determines direction facing (forward/backward) 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); Sprite.setstate(State.Other, stateBegF, stateEndF, StateType.Repeat); }
public cBiota(cGame pgame = null) : base(delegate(out cCritter c1, cCritter c2) { c1 = c2; } ) { _pgame = pgame; _servicerequestlist = new LinkedList <cServiceRequest>( delegate(out cServiceRequest s1, cServiceRequest s2) { s1._pclient = s2._pclient; s1._request = s2._request; } ); }
public cCritter3DCharacterEnemy(cGame pownergame) : base(pownergame) { Sprite = new cSpriteQuake(ModelsMD2.Enemy); Sprite.setstate(State.Other, begf, endf, StateType.Repeat); WrapFlag = cCritter.CLAMP; //Prevents boss from going through walls Armed = false; //Allows the character to use bullets MaxSpeed = cGame3D.MAXPLAYERSPEED - 15.0f; //sets max speed AbsorberFlag = true; //Keeps boss from being buffered out addForce(new cForceGravity(50.0f)); //gravity AttitudeToMotionLock = false; 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); addForce(new cForceObjectSeek(Player, 3.0f)); AimToAttitudeLock = true; //aims in the direction of the attitude }
public cCritterTreasure(cGame pownergame, cVector3 position) : base(pownergame) { /* The sprites look nice from afar, but bitmap speed is really slow * when you get close to them, so don't use this. */ cPolygon ppoly = new cPolygon(24); ppoly.Filled = false; ppoly.LineWidthWeight = 0.5f; Sprite = ppoly; _collidepriority = cCollider.CP_PLAYER + 1; /* Let this guy call collide on the * player, as his method is overloaded in a special way. */ rotate(new cSpin((float)Math.PI / 2.0f, new cVector3(0.0f, 0.0f, 1.0f))); /* Trial and error shows this * rotation works to make it face the z diretion. */ setRadius(cGame3D.TREASURERADIUS); FixedFlag = true; moveTo(position); }
// 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)); }
public cCritterArmed(cGame pownergame = null) : base(pownergame) { _armed = true; _aimvector = new cVector3(0.0f, 1.0f); _ageshoot = 0.0f; _waitshoot = WAITSHOOT; _bshooting = false; _aimtoattitudelock = false; _gunlength = GUNLENGTH; BulletClass = new cCritterBulletRubber(); AimVector = _tangent; _bulletlist = new LinkedList <cCritterBullet>( delegate(out cCritterBullet c1, cCritterBullet c2) { c1 = c2; } ); }
public cCritterBoss(cGame pOwnerGame = null) : base(pOwnerGame) { MaxSpeed = 40; Health = 5; ForceList.RemoveAll(); ForceList.Add(new cForceBossMovement(150000.0f)); Sprite = new cSpriteQuake(ModelsMD2.Eva01); Radius = 3; moveTo(new cVector3(Game.Border.Midx, Game.Border.Loy, Game.Border.Midz)); Target = Game.Player; AimToAttitudeLock = false; //copyMotionMatrixToAttitudeMatrix(); AttitudeToMotionLock = false; BULLETRADIUS = 0.4f; setMoveBox(new cRealBox3(new cVector3(Game.Border.Lox, Game.Border.Loy, Game.Border.Loz + 3), new cVector3(Game.Border.Hix, Game.Border.Hiy, Game.Border.Hiz - 3))); //set upright rotateAttitude(new cSpin((float)Math.PI * 3f / 2f, new cVector3(1, 0, 0))); //set looking left rotateAttitude(new cSpin((float)Math.PI * 3f / 2f, new cVector3(0, 0, 1))); _dead = false; }
public cCritterInvisibleWall(cVector3 enda, cVector3 endb, float thickness = THICKNESS, float height = WALLPRISMDZ, cGame pownergame = null) : base(enda, endb, thickness, height, pownergame) { Sprite = new cSpriteComposite(); }
public cCritterMinion(cGame pOwnerGame) : base(pOwnerGame) { ForceList.Add(new cForceMinionMovement(pOwnerGame.Player)); Sprite = new cSpriteQuake(ModelsMD2.Hunter); Sprite.Radius = 1; }
public cCritterDoor(cVector3 enda, cVector3 endb, float thickness, float height, cGame pownergame) : base(enda, endb, thickness, height, pownergame) { }
public DamagingWall(cVector3 enda, cVector3 endb, float thickness, float height, cGame pownergame) : base(enda, endb, thickness, height, pownergame) { }
public cCritterWallClosingDoor(cVector3 enda, cVector3 endb, float thickness = THICKNESS, float height = WALLPRISMDZ, cGame pownergame = null) : base(enda, endb, thickness, height, pownergame) { closingFrame = 0; roll((float)Math.PI / 2); }
//Sets critters wrapflags. public void setGame(cGame pgame) { _pgame = pgame; }
public cCritterMedpack(cGame pownergame, cVector3 position) : base(pownergame, position) { }
public cCritterMedpack(cGame pownergame) : base(pownergame) { }
public void initialize(cVector3 enda, cVector3 endb, float thickness, float height, cGame pownergame) { _defaultprismdz = height; //Used if cSprite is a cShape FixedFlag = true; /* By default a wall is fixed; * remember this if you want to use one for a paddle. */ _collidepriority = cCollider.CP_WALL; /* Don't use * the setCollidePriority mutator, as that * forces a call to pgame()->buildCollider(); */ _wrapflag = cCritter.WRAP; /* In case a wall extends * across the _border, don't bounce it. Note that * we have overloaded setWrap so you can't turn * off the WRAP */ setEndsThicknessHeight(enda, endb, thickness, _defaultprismdz); }
public ACDoc() { _pgame = null; setGameClass("cGame3D"); // I'm allowing for the programmer to }
public cCritterPlayer(cGame pownergame = null) : base(pownergame) { _bshooting = false; }
//function to be passed into the thread that walls are spawned in //this allows us to wait a few seconds before spawning walls in order to maintain a gap between them. public void spawnWall(cVector3 enda, cVector3 endb, float thickness, float height, cGame pownergame, cCritterSlideWall.TYPE wallType, cVector3 moveAxisAndDirection, bool bounce, cVector3 startPos, cVector3 endPos) { int numWalls = 3; float spawnPos = 10; //position the ith wall must reach before the (i + 1)th wall spawns //spawn the first wall cCritterSlideWall wall = new cCritterSlideWall(enda, endb, thickness, height, pownergame, wallType, moveAxisAndDirection, bounce, startPos, endPos); cSpriteTextureBox spriteBox = new cSpriteTextureBox(wall.Skeleton, BitmapRes.Wood2, 16); wall.Sprite = spriteBox; //spawn the remaining walls for (int i = 0; i < numWalls - 1; i++) { //wait until the previous wall reaches the spawn position while (wall.Position.Z > spawnPos) { ; } //spawn the wall and add textures. wall = new cCritterSlideWall(enda, endb, thickness, height, pownergame, wallType, moveAxisAndDirection, bounce, startPos, endPos); spriteBox = new cSpriteTextureBox(wall.Skeleton, BitmapRes.Wood2, 16); wall.Sprite = spriteBox; } }
public cCritterArmedRobot(cGame pownergame = null) : base(pownergame) { _bshooting = true; //Assume enemy shoots whenever time is up. WaitShoot = _waitshoot; }