Changeset 5248 for 2014/27


Ignore:
Timestamp:
2014-07-01 14:57:28 (5 years ago)
Author:
mijoliim
Message:
 
Location:
2014/27/MikkoL/LM2/LM2
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2014/27/MikkoL/LM2/LM2/LM2/LM2.cs

    r5191 r5248  
    4747        : base(width, height) { } 
    4848} 
     49class backborder : PhysicsObject 
     50{ 
     51 
     52    public backborder(double width, double height) 
     53        : base(width, height) { } 
     54} 
     55 
    4956public class LM2 : PhysicsGame 
    5057{ 
    51     player player = new player(7, 7); 
     58    player player = new player(5, 5); 
     59    PhysicsObject playership = new PhysicsObject(37, 48); 
    5260    double player_speed = 400; 
    5361    Vector stagespeed = new Vector(-500,0); 
    5462 
    55     //Graphics 
    56  
     63    bool BlazeIt = false; 
     64 
     65    //Player 
     66    Image player_ship_01 = LoadImage("player_ship_01"); 
    5767    //Bullets 
    5868    Image bullet_green_laser01 = LoadImage("bullet_green_laser01"); 
    5969    Image bullet_player = LoadImage("bullet_player"); 
     70    //Enemies 
     71    Image enemy_ship_01 = LoadImage("enemy_ship_01"); 
     72    Image enemy_ship_01_red = LoadImage("enemy_ship_01_red"); 
    6073 
    6174    //Weapon 
     
    7386 
    7487        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    75  
    76  
    7788 
    7889        CreateLevel("level_test"); 
     
    110121        Level.Background.Color = Color.LightGray; 
    111122        Timer strobeBg = new Timer(); 
    112         strobeBg.Interval = 0.001; 
     123        strobeBg.Interval = 0.005; 
    113124        strobeBg.Timeout += delegate { 
    114125            Level.Background.Color = RandomGen.NextColor(); 
    115126        }; 
    116         strobeBg.Start(); 
     127        if (BlazeIt) strobeBg.Start(); 
    117128 
    118129        TileMap lvl = TileMap.FromLevelAsset(level); 
     
    122133        lvl.SetTileMethod('P', AddPlayer); 
    123134        lvl.SetTileMethod('1', enemy_ship_1); 
     135        lvl.SetTileMethod('R', enemy_ship_1_red); 
    124136        lvl.Execute(35, 35); 
    125137 
     
    133145 
    134146        Camera.Position = player.Position; 
     147        //Camera.ZoomFactor = 0.5; 
    135148       //edgeBorders(); 
    136149    } 
     
    143156        border.KineticFriction = 0; 
    144157        border.StaticFriction = 0; 
    145         border.Color = Color.Red; 
     158        border.Color = Color.Lighter(Color.Black, 20); 
    146159        border.Tag = "border"; 
    147160        Add(border, 1); 
     
    152165        border2.KineticFriction = 0; 
    153166        border2.StaticFriction = 0; 
    154         border2.Color = Color.Green; 
     167        border2.Color = Color.Lighter(Color.Black, 20); 
    155168        border2.Tag = "border"; 
    156169        Add(border2, 0); 
    157170 
    158171        Timer strobe = new Timer(); 
    159         strobe.Interval = 0.001; 
     172        strobe.Interval = 0.005; 
    160173        strobe.Timeout += delegate { 
    161             //if (border.Color == Color.Red) 
    162             //{ 
    163             //    border.Color = Color.Green; 
    164             //    border2.Color = Color.Red; 
    165             //} 
    166             //else if (border.Color == Color.Green) 
    167             //{ 
    168             //    border.Color = Color.Red; 
    169             //    border2.Color = Color.Green; 
    170             //} 
    171174            border.Color = RandomGen.NextColor(); 
    172175            border2.Color = RandomGen.NextColor(); 
    173176        }; 
    174         strobe.Start(); 
     177        if (BlazeIt) strobe.Start(); 
    175178    } 
    176179    void frontBorder(Vector position, double width, double height) 
     
    189192    void backBorder(Vector position, double width, double height) 
    190193    { 
    191         PhysicsObject border = PhysicsObject.CreateStaticObject(width, height); 
     194        backborder border = new backborder(width, height); 
    192195        border.Position = position; 
    193196        border.Color = Color.White; 
     
    195198        border.Tag = "border"; 
    196199        border.IgnoresCollisionResponse = true; 
     200        border.IgnoresCollisionResponse = true; 
    197201        AddCollisionHandler<PhysicsObject, player>(border, backBorderCollision); 
    198         AddCollisionHandler<PhysicsObject, enemy>(border, backBorderCollisionEnemy); 
     202        //AddCollisionHandler<PhysicsObject, enemy>(border, backBorderCollisionEnemy); 
    199203        Add(border); 
    200204    } 
     
    229233    { 
    230234        player.Shape = Shape.Circle; 
     235        player.Color = Color.Red; 
     236        player.MomentOfInertia = 10; 
    231237        player.Restitution = 0; 
    232238        player.Mass = int.MaxValue; 
     
    236242        player.IgnoresGravity = true; 
    237243        player.Position = pos; 
     244        player.Tag = "player1"; 
    238245        Add(player,2); 
    239246 
    240247        Timer strobePlr = new Timer(); 
    241         strobePlr.Interval = 0.001; 
     248        strobePlr.Interval = 0.005; 
    242249        strobePlr.Timeout += delegate { player.Color = RandomGen.NextColor(); }; 
    243         strobePlr.Start(); 
     250        if (BlazeIt) strobePlr.Start(); 
     251 
     252        playership.Image = player_ship_01; 
     253        playership.IgnoresCollisionResponse = true; 
     254        playership.IgnoresPhysicsLogics = true; 
     255        playership.Angle = Angle.FromDegrees(-90); 
     256        playership.CanRotate = false; 
     257        //playership.Parent = player; 
     258        playership.Position = player.Position; 
     259 
     260        FollowerBrain playershipbrain = new FollowerBrain(player); 
     261        playershipbrain.Speed = 500; 
     262        playershipbrain.DistanceFar = 5000; 
     263        playershipbrain.DistanceClose = 0; 
     264        playershipbrain.StopWhenTargetClose = true; 
     265        playershipbrain.Active = true; 
     266        playershipbrain.TurnWhileMoving = false; 
     267 
     268        playership.Brain = playershipbrain; 
     269        Add(playership, -2); 
    244270    } 
    245271    void AddHealthbar() 
     
    255281 
    256282        Timer strobehpBar = new Timer(); 
    257         strobehpBar.Interval = 0.001; 
     283        strobehpBar.Interval = 0.005; 
    258284        strobehpBar.Timeout += delegate { healthBar.BarColor = RandomGen.NextColor(); }; 
    259         strobehpBar.Start(); 
     285        if (BlazeIt) strobehpBar.Start(); 
    260286    } 
    261287    void AddControls() 
    262     { 
    263         //ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, null); 
     288 
     289    { 
     290        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, null); 
    264291        ControllerOne.ListenAnalog(AnalogControl.LeftStick, -0.1, move, null); 
    265292 
     
    282309    void shoot() 
    283310    { 
    284         wpn_timer.Stop(); 
     311        //wpn_timer.Stop(); 
    285312        wpn_timer.Interval = wpn_shootRate; 
    286313 
     
    289316    void setwpn_timer() 
    290317    { 
    291         wpn_timer.Timeout += delegate 
    292         { 
    293             if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 
     318            wpn_timer.Timeout += delegate 
     319        { 
     320            if (!player.IsDestroyed) 
    294321            { 
    295                 Weapon(); 
    296                 wpn_timer.Interval = wpn_shootRate; 
    297             } 
     322                if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 
     323                { 
     324                    Weapon(); 
     325                    wpn_timer.Interval = wpn_shootRate; 
     326                } 
     327            }; 
    298328        }; 
    299329    } 
     
    321351            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    322352            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    323             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    324             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     353            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 20), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     354            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -20), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    325355        } 
    326356        else if (wpn_spread.Value == 4) 
     
    334364        else if (wpn_spread.Value == 5) 
    335365        { 
    336             Projectile(player.Position + new Vector(10, 5), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    337             Projectile(player.Position + new Vector(10, -5), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    338  
    339             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    340             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    341  
    342             Projectile(player.Position + new Vector(10, 25), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    343             Projectile(player.Position + new Vector(10, -25), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     366            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     367            Projectile(player.Position + new Vector(10, -0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     368 
     369            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     370            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     371 
     372            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 55), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     373            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -55), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    344374        } 
    345375        else if (wpn_spread.Value == 6) 
    346376        { 
     377            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     378            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     379            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     380            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     381            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     382 
     383            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     384            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     385        } 
     386        else if (wpn_spread.Value == 7) 
     387        { 
     388            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     389            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     390            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     391            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     392 
     393            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     394            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     395 
     396            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     397            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     398        } 
     399        else if (wpn_spread.Value == 8) 
     400        { 
     401            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     402            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     403            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    347404            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    348405            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    349             Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     406 
     407            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     408            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     409 
    350410            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    351411            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    352  
    353             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    354             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    355         } 
    356         else if (wpn_spread.Value == 7) 
    357         { 
    358             Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    359             Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    360             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    361             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    362  
    363             Projectile(player.Position + new Vector(10, 20), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    364             Projectile(player.Position + new Vector(10, -20), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    365  
    366             Projectile(player.Position + new Vector(10, 30), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    367             Projectile(player.Position + new Vector(10, -30), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    368         } 
    369         else if (wpn_spread.Value == 8) 
    370         { 
    371             Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    372             Projectile(player.Position + new Vector(10, 5), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    373             Projectile(player.Position + new Vector(10, -5), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    374             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    375             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    376  
    377             Projectile(player.Position + new Vector(10, 20), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    378             Projectile(player.Position + new Vector(10, -20), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    379  
    380             Projectile(player.Position + new Vector(10, 30), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    381             Projectile(player.Position + new Vector(10, -30), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    382412        } 
    383413        else if (wpn_spread.Value == 9) 
    384414        { 
    385             Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    386             Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    387             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    388             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    389  
    390             Projectile(player.Position + new Vector(10, 20), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    391             Projectile(player.Position + new Vector(10, -20), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    392  
    393             Projectile(player.Position + new Vector(10, 30), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    394             Projectile(player.Position + new Vector(10, -30), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    395  
    396             Projectile(player.Position + new Vector(10, 40), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    397             Projectile(player.Position + new Vector(10, -40), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    398         } 
    399         else if (wpn_spread.Value == 10) 
    400         { 
    401             Projectile(player.Position + new Vector(10, 5), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    402             Projectile(player.Position + new Vector(10, -5), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    403             Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     415            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     416            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     417            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     418            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -15), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     419 
     420            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     421            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     422 
    404423            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    405424            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    406425 
    407             Projectile(player.Position + new Vector(10, 15), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    408             Projectile(player.Position + new Vector(10, -15), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    409  
    410             Projectile(player.Position + new Vector(10, 20), new Vector(1200, 100), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    411             Projectile(player.Position + new Vector(10, -20), new Vector(1200, -100), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    412  
    413             Projectile(player.Position + new Vector(10, 25), new Vector(1200, 125), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    414             Projectile(player.Position + new Vector(10, -25), new Vector(1200, -125), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     426            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     427            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     428        } 
     429        else if (wpn_spread.Value == 10) 
     430        { 
     431            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     432            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     433            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     434            Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     435            Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     436 
     437            Projectile(player.Position + new Vector(10, 5), new Vector(1200, 75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     438            Projectile(player.Position + new Vector(10, -5), new Vector(1200, -75), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     439 
     440            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 100), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     441            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -100), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     442 
     443            Projectile(player.Position + new Vector(10, 10), new Vector(1200, 125), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
     444            Projectile(player.Position + new Vector(10, -10), new Vector(1200, -125), new Vector(40, 12), Color.LightBlue, "bullet", Shape.Rectangle); 
    415445        } 
    416446    } 
     
    418448    { 
    419449        bullet projectile = new bullet(size.X, size.Y); 
    420         projectile.Shape = shape; 
     450        projectile.Shape = Shape.Diamond; 
    421451        projectile.Color = color; 
    422452        projectile.IgnoresGravity = true; 
    423453        projectile.Position = pos; 
    424454        projectile.Tag = "player_bullet"; 
    425         //projectile.Image = bullet_player; 
     455        if (!BlazeIt) projectile.Image = bullet_player; 
    426456        projectile.damage = wpn_damageRatio; 
    427457            projectile.IgnoresCollisionResponse = true; 
    428458 
    429459        projectile.CollisionIgnoreGroup = 2; 
    430         projectile.MaximumLifetime = TimeSpan.FromSeconds(1); 
     460        projectile.MaximumLifetime = TimeSpan.FromSeconds(1.57); 
     461 
    431462        //AddCollisionHandler(projectile, "border", destroy); 
    432  
     463        AddCollisionHandler<bullet, frontborder>(projectile, destroy); 
    433464        AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); 
    434465 
     
    437468        projectile.Angle = projectile.Velocity.Angle; 
    438469 
    439         //projectile.OscillateAngle(1, Ra, 2,1); 
    440         projectile.Angle = RandomGen.NextAngle(); 
    441         projectile.AngularVelocity = RandomGen.NextDouble(-1000,1000); 
     470 
    442471        Timer strobe = new Timer(); 
    443         strobe.Interval = 0.001; 
     472        strobe.Interval = 0.005; 
    444473        strobe.Timeout += delegate { 
    445474            projectile.Color = RandomGen.NextColor(); 
     475            if (projectile.IsDestroyed) strobe.Stop(); 
    446476        }; 
    447         strobe.Start(3000); 
     477        if (BlazeIt) strobe.Start(); 
    448478    } 
    449479 
     
    457487        enemyship.IgnoresCollisionResponse = true; 
    458488        enemyship.health.MaxValue = 8; 
     489        enemyship.Image = enemy_ship_01; 
    459490 
    460491        Add(enemyship); 
    461         enemyship.Hit(stagespeed*1); 
     492        enemyship.Hit(stagespeed); 
    462493        AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); 
    463  
     494        AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_1_frontborder); 
     495    } 
     496    void enemy_ship_1_frontborder(enemy enemyship, frontborder border) 
     497    { 
     498        enemyship.LifetimeLeft = TimeSpan.FromSeconds(4); 
     499    } 
     500    void enemy_ship_1_red(Vector pos, double width, double height) 
     501    { 
     502        enemy enemyship = new enemy(70, 35); 
     503        enemyship.Shape = Shape.Circle; 
     504        enemyship.Color = Color.Black; 
     505        enemyship.Position = pos; 
     506        enemyship.IgnoresCollisionResponse = true; 
     507        enemyship.health.MaxValue = 8; 
     508        enemyship.Image = enemy_ship_01_red; 
     509 
     510        Add(enemyship); 
     511        enemyship.Hit(stagespeed); 
     512        AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); 
     513        AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_1_red_frontborder); 
     514    } 
     515    void enemy_ship_1_red_frontborder(enemy enemyship, frontborder border) 
     516    { 
     517        if (!enemyship.canShoot) 
     518        { 
     519            enemyship.Angle = Angle.FromDegrees(180); 
     520            enemyship.Velocity = -stagespeed; 
     521            enemyship.Position = new Vector(border.X-1400, enemyship.Position.Y); 
     522            enemyship.LifetimeLeft = TimeSpan.FromSeconds(4); 
     523 
     524            enemyship.canShoot = true; 
     525        }; 
    464526    } 
    465527 
  • 2014/27/MikkoL/LM2/LM2/LM2Content/LM2Content.contentproj

    r5191 r5248  
    8080    </Compile> 
    8181  </ItemGroup> 
     82  <ItemGroup> 
     83    <Compile Include="enemy_ship_01.png"> 
     84      <Name>enemy_ship_01</Name> 
     85      <Importer>TextureImporter</Importer> 
     86      <Processor>TextureProcessor</Processor> 
     87    </Compile> 
     88  </ItemGroup> 
     89  <ItemGroup> 
     90    <Compile Include="enemy_ship_01_red.png"> 
     91      <Name>enemy_ship_01_red</Name> 
     92      <Importer>TextureImporter</Importer> 
     93      <Processor>TextureProcessor</Processor> 
     94    </Compile> 
     95  </ItemGroup> 
     96  <ItemGroup> 
     97    <Compile Include="player_ship_01.png"> 
     98      <Name>player_ship_01</Name> 
     99      <Importer>TextureImporter</Importer> 
     100      <Processor>TextureProcessor</Processor> 
     101    </Compile> 
     102  </ItemGroup> 
    82103  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    83104  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2014/27/MikkoL/LM2/LM2/LM2Content/level_test.txt

    r5191 r5248  
     1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
    12&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
    23&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
    34&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
    4 &                                     % 
    5 &                                     % 
    6 &                                     % 
    7 &                                     % 
    8 &                                     % 
    9 &                                     % 
    10 &                                     % 
    11 &                                     % 
    12 &                  P                  % 
    13 &                                     % 
    14 &                                     % 
    15 &                                     % 
    16 &                                     % 
    17 &                                     % 
    18 &                                     % 
    19 &                                     % 
    20 &                                     %   
    21 &xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
    22 &xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
    23 &xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx% 
     5&                                     %                                             1                                             1                                             1 
     6&                                     %     R                                             R                                             R 
     7&                                     %                                        1                                             1                                             1 
     8&                                     %          R                                             R                                             R 
     9&                                     %                                   1                                             1                                             1 
     10&                                     %               R                                             R                                             R 
     11&                                     %                              1                                             1                                             1 
     12&                                     %                    R                                             R                                             R 
     13&                  P                  %                         1                                             1                                             1 
     14&                                     %                          R                                             R                                             R 
     15&                                     %                    1                                             1                                             1 
     16&                                     %                              R                                             R                                             R 
     17&                                     %               1                                             1                                             1 
     18&                                     %                                   R                                             R                                             R 
     19&                                     %          1                                             1                                             1 
     20&                                     %                                        R                                             R                                             R 
     21&                                     %     1                                             1                                             1 
     22&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%   
     23&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%   
     24&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%   
     25&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
Note: See TracChangeset for help on using the changeset viewer.