Changeset 9133 for 2017/utsjoki/ÁndeN
- Timestamp:
- 2017-07-26 14:45:38 (6 years ago)
- Location:
- 2017/utsjoki/ÁndeN/msPaint
- Files:
-
- 10 added
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaint/msPaint.cs
r9094 r9133 13 13 Image taustaKuva = LoadImage("tausta"); 14 14 15 Vector nopeusYlos = new Vector(0, 0);16 Vector nopeusAlas = new Vector(0, 0);17 Vector nopeusVasen = new Vector( 0, 0);18 Vector nopeusOikea = new Vector( 0, 0);15 Vector nopeusYlos = new Vector(0, 7500); 16 Vector nopeusAlas = new Vector(0, -7500); 17 Vector nopeusVasen = new Vector(-7500, 0); 18 Vector nopeusOikea = new Vector(7500, 0); 19 19 20 20 PhysicsObject pelaaja1; … … 25 25 PhysicsObject ylaReuna; 26 26 PhysicsObject alaReuna; 27 27 28 28 29 public override void Begin() … … 30 31 LuoKentta(); 31 32 AsetaOhjaimet(); 33 34 35 } 36 37 void LuoRuutu(Vector paikka, double leveys, double korkeus) 38 { 39 GameObject ruutu = new GameObject(leveys, korkeus); 40 ruutu.Position = paikka; 41 ruutu.Color = Color.Transparent; 42 Add(ruutu); 32 43 } 33 44 34 45 void LuoKentta() 35 46 { 47 TileMap kentta = TileMap.FromLevelAsset("kentta"); 48 kentta.SetTileMethod('x', LuoRuutu); 49 kentta.Execute(50, 50); 36 50 37 pelaaja1 = LuoPelaaja (Level.Left + 20.0, 0.0);38 pelaaja2 = LuoPelaaja (Level.Right - 20.0, 0.0);51 pelaaja1 = LuoPelaaja1(Level.Left + 20.0, 0.0); 52 pelaaja2 = LuoPelaaja2(Level.Right - 20.0, 0.0); 39 53 40 54 vasenReuna = Level.CreateLeftBorder(); … … 50 64 alaReuna.IsVisible = false; 51 65 66 Level.Background.Image = taustaKuva; 52 67 Level.Background.TileToLevel(); 53 68 … … 55 70 } 56 71 57 PhysicsObject LuoPelaaja (double x, double y)72 PhysicsObject LuoPelaaja1(double x, double y) 58 73 { 59 PhysicsObject pelaaja = new PhysicsObject(20.0, 20.0); 60 pelaaja.Shape = Shape.Rectangle; 61 pelaaja.X = x; 62 pelaaja.Y = y; 63 Add(pelaaja); 64 pelaaja.Image = LoadImage("pelaaja"); 65 return pelaaja; 74 PhysicsObject pelaaja1 = new PhysicsObject(60.0, 100.0); 75 pelaaja1.Shape = Shape.Rectangle; 76 pelaaja1.X = x; 77 pelaaja1.Y = y; 78 pelaaja1.LinearDamping = 0.4; 79 Add(pelaaja1); 80 pelaaja1.Image = LoadImage("pelaaja1"); 81 pelaaja1.CanRotate = false; 82 83 84 Timer ajastin = new Timer(); 85 ajastin.Interval = 0.1; 86 ajastin.Timeout += delegate { Maalaa(pelaaja1); }; 87 ajastin.Start(); 88 89 return pelaaja1; 90 } 91 92 PhysicsObject LuoPelaaja2(double x, double y) 93 { 94 PhysicsObject pelaaja2 = new PhysicsObject(60.0, 100.0); 95 pelaaja2.Shape = Shape.Rectangle; 96 pelaaja2.X = x; 97 pelaaja2.Y = y; 98 pelaaja2.LinearDamping = 0.4; 99 Add(pelaaja2); 100 pelaaja2.Image = LoadImage("pelaaja2"); 101 pelaaja2.CanRotate = false; 102 103 Timer ajastin = new Timer(); 104 ajastin.Interval = 0.1; 105 ajastin.Timeout += delegate { Maalaa(pelaaja2); }; 106 ajastin.Start(); 107 108 return pelaaja2; 109 } 110 111 void Maalaa(PhysicsObject pelaaja) 112 { 113 GameObject ruutu = GetObjectAt(pelaaja.Position); 114 ruutu.Angle = pelaaja.Angle; 115 116 if(pelaaja==pelaaja1) 117 { 118 ruutu.Image = LoadImage("splat1"); 119 } 120 if (pelaaja == pelaaja2) 121 { 122 ruutu.Image = LoadImage("splat2"); 123 } 66 124 } 67 125 68 126 void AsetaOhjaimet() 69 127 { 70 Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusYlos );71 Keyboard.Listen(Key.S, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusAlas );72 Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusVasen );73 Keyboard.Listen(Key.D, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusOikea );128 Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusYlos, Angle.FromDegrees(0)); 129 Keyboard.Listen(Key.S, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusAlas, Angle.FromDegrees(180)); 130 Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusVasen, Angle.FromDegrees(90)); 131 Keyboard.Listen(Key.D, ButtonState.Down, AsetaNopeus, null, pelaaja1, nopeusOikea, Angle.FromDegrees(270)); 74 132 75 Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusYlos );76 Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusAlas );77 Keyboard.Listen(Key.Left, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusVasen );78 Keyboard.Listen(Key.Right, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusOikea );133 Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusYlos, Angle.FromDegrees(0)); 134 Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusAlas, Angle.FromDegrees(180)); 135 Keyboard.Listen(Key.Left, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusVasen, Angle.FromDegrees(90)); 136 Keyboard.Listen(Key.Right, ButtonState.Down, AsetaNopeus, null, pelaaja2, nopeusOikea, Angle.FromDegrees(270)); 79 137 80 138 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 81 139 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 82 140 83 141 } 84 142 85 void AsetaNopeus(PhysicsObject pelaaja, Vector nopeus )143 void AsetaNopeus(PhysicsObject pelaaja, Vector nopeus, Angle kulma) 86 144 { 87 145 pelaaja.Push(nopeus); 146 pelaaja.Angle = kulma; 88 147 } 89 148 } -
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaint/msPaint.csproj.Debug.cachefile
r9094 r9133 1 1 Content\tausta.xnb 2 Content\pelaaja.xnb 2 Content\pelaaja1.xnb 3 Content\pelaaja2.xnb 4 Content\splat1.xnb 5 Content\splat2.xnb 6 Content\kentta.xnb -
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaint/obj/x86/Debug/ContentPipeline-{62FA8DE1-8CD3-4372-AEDC-37B1B391D730}.xml
r9094 r9133 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\tausta.xnb</Output> 11 <Time>2017-07-2 5T13:02:44.6112123+03:00</Time>11 <Time>2017-07-26T10:38:21.3275551+03:00</Time> 12 12 </Item> 13 13 <Item> 14 <Source>pelaaja .png</Source>15 <Name>pelaaja </Name>14 <Source>pelaaja1.png</Source> 15 <Name>pelaaja1</Name> 16 16 <Importer>TextureImporter</Importer> 17 17 <Processor>TextureProcessor</Processor> 18 18 <Options>None</Options> 19 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja.xnb</Output> 20 <Time>2017-07-25T14:40:47.6534292+03:00</Time> 19 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja1.xnb</Output> 20 <Time>2017-07-26T10:14:49.3680514+03:00</Time> 21 </Item> 22 <Item> 23 <Source>pelaaja2.png</Source> 24 <Name>pelaaja2</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja2.xnb</Output> 29 <Time>2017-07-26T10:14:49.3680514+03:00</Time> 30 </Item> 31 <Item> 32 <Source>splat1.png</Source> 33 <Name>splat1</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\splat1.xnb</Output> 38 <Time>2017-07-26T13:36:03.0934577+03:00</Time> 39 </Item> 40 <Item> 41 <Source>splat2.png</Source> 42 <Name>splat2</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\splat2.xnb</Output> 47 <Time>2017-07-26T13:36:03.1090578+03:00</Time> 48 </Item> 49 <Item> 50 <Source>kentta.txt</Source> 51 <Name>kentta</Name> 52 <Importer>TextFileImporter</Importer> 53 <Processor>TextFileContentProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\kentta.xnb</Output> 56 <Time>2017-07-26T14:14:36.2586002+03:00</Time> 21 57 </Item> 22 58 <BuildSuccessful>true</BuildSuccessful> -
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaint/obj/x86/Debug/cachefile-{62FA8DE1-8CD3-4372-AEDC-37B1B391D730}-targetpath.txt
r9094 r9133 1 1 Content\tausta.xnb 2 Content\pelaaja.xnb 2 Content\pelaaja1.xnb 3 Content\pelaaja2.xnb 4 Content\splat1.xnb 5 Content\splat2.xnb 6 Content\kentta.xnb -
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaint/obj/x86/Debug/msPaint.csproj.FileListAbsolute.txt
r9094 r9133 8 8 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\tausta.xnb 9 9 C:\MyTemp\msPaint\msPaint\msPaint\obj\x86\Debug\msPaint.csprojResolveAssemblyReference.cache 10 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja.xnb 10 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja1.xnb 11 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\pelaaja2.xnb 12 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\splat1.xnb 13 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\splat2.xnb 14 C:\MyTemp\msPaint\msPaint\msPaint\bin\x86\Debug\Content\kentta.xnb -
2017/utsjoki/ÁndeN/msPaint/msPaint/msPaintContent/msPaintContent.contentproj
r9094 r9133 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="pelaaja1.png"> 49 <Name>pelaaja1</Name> 50 <Importer>TextureImporter</Importer> 51 <Processor>TextureProcessor</Processor> 52 </Compile> 53 <Compile Include="pelaaja2.png"> 54 <Name>pelaaja2</Name> 55 <Importer>TextureImporter</Importer> 56 <Processor>TextureProcessor</Processor> 57 </Compile> 58 </ItemGroup> 59 <ItemGroup> 48 60 <Compile Include="tausta.png"> 49 61 <Name>tausta</Name> … … 53 65 </ItemGroup> 54 66 <ItemGroup> 55 <Compile Include="pelaaja.png"> 56 <Name>pelaaja</Name> 67 <Compile Include="kentta.txt"> 68 <Name>kentta</Name> 69 <Importer>TextFileImporter</Importer> 70 <Processor>TextFileContentProcessor</Processor> 71 </Compile> 72 </ItemGroup> 73 <ItemGroup> 74 <Compile Include="splat1.png"> 75 <Name>splat1</Name> 76 <Importer>TextureImporter</Importer> 77 <Processor>TextureProcessor</Processor> 78 </Compile> 79 <Compile Include="splat2.png"> 80 <Name>splat2</Name> 57 81 <Importer>TextureImporter</Importer> 58 82 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.