Changeset 5556 for 2014


Ignore:
Timestamp:
2014-07-23 01:03:01 (9 years ago)
Author:
mijoliim
Message:
 
Location:
2014/30/MikkoL
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MikkoL/Gradiant/LM2/LM2/Gradiant.cs

    r5553 r5556  
    106106    Image bullet_player05 = LoadImage("bullet_player05"); 
    107107    Image bullet_droid = LoadImage("bullet_droid"); 
     108    Image bullet_laser = LoadImage("bullet_laser"); 
    108109    Image bullet_enemy_01 = LoadImage("bullet_enemy_01"); 
    109110    Image bullet_enemy_02 = LoadImage("bullet_enemy_02"); 
     
    148149    Image spread_up = LoadImage("spread_up"); 
    149150    Image cursor_gui = LoadImage("cursor"); 
     151    Image select_ship_gui = LoadImage("select_ship"); 
    150152 
    151153    Image aj = LoadImage("aj-weed"); 
     
    155157    SoundEffect hitsfx = LoadSoundEffect("hit"); 
    156158    SoundEffect shootsfx = LoadSoundEffect("shoot"); 
     159    SoundEffect selectsfx = LoadSoundEffect("select1"); 
    157160    SoundEffect powerupsfx = LoadSoundEffect("powerup"); 
    158161    SoundEffect explosionsfx = LoadSoundEffect("explosion"); 
     
    164167    DoubleMeter wpn_spread = new DoubleMeter(1,1,10); 
    165168 
    166     double drd_shootRate = 0.1; 
    167     double drd_type = 1; 
     169    double drd_shootRate = 0.2; 
     170    double drd_type = 0; 
    168171    IntMeter drd_damageRatio = new IntMeter(1, 1, 20); 
    169172    //drd types 
     
    182185    GameObject press_start; 
    183186    GameObject cursor; 
     187    GameObject select_ship; 
     188    Timer cursor_blink; 
     189    double cursorpos = 0; 
     190 
    184191    bool s001 = false; 
    185192 
     
    219226 
    220227        Timer start = new Timer(); 
    221         start.Interval = 0.06; 
     228        start.Interval = 0.6; 
    222229        start.Timeout += delegate 
    223230        { 
     
    229236        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 
    230237        ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 
    231         ControllerOne.Listen(Button.Start, ButtonState.Pressed, Start, null); 
     238        ControllerOne.Listen(Button.Start, ButtonState.Pressed, Select_ship, null); 
    232239 
    233240 
     
    235242    void Select_ship() 
    236243    { 
     244        selectsfx.Play(); 
     245 
    237246        ClearControls(); 
    238247        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 
    239248        ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 
     249        ControllerOne.ListenAnalog(AnalogControl.LeftStick, -0.1, movecursor, null); 
     250        ControllerOne.Listen(Button.Start, ButtonState.Pressed, Start, null); 
     251        ControllerOne.Listen(Button.A, ButtonState.Pressed, Start, null); 
    240252 
    241253        control_gui.Destroy(); 
     
    244256        cursor = new GameObject(21, 19); 
    245257        cursor.Image = cursor_gui; 
    246         cursor.Position = Screen.Center; 
    247  
     258        cursor.Position = Screen.Center + new Vector(-232, 41); 
     259 
     260        select_ship = new GameObject(426, 136); 
     261        select_ship.Image = select_ship_gui; 
     262        select_ship.Position = Screen.Center; 
     263 
     264        Add(select_ship); 
    248265        Add(cursor); 
    249266 
    250         Timer cursor_blink = new Timer(); 
    251         cursor_blink.Interval = 0.33; 
     267        cursor_blink = new Timer(); 
     268        cursor_blink.Interval = 0.5; 
    252269        cursor_blink.Timeout += delegate 
    253270        { 
     
    256273            if (cursor.IsDestroyed) cursor_blink.Stop(); 
    257274        }; 
    258         //cursor_blink.Start(); 
     275        cursor_blink.Start(); 
     276    } 
     277    void movecursor(AnalogState dir) 
     278    { 
     279        if (cursorpos!= 0 && dir.StateVector.Y >= 0.7) 
     280        { 
     281            cursorpos = 0; 
     282            cursor.Position = Screen.Center + new Vector(-232, 41); 
     283            cursor_blink.Start(); 
     284            cursor.IsVisible = true; 
     285            selectsfx.Play(); 
     286        } 
     287        else if (cursorpos!= 1 &&dir.StateVector.Y <= -0.7) 
     288        { 
     289            cursorpos = 1; 
     290            cursor.Position = Screen.Center + new Vector(-232, -51); 
     291            cursor_blink.Start(); 
     292            cursor.IsVisible = true; 
     293            selectsfx.Play(); 
     294        } 
    259295    } 
    260296 
    261297    void Start() 
    262298    { 
     299        selectsfx.Play(); 
    263300        ClearAll(); 
    264301        MediaPlayer.Stop(); 
     
    269306        stage_01_start.Position = cntr; 
    270307        stage_01_start.Image = stage_1_start; 
    271         Add(stage_01_start); 
     308        Add(stage_01_start, 3); 
    272309 
    273310        double i = 0; 
     
    295332            Pause(); 
    296333            MediaPlayer.Play("Venom"); 
     334            selectsfx.Play(); 
    297335        } 
    298336    } 
     
    478516        Add(player,2); 
    479517 
    480         playership.Image = player_ship_02; 
     518        if (cursorpos == 0) 
     519        { 
     520            playership.Image = player_ship_01; 
     521            playership.Size = new Vector(37, 48); 
     522        } 
     523        else if (cursorpos == 1) playership.Image = player_ship_02; 
    481524        playership.IsVisible = true; 
    482525        playership.IgnoresCollisionResponse = true; 
     
    498541 
    499542        Add(playership, -1); 
    500         if (drd_type == 1) 
     543        drd_type = cursorpos; 
     544        if (drd_type == 0) 
    501545        { 
    502546            droid(new Vector(-30, 50)); 
     
    504548            droid(new Vector(-50, 30)); 
    505549            droid(new Vector(-50, -30)); 
     550        }  
     551        else if (drd_type == 1) 
     552        { 
     553            droid(new Vector(-30, 55)); 
     554            droid(new Vector(-30, -55)); 
     555            droid(new Vector(-10, 35)); 
     556            droid(new Vector(-10, -35)); 
    506557        } 
    507558    } 
     
    725776        drd.IgnoresCollisionResponse = true; 
    726777        drd.CollisionIgnoreGroup = 2; 
    727         drd.Animation = droid_anim; 
     778        drd.Position = player.Position + pos; 
     779        if (cursorpos == 0) drd.Animation = droid2_anim; 
     780        else if (cursorpos == 1) drd.Animation = droid_anim; 
    728781        drd.Animation.Start(); 
    729         if (drd_type == 1) { drd.Position = player.Position + pos; 
    730782        setdrd_shoot_timer(drd); 
    731783 
     
    740792        }; 
    741793        move.Start(); 
    742         }; 
    743         //else if 
    744794 
    745795        Add(drd); 
     
    748798    { 
    749799        Timer drdshoot = new Timer(); 
    750         drdshoot.Interval = drd_shootRate; 
    751         drdshoot.Timeout += delegate 
    752         { 
    753             if (drd_type == 1) 
    754             { 
    755                 droidtype1_shoot(drd); 
    756             } 
    757         }; 
     800        if (cursorpos == 0) drdshoot.Interval = drd_shootRate; 
     801        else if (cursorpos == 1) drdshoot.Interval = 0.05; 
     802        if (cursorpos == 0) 
     803        { 
     804            drdshoot.Timeout += delegate 
     805            { 
     806                if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 
     807                { 
     808                    droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(100, 150)), new Vector(24, 13)); 
     809                    droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(-150, -100)), new Vector(24, 13)); 
     810                }; 
     811            }; 
     812        } 
     813        else if (cursorpos == 1) 
     814        { 
     815            drdshoot.Timeout += delegate 
     816            { 
     817                if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 
     818                { 
     819                    droidlaser(drd.Position + new Vector(37, 0), new Vector(1400, 0), new Vector(70, 5)); 
     820                }; 
     821            }; 
     822        } 
    758823 
    759824        drdshoot.Start(); 
    760825    } 
    761     void droidtype1_shoot(droid drd) 
    762     { 
    763         if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 
    764         { 
    765             droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(100,150)), new Vector(24, 13)); 
    766             droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(-150, -100)), new Vector(24, 13)); 
    767         }; 
    768     } 
     826 
    769827    void droidprojectile(Vector pos, Vector vel, Vector size) 
    770828    { 
     
    798856        }; 
    799857        angle.Start(); 
     858    } 
     859    void droidlaser(Vector pos, Vector vel, Vector size) 
     860    { 
     861        bullet projectile = new bullet(size.X, size.Y); 
     862        projectile.Shape = Shape.Rectangle; 
     863        projectile.IgnoresGravity = true; 
     864        projectile.Position = pos; 
     865        projectile.Tag = "player_bullet"; 
     866        projectile.Image = bullet_laser; 
     867        projectile.damage = drd_damageRatio.Value; 
     868 
     869        projectile.IgnoresCollisionResponse = true; 
     870 
     871        projectile.CollisionIgnoreGroup = 2; 
     872        projectile.MaximumLifetime = TimeSpan.FromSeconds(1.2); 
     873 
     874        AddCollisionHandler<bullet, frontborder>(projectile, destroy); 
     875        AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); 
     876 
     877        Add(projectile, -1); 
     878        projectile.Hit(vel); 
     879 
    800880    } 
    801881     
  • 2014/30/MikkoL/Gradiant/LM2/LM2Content/GradiantContent.contentproj

    r5553 r5556  
    437437    </Compile> 
    438438  </ItemGroup> 
     439  <ItemGroup> 
     440    <Compile Include="select_ship.png"> 
     441      <Name>select_ship</Name> 
     442      <Importer>TextureImporter</Importer> 
     443      <Processor>TextureProcessor</Processor> 
     444    </Compile> 
     445  </ItemGroup> 
     446  <ItemGroup> 
     447    <Compile Include="select1.wav"> 
     448      <Name>select1</Name> 
     449      <Importer>WavImporter</Importer> 
     450      <Processor>SoundEffectProcessor</Processor> 
     451    </Compile> 
     452  </ItemGroup> 
     453  <ItemGroup> 
     454    <Compile Include="bullet_laser.png"> 
     455      <Name>bullet_laser</Name> 
     456      <Importer>TextureImporter</Importer> 
     457      <Processor>TextureProcessor</Processor> 
     458    </Compile> 
     459  </ItemGroup> 
    439460  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    440461  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.