public Ship(float spawnPosX, float spawnPosY, float spawnRotation, Texture2D shipTexture) { pos = new Vector2(spawnPosX, spawnPosY); rotation = spawnRotation; xVel = 0; yVel = 0; acceleration = 5; maxSpeed = 20; texture = shipTexture; radius = Math.Max(shipTexture.Height, shipTexture.Width) / 2; faction = Faction.Team2; weapon = new Weapon(this, 0, 0, 0, new Texture2D(0, 0, 0), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserRed01.png", true, false), 0, 0); weapon.setAttackSpeed(.2f); }
public PlayerShip(float spawnPosX, float spawnPosY, float spawnRotation, Texture2D shipTexture, Texture2D bulletTexture, View view) { faction = Faction.Team1; pos = new Vector2(spawnPosX, spawnPosY); rotation = spawnRotation; xVel = 0; yVel = 0; acceleration = 3; maxSpeed = 10; texture = shipTexture; this.bulletTexture = bulletTexture; this.view = view; radius = Math.Max(shipTexture.Height, shipTexture.Width) / 2; weapons = new List <Weapon>(); //weapons.Add(new Weapon(this, -20,15 , 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun09.png", false,false), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserBlue01.png",true, false),2,20)); //weapons.Add(new Shotgun(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun04.png", false, false), SpriteDrawer.LoadTexture("PNG\\Lasers\\laserGreen13.png", true, false), 2, 20)); //weapons.Add(new MissileLauncher(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun07.png", false, false), SpriteDrawer.LoadTexture("PNG\\Sprites X2\\Missiles\\spaceMissiles_013.png", true, false), 2, 5)); weapon1 = new MissileLauncher(this, -20, 15, 0, SpriteDrawer.LoadTexture("PNG\\Parts\\gun07.png", false, false), SpriteDrawer.LoadTexture("PNG\\Sprites X2\\Missiles\\spaceMissiles_013.png", true, false), 2, 5); }
protected override void OnLoad(System.EventArgs e) { Noesis.GUI.Init(); //EmbeddedXaml[] xamls = new EmbeddedXaml[] //{ // new EmbeddedXaml { filename = "Reflections.xaml", resource = "Reflections" } //}; //Noesis.GUI.SetXamlProvider(new LocalXamlProvider(".")); // Data loading Noesis.GUI.SetXamlProvider(new NoesisApp.LocalXamlProvider(".")); //Noesis.Grid xaml = (Noesis.Grid)Noesis.GUI.LoadXaml("UI\\UItest0.xaml"); xaml = new Noesis.Grid(); Noesis.GUI.LoadComponent(xaml, "UI\\UItest03.xaml"); //MyGrid xaml = new MyGrid(); Noesis.StackPanel sp = (Noesis.StackPanel)xaml.FindName("BottomMenu"); sp.DataContext = new ViewModel(); Noesis.Button button = (Noesis.Button)xaml.FindName("button"); button.Click += (object sender, Noesis.RoutedEventArgs args) => { System.Console.WriteLine("Button was clicked"); }; // create view nView = Noesis.GUI.CreateView(xaml); nView.SetSize(this.Width, this.Height); // get OpenGL rendering device Noesis.RenderDevice device = new Noesis.RenderDeviceGL(); // init renderer as OpenGL renderer = nView.Renderer; renderer.Init(device); nView.Update(0.001); // Ensures view is updated before first render call (avoids crash) CursorVisible = true; mousePos = new Vector2(this.PointToClient(new Point(Mouse.GetCursorState().X, Mouse.GetCursorState().Y)).X, this.PointToClient(new Point(Mouse.GetCursorState().X, Mouse.GetCursorState().Y)).Y); Input.mousePosition = mousePos; //GL.Disable() GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); spritedrawer = new SpriteDrawer(view); cursorTexture = SpriteDrawer.LoadTexture("PNG\\crosshair010.png", true, false); texture = SpriteDrawer.LoadTexture("PNG\\playerShip1_red.png", true, false); player = new PlayerShip(0, 0, 0, texture, SpriteDrawer.LoadTexture("PNG\\Lasers\\laserBlue01.png", true, false), view); enemyAI = new AI(spaceObjects, player); Ship enemy1 = new Ship(200, 200, 0, SpriteDrawer.LoadTexture("PNG\\ufoBlue.png", true, false)); player.setTarget(enemy1); enemyAI.takeControl(enemy1); spaceObjects.Add(enemy1); Closed += OnClosed; }