Changeset 4158 for 2013/24


Ignore:
Timestamp:
2013-06-14 12:41:25 (10 years ago)
Author:
juiitamm
Message:

Talletus.

Location:
2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely
Files:
41 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely.cs

    r4120 r4158  
    3232    Image rajahdys = LoadImage("explosion0"); 
    3333    Image liekkikuva = LoadImage("liekki"); 
     34    Image ammuskuva = LoadImage("ammus"); 
    3435    SoundEffect hurt = LoadSoundEffect("hit"); 
    3536    SoundEffect shoot = LoadSoundEffect("shoot"); 
    3637    SoundEffect explosion = LoadSoundEffect("explosion"); 
    3738    SoundEffect powerup = LoadSoundEffect("powerup"); 
     39    Flame liekki; 
    3840 
    3941 
     
    4648 
    4749    bool SaaAmpua = true; 
    48      
    49      
    50      
     50 
     51 
     52 
    5153    public override void Begin() 
    5254    { 
     
    5557        ClearAll(); 
    5658        Level.Background.Image = tausta; 
    57  
    58         SetWindowSize(1920, 1080, true); 
    59         MultiSelectWindow valikko = new MultiSelectWindow("Generic Space Game", "Start Game", "How to play", "High Score", "Quit"); 
     59        //Level.Background.FitToLevel(); 
     60 
     61        SetWindowSize(1024, 768, true); 
     62        //SetWindowSize(1920, 1080, true); 
     63         
     64 
     65 
     66 
     67        MultiSelectWindow valikko = new MultiSelectWindow("Just some generic space game", "Start Game", "How to play", "High Score", "Quit"); 
    6068        //valikko.ItemSelected += PainettiinValikonNappia; 
    61          
    62         valikko.Color = Color.SkyBlue; 
    63          
     69 
     70        valikko.Color = Color.DarkGray; 
     71        valikko.SelectionColor = Color.DarkJungleGreen; 
     72        valikko.BorderColor = Color.DarkJungleGreen; 
     73        valikko.SetButtonTextColor(Color.SkyBlue); 
     74        //valikko.te 
     75 
    6476        valikko.BorderColor = Color.Black; 
    6577        valikko.AddItemHandler(0, AloitaPeli); 
     
    6779        valikko.AddItemHandler(2, ParhaatPisteet); 
    6880        valikko.AddItemHandler(3, ConfirmExit); 
    69          
     81 
    7082        Add(valikko); 
    71          
     83 
    7284    } 
    7385 
     
    7789        topLista.HighScoreWindow.Closed += delegate { Begin(); }; 
    7890    } 
    79      
     91 
    8092    void AloitaPeli() 
    8193    { 
     
    103115        ElamaNaytto.Title = "HP"; 
    104116        ElamaNaytto.BindTo(ElamaLaskuri); 
    105          
    106         ElamaLaskuri.LowerLimit +=  ElamaLoppui; 
     117 
     118        ElamaLaskuri.LowerLimit += ElamaLoppui; 
    107119        ElamaLaskuri.LowerLimit += ElamaLaskuri.Reset; 
    108120        //ElamaLaskuri.LowerLimit += topLista.EnterAndShow(pisteLaskuri.Value); 
     
    117129    { 
    118130        alus.Destroy(); 
     131        liekki.Destroy(); 
     132 
    119133        explosion.Play(); 
    120134        ControllerOne.Vibrate(10.0, 10.0, 10.0, 10.0, 1.5); 
     
    122136        Explosion rajahdys = new Explosion(1000); 
    123137        rajahdys.Position = alus.Position; 
    124         rajahdys.Force = 0; 
     138        rajahdys.Force = 9001; 
    125139        Add(rajahdys); 
     140        MediaPlayer.Stop(); 
    126141        topLista.EnterAndShow(pisteLaskuri.Value); 
    127142        topLista.HighScoreWindow.Closed += delegate { Begin(); }; 
    128          
    129          
     143 
     144 
    130145    } 
    131146 
    132147    void Ohjeet() 
    133148    { 
    134         MessageWindow ikkuna = new MessageWindow("The goal of this game is to survive. You get points when time passes and from destroying enemies. Health Packs give you 2 HP. \n \n \n Controls (Keyboard): \n \n WASD: move \n \n rCtrl: shoot \n \n Press Enter to continue \n"); 
     149        MessageWindow ikkuna = new MessageWindow("The goal of this game is to survive.\nYou get points when time passes and from destroying enemies.\nHealth Packs give you 2 HP.\n\n\nControls (Keyboard): \n \n WASD: move \n \n rCtrl: shoot \n \n Controls (Controller): \n \n Left Analog Stick: move \n \n Left Trigger: shoot \n \n Press Enter or A to continue \n"); 
    135150        ikkuna.Closed += delegate { Begin(); }; 
    136151        ikkuna.Message.SizeMode = TextSizeMode.AutoSize; 
     
    163178        //pisteNaytto.Color = Color.White; 
    164179        pisteNaytto.Title = "Points"; 
    165          
     180 
    166181 
    167182        pisteNaytto.BindTo(pisteLaskuri); 
    168183        Add(pisteNaytto); 
    169          
     184 
    170185    } 
    171186 
     
    173188    void LuoKentta() 
    174189    { 
    175         Level.Width = Screen.Width; 
    176         Level.Height = Screen.Height; 
     190        if (1920 == Window.ClientBounds.Width) 
     191        { 
     192            Level.Width = Screen.Width; 
     193            Level.Height = Screen.Height; 
     194        } 
     195        else 
     196        { 
     197            Level.Width = Screen.Width*1.5; 
     198            Level.Height = Screen.Height*1.5; 
     199 
     200        } 
    177201        Level.CreateBorders(); 
    178          
     202 
     203 
     204        Camera.ZoomToLevel(); 
     205        Camera.StayInLevel = true; 
     206 
     207 
    179208        alus = new alus(100, 100); 
    180209        alus.Shape = Shape.Rectangle; 
    181210        alus.X = 0; 
     211 
    182212        alus.Y = 0; 
    183213        alus.Image = aluskuva; 
     
    185215        alus.LinearDamping = 0.95; 
    186216        alus.ElamaLaskuri.Value--; 
    187         Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle); 
    188         Flame liekki = new Flame(liekkikuva); 
    189         //liekki.RotateImage = true; 
    190         //liekki. = Angle.RightAngle; 
     217         
     218        liekki = new Flame(liekkikuva); 
     219        liekki.Position = alus.Position; 
     220        liekki.MinVelocity = 200; 
     221        liekki.MaxVelocity = 200; 
     222        liekki.MinAcceleration = 200; 
     223        liekki.MaxAcceleration = 200; 
     224        liekki.MinLifetime = 0.1; 
     225        liekki.MaxLifetime = 0.11; 
    191226        liekki.IgnoreWind = false; 
    192         Wind = new Vector(0, -100); 
     227         
     228 
    193229        Add(liekki, -1); 
    194230 
    195231        Level.Background.Image = tausta; 
     232        Level.Background.FitToLevel(); 
    196233 
    197234        Add(alus); 
    198235 
     236        //Level.AmbientLight = 0.2; 
     237        //Light valo = new Light(); 
     238        //valo.Intensity = 0.8; 
     239        //valo.Distance = 150; 
     240        //valo.Position = alus.Position; 
     241        //Add(valo); 
     242 
    199243        AddCollisionHandler(alus, "vihollinen", kuolema); 
     244         
    200245        AddCollisionHandler(alus, "hp", LisaaTerveys); 
    201246    } 
    202247 
    203     
     248 
    204249 
    205250    void AsetaOhjaimet() 
     
    215260        ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, KaannaTatilla, null); 
    216261        ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 
    217         ControllerOne.Listen(Button.Start, ButtonState.Pressed, Pause, null); 
     262        ControllerOne.Listen(Button.Start, ButtonState.Pressed, Pausetus, null); 
    218263        ControllerOne.ListenAnalog(AnalogControl.LeftTrigger, 0.1, AmmuLiipasin, null); 
    219264 
     265 
     266 
     267 
     268    } 
     269 
     270    void Pausetus() 
     271    { 
     272        Pause(); 
    220273         
    221          
    222          
     274 
     275 
     276    } 
     277 
     278    protected override void Update(Time time) 
     279    { 
     280        if (liekki != null && alus != null) 
     281        { 
     282            Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle + Angle.StraightAngle); 
     283            liekki.Position = alus.AbsolutePosition + pelaajanSuunta.Normalize() * 50; 
     284            Wind = pelaajanSuunta; 
     285        } 
     286 
     287        base.Update(time); 
    223288    } 
    224289 
     
    313378        Add(asteroidi); 
    314379        Angle asteroidikulma = (Vector.Zero - asteroidi.Position).Angle; 
    315         Vector asteroidivector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(asteroidikulma -Angle.FromDegrees(50), (asteroidikulma +Angle.FromDegrees(50)))); 
     380        Vector asteroidivector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(asteroidikulma - Angle.FromDegrees(50), (asteroidikulma + Angle.FromDegrees(50)))); 
    316381        asteroidi.Hit(asteroidivector); 
    317382    } 
     
    349414        pelaajan1Ase.IsVisible = false; 
    350415        pelaajan1Ase.FireRate = 9001; 
    351         pelaajan1Ase.InfiniteAmmo = true; 
    352         pelaajan1Ase.Power.DefaultValue = 100; 
    353         pelaajan1Ase.Power.Value = 100; 
     416        //pelaajan1Ase.InfiniteAmmo = true; 
     417        pelaajan1Ase.Ammo.Value = 3; 
     418        pelaajan1Ase.Power.DefaultValue = 150; 
     419        pelaajan1Ase.Power.Value = 150; 
    354420        pelaajan1Ase.ProjectileCollision = AmmusOsui; 
    355421        vihollinen.Add(pelaajan1Ase); 
     
    358424        Angle vihollinenkulma = (Vector.Zero - vihollinen.Position).Angle; 
    359425        Vector vihollinenvector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(vihollinenkulma - Angle.FromDegrees(10), (vihollinenkulma + Angle.FromDegrees(10)))); 
    360          
     426 
    361427        vihollinen.Hit(vihollinenvector); 
    362428 
    363429        Timer ajastin = new Timer(); 
    364         ajastin.Interval = 5; 
     430        ajastin.Interval = 2; 
    365431        ajastin.Timeout += delegate { VihollinenAmpuu(vihollinen, pelaajan1Ase, ajastin); }; 
    366432        ajastin.Start(); 
     
    379445            rajahdys.Force = 0; 
    380446            Add(rajahdys); 
    381              
     447 
    382448        } 
    383449 
     
    408474            SaaAmpua = false; 
    409475            shoot.Play(); 
    410             PhysicsObject ammus = new PhysicsObject(10, 10); 
     476            PhysicsObject ammus = new PhysicsObject(100, 10); 
    411477 
    412478            Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle); 
     
    414480 
    415481            ammus.Position = alus.Position + Vector.FromLengthAndAngle(80.0, alus.Angle); 
    416             ammus.Shape = Shape.Circle; 
     482            ammus.Shape = Shape.Rectangle; 
    417483            ammus.Color = Color.Yellow; 
     484            ammus.Image = ammuskuva; 
     485            ammus.Angle = alus.AbsoluteAngle; 
    418486            ammus.Hit(pelaajanSuunta); 
    419487 
     
    430498            poistumisAjastin.Start(); 
    431499 
    432             Timer.SingleShot(0.002, 
     500            Timer.SingleShot(0.2, 
    433501                delegate { SaaAmpua = true; } 
    434502            ); 
     
    460528 
    461529        pisteLaskuri.Value += 10; 
    462          
     530 
    463531    } 
    464532 
  • 2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely.csproj

    r4075 r4158  
    1919    <ApplicationIcon>Game.ico</ApplicationIcon> 
    2020    <Thumbnail>GameThumbnail.png</Thumbnail> 
     21    <IsWebBootstrapper>false</IsWebBootstrapper> 
     22    <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 
    2123    <PublishUrl>publish\</PublishUrl> 
    2224    <Install>true</Install> 
     
    2931    <UpdateRequired>false</UpdateRequired> 
    3032    <MapFileExtensions>true</MapFileExtensions> 
    31     <ApplicationRevision>0</ApplicationRevision> 
     33    <ApplicationRevision>1</ApplicationRevision> 
    3234    <ApplicationVersion>1.0.0.%2a</ApplicationVersion> 
    33     <IsWebBootstrapper>false</IsWebBootstrapper> 
    3435    <UseApplicationTrust>false</UseApplicationTrust> 
     36    <PublishWizardCompleted>true</PublishWizardCompleted> 
    3537    <BootstrapperEnabled>true</BootstrapperEnabled> 
    36     <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 
    3738  </PropertyGroup> 
    3839  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 
     
    6061    <PlatformTarget>x86</PlatformTarget> 
    6162    <XnaCompressContent>true</XnaCompressContent> 
     63  </PropertyGroup> 
     64  <PropertyGroup> 
     65    <ManifestCertificateThumbprint>A30257ECFD09FAA6DDCE9A6663A7C3ADF1A4833E</ManifestCertificateThumbprint> 
     66  </PropertyGroup> 
     67  <PropertyGroup> 
     68    <ManifestKeyFile>GeneerinenAvaruuslentely_TemporaryKey.pfx</ManifestKeyFile> 
     69  </PropertyGroup> 
     70  <PropertyGroup> 
     71    <GenerateManifests>true</GenerateManifests> 
     72  </PropertyGroup> 
     73  <PropertyGroup> 
     74    <SignManifests>true</SignManifests> 
    6275  </PropertyGroup> 
    6376  <ItemGroup> 
     
    152165    </BootstrapperPackage> 
    153166  </ItemGroup> 
     167  <ItemGroup> 
     168    <None Include="GeneerinenAvaruuslentely_TemporaryKey.pfx" /> 
     169  </ItemGroup> 
    154170  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
    155171  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> 
  • 2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentelyContent/GeneerinenAvaruuslentelyContent.contentproj

    r4120 r4158  
    129129    </Compile> 
    130130  </ItemGroup> 
     131  <ItemGroup> 
     132    <Compile Include="ammus.png"> 
     133      <Name>ammus</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136    </Compile> 
     137  </ItemGroup> 
    131138  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    132139  <!--  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.