Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public Player()
        {
            this.MemberName = "CaveShip";
            this.Velocity  += new EPointF(2, 0);
            this.LocZ       = 10;
            float[] wallsY = GameMain.Instance.CaveWalls.GetWallsYOnX(0);
            this.LocY = wallsY[0] + 30;

            m_keysSteering = new KeysSteering();
            m_keysSteering.AddActionAndKey("up", System.Windows.Forms.Keys.Up);
            m_keysSteering.AddActionAndKey("up", System.Windows.Forms.Keys.W);
            m_keysSteering.KeyEvent += new KeyEventHandler(m_keysSteering_KeyEvent);
        }
Ejemplo n.º 3
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
        }
Ejemplo n.º 4
0
        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);
        }