示例#1
0
        public Player(PlayArea a_playArea, Hashtable a_htDefaultKeys)
        {
            m_playArea = a_playArea;
            MemberName = "Cross";

            m_arrow = new Sprite();
            m_arrow.Parent = this;
            m_arrow.Name = "Arrow";
            m_arrow.MemberName = "Cross";
            m_arrow.Member.CenterRegPoint();
            m_arrow.Member = m_arrow.Member;
            m_arrow.LocZ = 60;
            //m_arrow.Loc = m_playArea.Grid.GetGfxLocFromGridLoc(m_playArea.Grid.GetGridStartLoc());

            if (a_htDefaultKeys.Count == 0)
            {
                a_htDefaultKeys = new Hashtable();
                a_htDefaultKeys.Add("left", Keys.Left);
                a_htDefaultKeys.Add("right", Keys.Right);
                a_htDefaultKeys.Add("up", Keys.Up);
                a_htDefaultKeys.Add("shoot", Keys.Down);
            }
            m_keysSteering = new KeysSteering(a_htDefaultKeys);
            m_keysSteering.AddPair("left", "right");
            m_keysSteering.KeyEvent += new Endogine.KeyEventHandler(m_keysSteering_KeyEvent);

            m_score = new Score();

            m_spTarget = new Sprite();
            m_spTarget.MemberName = "Cross";
            m_spTarget.CenterRegPoint();
            m_spTarget.Blend = 50;
            m_spTarget.Parent = m_playArea;
            m_spTarget.LocZ = 50;
        }
示例#2
0
        public StepXY()
        {
            InitializeComponent();

            keysSteering = new KeysSteering();
            keysSteering.AddActionAndKey("left", Keys.Left);
            keysSteering.AddActionAndKey("right", Keys.Right);
            keysSteering.AddActionAndKey("up", Keys.Up);
            keysSteering.AddActionAndKey("down", Keys.Down);
            keysSteering.ReceiveFormsControlKeys(textBox1);
            keysSteering.NoReceiveEndogineKeys();
            keysSteering.KeyEvent+=new KeyEventHandler(keysSteering_KeyEvent);
        }
示例#3
0
        public StepXY()
        {
            InitializeComponent();

            keysSteering = new KeysSteering();
            keysSteering.AddActionAndKey("left", Keys.Left);
            keysSteering.AddActionAndKey("right", Keys.Right);
            keysSteering.AddActionAndKey("up", Keys.Up);
            keysSteering.AddActionAndKey("down", Keys.Down);
            keysSteering.ReceiveFormsControlKeys(textBox1);
            keysSteering.NoReceiveEndogineKeys();
            keysSteering.KeyEvent += new KeyEventHandler(keysSteering_KeyEvent);
        }
示例#4
0
        public Player(GameMain a_gameMain)
        {
            m_gameMain = a_gameMain;

            this.Name = "Player";
            m_fAngleStep = (float)(5.0*Math.PI/180);
            MemberName = "Ship";
            this.RegPoint = (this.Member.Size.ToEPointF()*0.5f).ToEPoint();

            #region Set up particle system (for thrusters)
            m_particleSystem = new Endogine.ParticleSystem.ParticleEmitter();
            //m_particleSystem.Parent = this;
            m_particleSystem.LocZ = LocZ-1;

            SortedList aColors = new SortedList();
            aColors.Add(0.0, System.Drawing.Color.FromArgb(255,255,0));
            aColors.Add(0.5, System.Drawing.Color.FromArgb(255,0,0));
            aColors.Add(1.0, System.Drawing.Color.FromArgb(0,0,0));
            m_particleSystem.SetColorList(aColors);

            SortedList aSizes = new SortedList();
            aSizes.Add(0.0, 1.0);
            aSizes.Add(1.0, 0.0);
            m_particleSystem.SetSizeList(aSizes);

            m_particleSystem.MaxParticles = 100;
            m_particleSystem.NumNewParticlesPerFrame = 0;

            m_fThrustParticles = 2;

            m_particleSystem.Gravity = 0;
            m_particleSystem.Speed = 5;
            m_particleSystem.SizeFact = 0.3f;

            m_particleSystem.ParticlePicRef = PicRef.GetOrCreate("Particle");
            m_particleSystem.SourceRect = new ERectangle(0,0,10,10);
            m_particleSystem.RegPoint = new EPoint(5,5);
            m_particleSystem.LocZ = 100;
            #endregion

            #region Keys setup
            m_keysSteering = new KeysSteering();
            this.m_keysSteering.AddKeyPreset(KeysSteering.KeyPresets.ArrowsSpace);
            this.m_keysSteering.AddKeyPreset(KeysSteering.KeyPresets.awsdCtrlShift);
            this.m_keysSteering.AddPair("left", "right");
            this.m_keysSteering.AddPair("up", "down");
            //m_keysSteering.ReceiveEndogineKeys(m_endogine);
            m_keysSteering.KeyEvent+=new KeyEventHandler(m_keysSteering_KeyEvent);
            #endregion
        }
