Changeset 2526 for 2011


Ignore:
Timestamp:
2011-08-03 14:55:05 (8 years ago)
Author:
pesosant
Message:

Talletus.

Location:
2011/31/SanteriP
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2011/31/SanteriP/Acon/Acon/Peli.cs

    r2494 r2526  
    99public class Peli : PhysicsGame 
    1010{ 
     11    RandomMoverBrain satunnaisAivot = new RandomMoverBrain(); 
     12    Image olionKuva = LoadImage("Alus"); 
     13    Image AsteroidinKuva = LoadImage("Asteroid"); 
    1114    PhysicsObject Acon; 
    1215    public override void Begin() 
    1316    { 
    14         
     17        LuoKentta(); 
    1518    }    
    16         void LuoKentta() 
    17     { 
    18         Acon = new PhysicsObject(40, 40); 
     19         
     20    void LuoKentta() 
     21      
     22      { 
     23 
     24        Acon = new PhysicsObject(75, 75); 
    1925        Acon.Shape = Shape.Triangle; 
    2026        Acon.Color = Color.White; 
     27        Acon.Image = olionKuva; 
     28        Acon.Shape = Shape.FromImage(olionKuva); 
     29        AssaultRifle pyssy = new AssaultRifle(20, 5); 
     30        Acon.Add(pyssy); 
    2131        Add(Acon); 
    2232 
    23         Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit,"Poistu"); 
     33        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 
    2434        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
    25          
     35        Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000)); 
     36        Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); 
     37        Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); 
     38        Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0)); 
     39        Keyboard.Listen(Key.Space, ButtonState.Down, LiikutaPelaajaa, "Ammu"); 
     40 
    2641 
    2742        Level.CreateBorders(1.0, false); 
     43        Level.Background.CreateStars( 100 ); 
    2844        Level.BackgroundColor = Color.Black; 
     45        Camera.ZoomToLevel(); 
    2946 
     47        Timer ajastin = new Timer(); 
     48        ajastin.Interval = 1.5; 
     49        ajastin.Timeout += delegate { LuoVihollinen(); }; 
     50        ajastin.Start(); 
    3051 
    3152    } 
    3253 
    33     void Kaasua() 
    34     { 
    35         
     54        void LiikutaPelaajaa(Vector vektori) 
     55        { 
    3656 
     57            Acon.Push(vektori); 
    3758 
     59        } 
    3860 
     61        void LuoVihollinen() 
     62        { 
     63            PhysicsObject Asteroid = new PhysicsObject(150, 150); 
     64            Asteroid.Shape = Shape.FromImage( AsteroidinKuva ); 
     65            RandomMoverBrain satunnaisAivot = new RandomMoverBrain(); 
     66            satunnaisAivot.Active = true; 
     67            satunnaisAivot.Speed = 1000; 
     68            Asteroid.X = RandomGen.NextDouble(Level.Left, Level.Right); 
     69            Asteroid.Y = RandomGen.NextDouble(Level.Bottom,Level.Top); 
     70            Asteroid.Brain = satunnaisAivot; 
     71            Asteroid.Image = AsteroidinKuva; 
     72            Asteroid.Shape = Shape.Circle; 
     73            Add(Asteroid); 
     74        } 
     75        void LiikutaPelaajaa() 
     76        { 
    3977 
    40     } 
     78        } 
     79   
     80} 
    4181 
    42 } 
  • 2011/31/SanteriP/Acon/AconContent/AconContent.contentproj

    r2494 r2526  
    4444    <Reference Include="TextFileContentExtension" /> 
    4545  </ItemGroup> 
     46  <ItemGroup> 
     47    <Compile Include="Alus.png"> 
     48      <Name>Alus</Name> 
     49      <Importer>TextureImporter</Importer> 
     50      <Processor>TextureProcessor</Processor> 
     51    </Compile> 
     52  </ItemGroup> 
     53  <ItemGroup> 
     54    <Compile Include="Asteroid.png"> 
     55      <Name>Asteroid</Name> 
     56      <Importer>TextureImporter</Importer> 
     57      <Processor>TextureProcessor</Processor> 
     58    </Compile> 
     59  </ItemGroup> 
    4660  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4761  <!--  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.