protected override void init(params Object[] param) { Position = (Vector2)param[0]; Direction = (Vector2)param[1]; Owner = (Ship)param[2]; Speed = 10; Team = Owner.Team; Image = generateImage(); }
protected override void Initialize() { #if DEBUG Components.Add(new CompteurFPS(this)); #endif components = new List<Obj>(); waitingComponents = new List<Obj>(); level = 1; teamColor = new Color[] { Color.Blue, Color.Red, Color.Green, Color.Yellow, Color.Pink, Color.Orange, Color.Violet, Color.Silver }; Keys[] controls = new Keys[5]; controls[(int)Controls.Up] = Keys.Up; controls[(int)Controls.Down] = Keys.Down; controls[(int)Controls.Left] = Keys.Left; controls[(int)Controls.Right] = Keys.Right; controls[(int)Controls.Fire] = Keys.Space; Ship s = new Ship(4, "Fleches-Espace", 0, controls, new Vector2(Window.ClientBounds.Width / 2 - 150, Window.ClientBounds.Height / 2)); AddComponent(s); Components.Add(new ShowPlayer(this, s, Vector2.Zero)); Keys[] ctrl = new Keys[5]; ctrl[(int)Controls.Up] = Keys.Z; ctrl[(int)Controls.Down] = Keys.S; ctrl[(int)Controls.Left] = Keys.Q; ctrl[(int)Controls.Right] = Keys.D; ctrl[(int)Controls.Fire] = Keys.A; Ship s2 = new Ship(4, "ZQSDA", 0, ctrl, new Vector2(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2)); AddComponent(s2); Components.Add(new ShowPlayer(this, s2, Vector2.UnitY * 20)); Keys[] ccc = new Keys[5]; ccc[(int)Controls.Up] = Keys.NumPad8; ccc[(int)Controls.Down] = Keys.NumPad2; ccc[(int)Controls.Left] = Keys.NumPad4; ccc[(int)Controls.Right] = Keys.NumPad6; ccc[(int)Controls.Fire] = Keys.NumPad5; Ship s3 = new Ship(4, "NumPad", 0, ccc, new Vector2(Window.ClientBounds.Width / 2 + 150, Window.ClientBounds.Height / 2)); AddComponent(s3); Components.Add(new ShowPlayer(this, s3, Vector2.UnitY * 40)); base.Initialize(); }
public Bullet(Vector2 position, Vector2 direction, Ship ship) : base(new Object[] {position, direction, ship}) { }
public ShowPlayer(Game game, Ship ship, Vector2 position) : base(game) { this.ship = ship; this.position = position; }