- Timestamp:
- 2010-07-07 14:52:56 (13 years ago)
- Location:
- 2010/27/akrauhan/Wooden Warfare
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/akrauhan/Wooden Warfare/Content/Content.contentproj
r1101 r1144 1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 2 2 <PropertyGroup> 3 3 <ProjectGuid>81113312-41cd-49da-bca5-9f23f6dcd4aa</ProjectGuid> … … 34 34 <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 35 35 </ItemGroup> 36 <ItemGroup> 37 <Compile Include="Winter.jpg"> 38 <Name>Winter</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 36 43 </Project> -
2010/27/akrauhan/Wooden Warfare/Peli.cs
r1122 r1144 3 3 using Jypeli.Widgets; 4 4 using Jypeli.Assets; 5 using System.Collections.Generic; 5 6 6 7 public class Peli : PhysicsGame … … 8 9 PhysicsObject varsijousi; 9 10 PhysicsObject kuormaauto; 10 Cannon tykki; 11 LaserGun pyssy; 12 const int ruudunLeveys = 50; 13 const int ruudunKorkeus = 50; 14 15 Timer pomminPudotusAjastin; 11 16 12 17 protected override void Begin() 13 18 { 14 LuoKenttä(); 19 pomminPudotusAjastin = new Timer(); 20 21 LuoKentta(); 22 KaynnistaPomminpudotusAjastin(); 15 23 Ohjaimet(); 16 24 } 17 void LuoKenttä() 25 26 void KaynnistaPomminpudotusAjastin() 27 { 28 pomminPudotusAjastin.Interval = 3; 29 pomminPudotusAjastin.Trigger += Pommeja; 30 Add(pomminPudotusAjastin); 31 } 32 33 void NopeutaPommienPutoamista() 34 { 35 pomminPudotusAjastin.Interval /= 2; 36 } 37 38 void HidastaPommienPutoamista() 39 { 40 // Jaa intervalli ykköstä pienemmällä 41 } 42 43 44 void Pommeja(Timer ajastin) 45 { 46 47 // Arvotan luku väliltä [Level.Left, Level.Right] 48 double x = RandomGen.NextDouble(Level.Left, Level.Right); 49 double y = 600.0; 50 51 // Pommit putoilevat.. Tee uusi fysiikkaolio ja lisää sille törmäyksenkäsittelijä 52 } 53 54 void LuoKentta() 18 55 { 19 56 varsijousi = new Automobile(75, 30); … … 23 60 varsijousi.IgnoresCollisionResponse = true; 24 61 Add(varsijousi); 25 Level.CreateBorders();26 Camera.ZoomToLevel();62 63 27 64 kuormaauto = new PhysicsObject(200.0, 100.0); 28 kuormaauto.X = - 450.0;29 kuormaauto.Y = - 300.0;65 kuormaauto.X = -550.0; 66 kuormaauto.Y = -250.0; 30 67 Add(kuormaauto); 31 tykki = new Cannon(50, 10); 32 tykki.Power.Value += 10000; 33 PhysicsObject ammus = tykki.Shoot(); 34 varsijousi.Add(tykki); 68 pyssy = new LaserGun(20, 5); 69 varsijousi.Add(pyssy); 70 PathFollowerBrain tietaseuraavatAivot = new PathFollowerBrain(); 71 kuormaauto.Brain = tietaseuraavatAivot; 72 List<Vector> polku = new List<Vector>(); 73 polku.Add( new Vector(-800.0,-250.0)); 74 polku.Add( new Vector(800.0,-250.0)); 75 tietaseuraavatAivot.Path = polku; 76 tietaseuraavatAivot.Speed = 100; 77 kuormaauto.IgnoresCollisionResponse = true; 78 TileMap ruudut = TileMap.FromFile("kenttä"); 79 ruudut['-'] = LuoPalikKaksi; 80 ruudut['='] = LuoPalikka; 81 varsijousi.Image = LoadImage 35 82 36 37 Add(tykki); 83 ruudut.Insert(40.0, 40.0); 84 Level.Background.Image = LoadImage("Winter"); 85 Level.Background.FitToLevel(); 38 86 39 87 88 89 40 90 } 41 91 void Ohjaimet() 42 92 { 43 Keyboard.Listen(Key.Up, ButtonState. Pressed, LiikuEteen, "Liiku eteenpäin");93 Keyboard.Listen(Key.Up, ButtonState.Down, LiikuEteen, "Liiku eteenpäin"); 44 94 Keyboard.Listen(Key.Up, ButtonState.Released, Pysahdy, "Pysayta"); 45 95 Keyboard.Listen(Key.Down, ButtonState.Pressed, LiikuTaakse, "Liiku taaksepäin"); … … 49 99 Keyboard.Listen(Key.Right, ButtonState.Down, KaannyVastapaivaan, "Käänny Vasemmalle"); 50 100 Keyboard.Listen(Key.Right, ButtonState.Released, Pysahdy2, "Käänny Vasemmalle"); 51 Keyboard.Listen(Key.Space, ButtonState.Down, tykki.Use, "Käytä");101 Keyboard.Listen(Key.Space, ButtonState.Down, pyssy.Use, "Käytä"); 52 102 } 53 103 … … 82 132 varsijousi.Angle += Angle.Degrees(-5); 83 133 } 134 135 84 136 void Pysahdy2() 137 { 138 } 139 140 141 PhysicsObject LuoPalikKaksi() 85 142 { 86 143 PhysicsObject palikka2 = PhysicsObject.CreateStaticObject(100.0, 50.0); 144 palikka2.Shape = Shapes.Rectangle; 145 palikka2.Color = Color.Brown; 146 return palikka2; 87 147 } 148 PhysicsObject LuoPalikka() 149 { 150 PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0, 50.0); 151 palikka.Shape = Shapes.Rectangle; 152 palikka.Color = Color.White; 153 return palikka; 154 155 } 156 88 157 89 158 -
2010/27/akrauhan/Wooden Warfare/Wooden Warfare.csproj
r1101 r1144 84 84 <Compile Include="Properties\AssemblyInfo.cs" /> 85 85 <Compile Include="Ohjelma.cs" /> 86 <Compile Include="Peli.cs" /> 86 <Compile Include="Peli.cs"> 87 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 88 </Compile> 87 89 </ItemGroup> 88 90 <ItemGroup> 89 91 <Content Include="Game.ico" /> 90 92 <Content Include="GameThumbnail.png" /> 93 <None Include="kenttä"> 94 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 95 </None> 91 96 </ItemGroup> 92 97 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.