Changeset 8743 for 2017/24


Ignore:
Timestamp:
2017-06-15 15:05:51 (2 years ago)
Author:
npo17_7
Message:

Iha just valmis ehkä vähä vaikee mut hyvä

Location:
2017/24/MatiasK/SimpleGame
Files:
4 added
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • 2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/Ohjelma.cs

    r8581 r8743  
    66    static void Main(string[] args) 
    77    { 
    8         using (SimpleGame game = new SimpleGame()) 
     8        using (Astropoint game = new Astropoint()) 
    99        { 
    1010#if !DEBUG 
  • 2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/Properties/AssemblyInfo.cs

    r8581 r8743  
    1 using System.Reflection; 
     1using System.Resources; 
     2using System.Reflection; 
    23using System.Runtime.CompilerServices; 
    34using System.Runtime.InteropServices; 
     
    67// set of attributes. Change these attribute values to modify the information 
    78// associated with an assembly. 
    8 [assembly: AssemblyTitle("SimpleGame")] 
    9 [assembly: AssemblyProduct("SimpleGame")] 
     9[assembly: AssemblyTitle("Astropoint")] 
     10[assembly: AssemblyProduct("Astropoint")] 
    1011[assembly: AssemblyDescription("")] 
    1112[assembly: AssemblyCompany("")] 
     
    3334// 
    3435[assembly: AssemblyVersion("1.0.0.0")] 
     36[assembly: NeutralResourcesLanguage("")] 
     37 
  • 2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/SimpleGame.cs

    r8717 r8743  
    77using Jypeli.Widgets; 
    88 
    9 public class SimpleGame : PhysicsGame 
     9public class Astropoint : PhysicsGame 
    1010   
    1111{ 
     
    1515    Label Teksti; 
    1616    Timer ajastin; 
    17  
     17    LaserGun pelaajan1Ase; 
    1818 
    1919    public override void Begin() 
    2020    { 
    2121        Teksti = new Label(500, 200); 
    22          
    2322        Teksti.TextColor = Color.Blue; 
    2423        Teksti.TextScale = new Vector(2, 2); 
     
    3130        pelaaja1.Image = olionKuva; 
    3231        //Valikko(); 
    33         LaserGun pelaajan1Ase; 
     32         
    3433        LuoReuna(1920, 50, 0, Level.Top + 130); 
    3534        LuoReuna(1920, 10, 0, Level.Bottom + -100); 
    3635        LuoReuna(95, 2020, 1000, Level.Right); 
    3736        LuoReuna(95, 2020, -1000, Level.Left); 
     37        LuoPistelaskuri(); 
    3838 
    3939        Level.Background.CreateStars(); 
     
    4444        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Exit"); 
    4545 
    46         ajastin = new Timer(); 
    47         ajastin.Interval = 1.5; 
    48         ajastin.Timeout += LisaaVihollisia; 
    4946         
     47 
    5048 
    5149        Keyboard.Listen(Key.C, ButtonState.Pressed, ShowControlHelp, "Control help menu"); 
     
    6765        alkuValikko.Color = Color.Emerald; 
    6866 
    69          
     67        //LisaaVihollisia2(); 
    7068 
    7169        Mouse.IsCursorVisible = true; 
    7270 
    73         pelaajan1Ase = new LaserGun(5, 5); 
    74  
    75         Mouse.Listen(MouseButton.Left, ButtonState.Pressed, AmmuAseella, "Shoot", pelaajan1Ase); 
     71        pelaajan1Ase = new LaserGun(50, 50); 
     72        pelaajan1Ase.IsVisible = false; 
     73 
     74        Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Shoot", pelaajan1Ase); 
    7675 
    7776        MediaPlayer.IsRepeating = true; 
     
    9190 
    9291        pelaaja1.Add(pelaajan1Ase); 
     92 
     93        //Mouse.ListenMovement(0.0, Tahtaa, "Aim"); 
    9394 
    9495        //Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 
     
    113114        Keyboard.Listen(Key.S, ButtonState.Released, 
    114115          LiikutaPelaajaa, null, Vector.Zero); 
    115         Keyboard.Listen(Key.F, ButtonState.Pressed, Pause, null); 
     116        Keyboard.Listen(Key.F, ButtonState.Pressed, Pause, "Pause"); 
    116117        Mouse.Listen(MouseButton.Right, ButtonState.Pressed, HeitaKranaatti, "Granade", pelaaja1); 
    117         Keyboard.Listen(Key.R, ButtonState.Pressed, AloitaAlusta, null); 
    118         Keyboard.Listen(Key.Space, ButtonState.Pressed, Explode, null); 
     118        Keyboard.Listen(Key.R, ButtonState.Pressed, AloitaAlusta, "Reset"); 
     119        Keyboard.Listen(Key.Space, ButtonState.Pressed, Explode, "Do not press"); 
    119120 
    120121    } 
     
    153154    { 
    154155        rajahdyksenKohde.Destroy(); 
     156        pisteLaskuri.AddValue(1); 
     157 
     158    } 
     159 
     160    IntMeter pisteLaskuri; 
     161 
     162    void LuoPistelaskuri() 
     163    { 
     164        pisteLaskuri = new IntMeter(0); 
     165 
     166        Label pisteNaytto = new Label(); 
     167        pisteNaytto.X = Screen.Left + 100; 
     168        pisteNaytto.Y = Screen.Top - 100; 
     169        pisteNaytto.TextColor = Color.Black; 
     170        pisteNaytto.Color = Color.White; 
     171 
     172        pisteNaytto.BindTo(pisteLaskuri); 
     173        Add(pisteNaytto); 
    155174    } 
    156175 
     
    179198    void StartGame() 
    180199    { 
     200        ajastin = new Timer(); 
     201        ajastin.Interval = 1.5; 
     202        ajastin.Timeout += LisaaVihollisia; 
     203 
     204 
     205        ajastin.Timeout += LisaaVihollisia2; 
    181206        ajastin.Start(); 
    182207    } 
     
    202227 
    203228        if (kohde == null) return; 
     229 
    204230         
     231 
    205232        Vihu vihu = (Vihu)kohde; 
    206233        vihu.ElamaLaskuri.Value--; 
     234        if (vihu.ElamaLaskuri.Value == 0) 
     235        { 
     236            pisteLaskuri.AddValue(1); vihu.Destroy(); 
     237        } 
    207238        MessageDisplay.Add("Hit Enemy"); 
    208239    } 
     
    210241    void AmmuAseella(LaserGun ase) 
    211242    { 
     243        if (IsPaused) return; 
     244        Vector suunta = (Mouse.PositionOnWorld - pelaajan1Ase.AbsolutePosition).Normalize(); 
     245        pelaajan1Ase.Angle = suunta.Angle; 
     246 
    212247        PhysicsObject ammus = ase.Shoot(); 
    213248        ammus.Tag = "Luoti"; 
     
    224259    } 
    225260 
     261    //void Tahtaa(AnalogState hiirenLiike) 
     262    //{ 
     263    //    Vector suunta = (Mouse.PositionOnWorld - pelaajan1Ase.AbsolutePosition).Normalize(); 
     264    //    pelaajan1Ase.Angle = suunta.Angle; 
     265    //} 
     266 
    226267    void Valikko() 
    227268    { 
     
    262303        vihollinen.Tag = "Vihu"; 
    263304        vihollinen.Brain = seuraajanAivot; 
    264         vihollinen.Shape = Shape.Pentagon; 
     305        vihollinen.Shape = Shape.Hexagon; 
    265306        vihollinen.Color = Color.Red; 
    266307        Add(vihollinen); 
     
    283324        } 
    284325 
     326    void LisaaVihollisia2() 
     327    { 
     328        Vihu vihollinen = new Vihu(50, 50); 
     329        vihollinen.X = -900; 
     330        vihollinen.Y = RandomGen.NextDouble(Level.Bottom, Level.Top); 
     331        AddCollisionHandler(vihollinen, "Luoti", LuotiOsuuViholliseen); 
     332        FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja1); 
     333        vihollinen.Tag = "Vihu"; 
     334        vihollinen.Brain = seuraajanAivot; 
     335        vihollinen.Shape = Shape.Hexagon; 
     336        vihollinen.Color = Color.Red; 
     337        Add(vihollinen); 
     338    } 
     339 
    285340    void LuotiOsuuViholliseen(PhysicsObject vihollinen, PhysicsObject luoti) 
    286341    { 
     
    292347class Vihu : PhysicsObject 
    293348{ 
    294     private IntMeter elamaLaskuri = new IntMeter(5, 0, 5); 
     349    private IntMeter elamaLaskuri = new IntMeter(20, 0, 20); 
    295350    public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 
    296351 
  • 2017/24/MatiasK/SimpleGame/SimpleGame/SimpleGame/obj/x86/Debug/SimpleGame.csproj.FileListAbsolute.txt

    r8691 r8743  
    1 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\SimpleGame.exe 
    2 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\SimpleGame.pdb 
    31C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Jypeli.dll 
    42C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Jypeli.xml 
    53C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\SimpleGame.csprojResolveAssemblyReference.cache 
    64C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 
    7 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\SimpleGame.exe 
    8 C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\SimpleGame.pdb 
    95C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Spaceship.xnb 
    106C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\Rajahdys.xnb 
     
    139C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.xnb 
    1410C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Content\pixel_space-G4mMoEkO8gQ_fmt43.wma 
     11C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Astropoint.exe 
     12C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\bin\x86\Debug\Astropoint.pdb 
     13C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\Astropoint.exe 
     14C:\MyTemp\MatiasK\SimpleGame\SimpleGame\SimpleGame\obj\x86\Debug\Astropoint.pdb 
Note: See TracChangeset for help on using the changeset viewer.