示例#5
0
        private PlayerShot m_shot; //only allow one shot at a time!

        #endregion Fields

        #region Constructors

        public Player()
        {
            this.Color = GameMain.Instance.m_clrOffwhite;

            this.m_keys = new KeysSteering(KeysSteering.KeyPresets.ArrowsSpace);
            this.m_keys.AddKeyPreset(KeysSteering.KeyPresets.awsdCtrlShift);
            this.m_keys.KeyEvent+=new KeyEventHandler(m_keys_KeyEvent);

            this.SetGraphics("Player");
            this.CenterRegPoint();

            ERectangleF rct = ERectangleF.FromLTRB(145,418,495,419);
            Endogine.GameHelpers.BhConstrain bh = new Endogine.GameHelpers.BhConstrain();
            bh.AddArea(rct, null, false, null);
            this.AddBehavior(bh);
        }
示例#6
0
        public Car()
        {
            this._carType = new CarType();
            this._carType.CenterOfMassToFront  = 1;                                                                    //2.5f;
            this._carType.CenterOfMassToRear   = 1;                                                                    // 1.5f;
            this._carType.CenterOfMassToGround = 1;                                                                    // 0.5f;
            this._carType.Wheelbase            = this._carType.CenterOfMassToFront + this._carType.CenterOfMassToRear; //2f;
            this._carType.Mass        = 1500;
            this._carType.Inertia     = 1500;
            this._carType.Width       = 1.5f; // 2;
            this._carType.Length      = 3;    // 4.5f;
            this._carType.WheelLength = 0.7f;
            this._carType.WheelWidth  = 0.3f;

            this._environment                  = new Environment();
            this._environment.Drag             = 5;
            this._environment.Resistance       = 30;
            this._environment.CornerStiffnessR = -5.2f;
            this._environment.CornerStiffnessF = -5.0f;
            this._environment.MaxGrip          = 2;

            float    size = 5;
            Bitmap   bmp  = new Bitmap((int)(this._carType.Width * size), (int)(this._carType.Length * size), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics g    = Graphics.FromImage(bmp);

            g.FillRectangle(new SolidBrush(Color.Red), new Rectangle(0, 0, bmp.Width, bmp.Height));
            g.FillRectangle(new SolidBrush(Color.Blue), new Rectangle(0, 3 * bmp.Height / 4, bmp.Width, bmp.Height / 4));
            g.Dispose();
            MemberSpriteBitmap mb = new MemberSpriteBitmap(bmp);

            this.Member = mb;

            this._keys = new KeysSteering(Endogine.KeysSteering.KeyPresets.ArrowsSpace);
            this._keys.AddKeyPreset(KeysSteering.KeyPresets.awsdCtrlShift);
            this._keys.ReceiveEndogineKeys(null);
        }
        public Car()
        {
            this._carType = new CarType();
            this._carType.CenterOfMassToFront = 1; //2.5f;
            this._carType.CenterOfMassToRear = 1; // 1.5f;
            this._carType.CenterOfMassToGround = 1; // 0.5f;
            this._carType.Wheelbase = this._carType.CenterOfMassToFront + this._carType.CenterOfMassToRear; //2f;
            this._carType.Mass = 1500;
            this._carType.Inertia = 1500;
            this._carType.Width = 1.5f; // 2;
            this._carType.Length = 3; // 4.5f;
            this._carType.WheelLength = 0.7f;
            this._carType.WheelWidth = 0.3f;

            this._environment = new Environment();
            this._environment.Drag = 5;
            this._environment.Resistance = 30;
            this._environment.CornerStiffnessR = -5.2f;
            this._environment.CornerStiffnessF = -5.0f;
            this._environment.MaxGrip = 2;

            float size = 5;
            Bitmap bmp = new Bitmap((int)(this._carType.Width * size), (int)(this._carType.Length * size), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            Graphics g = Graphics.FromImage(bmp);
            g.FillRectangle(new SolidBrush(Color.Red), new Rectangle(0, 0, bmp.Width, bmp.Height));
            g.FillRectangle(new SolidBrush(Color.Blue), new Rectangle(0, 3 * bmp.Height / 4, bmp.Width, bmp.Height / 4));
            g.Dispose();
            MemberSpriteBitmap mb = new MemberSpriteBitmap(bmp);
            this.Member = mb;

            this._keys = new KeysSteering(Endogine.KeysSteering.KeyPresets.ArrowsSpace);
            this._keys.AddKeyPreset(KeysSteering.KeyPresets.awsdCtrlShift);
            this._keys.ReceiveEndogineKeys(null);
        }