Changeset 898
- Timestamp:
- 2010-06-16 11:31:13 (11 years ago)
- Location:
- 2010/24/timisahe
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/timisahe/Makkarajahti/Content/Content.contentproj
r890 r898 61 61 </Compile> 62 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="lattia.png"> 65 <Name>lattia</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="kivi.png"> 72 <Name>kivi</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 63 77 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 64 78 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/24/timisahe/Makkarajahti/Makkarajahti.csproj
r890 r898 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="kentta1.txt"> 92 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 93 </Content> 91 94 </ItemGroup> 92 95 <ItemGroup> -
2010/24/timisahe/Makkarajahti/Peli.cs
r890 r898 20 20 protected override void Begin() 21 21 { 22 22 23 24 25 26 27 23 28 kenttaNro = 0; 24 Level.Width = 2000;25 Level.Height = 1000;26 29 27 30 // Luodaan pistelaskuri … … 44 47 MessageDisplay.Add("Etsi kaikka Makkarat!"); 45 48 49 50 46 51 47 52 … … 69 74 void luoKentta() 70 75 { 71 Level.CreateBorders();76 72 77 Level.Background.CreateGradient(Color.SkyBlue, Color.SkyBlue); 73 78 74 lisaaTaso(-200, -475); 75 lisaaTaso(0, -50); 76 lisääPyöreätaso (-200,-450); 77 78 lisaaMaali(); 79 lisaaPelaajat(); 80 } 81 82 void lisaaTaso(double x, double y) 83 { 84 PhysicsObject taso = PhysicsObject.CreateStaticObject(100.0, 30.0); 79 TileMap ruudut = TileMap.FromFile("kentta1.txt"); 80 81 ruudut['='] = lisaaTaso; 82 ruudut['*'] = lisaaPelaajat; 83 ruudut['o'] = lisaaPyoreataso; 84 ruudut['i'] = seina; 85 86 const int ruudunLeveys = 50; 87 const int ruudunKorkeus = 50; 88 89 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 90 Level.CreateBorders(); 91 } 92 93 94 PhysicsObject lisaaTaso() 95 { 96 PhysicsObject taso = PhysicsObject.CreateStaticObject(50.0, 50.0); 85 97 taso.Color = Color.Orange; 86 taso.X = x; 87 taso.Y = y; 98 taso.Image = LoadImage("lattia"); 88 99 Add(taso); 89 } 90 void lisääPyöreätaso (double x, double y) 91 { 92 93 PhysicsObject pyöreätaso = PhysicsObject.CreateStaticObject(30.0, 30.0, Shapes.Circle); 94 pyöreätaso.Color = Color.Orange; 95 pyöreätaso.X = x; 96 pyöreätaso.Y = y; 97 Add(pyöreätaso); 98 } 99 void lisaaPelaajat() 100 101 return taso; 102 } 103 PhysicsObject lisaaPyoreataso() 104 { 105 PhysicsObject pyoreataso = PhysicsObject.CreateStaticObject(50.0, 50.0,Shapes.Circle); 106 pyoreataso.Color = Color.Black; 107 pyoreataso.Image = LoadImage("kivi"); 108 Add(pyoreataso); 109 110 return pyoreataso; 111 112 } 113 PlatformCharacter lisaaPelaajat() 100 114 { 101 115 pelaaja1 = new PlatformCharacter(40, 60); 102 pelaaja1.Mass = 2.0;116 pelaaja1.Mass = 8.0; 103 117 pelaaja1.Image = LoadImage("Bulla"); 104 pelaaja1.X = 0;105 pelaaja1.Y = Level.Bottom + 120;106 118 107 119 AddCollisionHandler(pelaaja1, osuiMaaliin); … … 109 121 Add(pelaaja1); 110 122 111 pelaaja1.Weapon = Cannon(50, 10); 112 113 114 } 123 return pelaaja1; 124 125 126 } 127 128 PhysicsObject seina() 129 { 130 PhysicsObject seina = PhysicsObject.CreateStaticObject(50.0, 50.0); 131 seina.Color = Color.Orange; 132 Add(seina); 133 134 return seina; 135 } 115 136 116 137 void lisaaMaali() … … 133 154 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 134 155 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 135 Keyboard.Listen(Key.Space, ButtonState.Down, pelaaja1.Weapon.Use, "Ammu");156 136 157 137 158 -
2010/24/timisahe/Ympyroita/Peli.cs
r890 r898 6 6 public class Peli : PhysicsGame 7 7 { 8 PlatformCharacter pelaaja1;9 10 const double nopeus = 200;11 const double hyppyVoima = 4000;12 8 13 9 protected override void Begin() 14 10 { 15 11 12 Gravity = new Vector(0.0, -8.0); 13 for (int i = 0; i < 500; i++) 14 { 15 PiirraYmpyra(); 16 } 16 17 18 Level.CreateBorders(0.5, false); 19 Level.BackgroundColor = Color.SkyBlue; 17 20 18 Gravity = new Vector(0, -1000); 19 20 PiirraYmpyra(); 21 PiirraYmpyra(); 22 PiirraYmpyra(); 23 PiirraYmpyra(); 24 PiirraYmpyra(); 25 PiirraYmpyra(); 26 PiirraYmpyra(); 27 PiirraYmpyra(); 28 PiirraYmpyra(); 29 PiirraYmpyra(); 30 PiirraYmpyra(); 31 PiirraYmpyra(); 32 PiirraYmpyra(); 33 PiirraYmpyra(); 34 PiirraYmpyra(); 35 PiirraYmpyra(); 36 PiirraYmpyra(); 37 PiirraYmpyra(); 38 PiirraYmpyra(); 39 PiirraYmpyra(); 40 PiirraYmpyra(); 41 PiirraYmpyra(); 42 PiirraYmpyra(); 43 PiirraYmpyra(); 44 PiirraYmpyra(); 45 PiirraYmpyra(); 46 PiirraYmpyra(); 47 PiirraYmpyra(); 48 PiirraYmpyra(); 49 PiirraYmpyra(); 50 PiirraYmpyra(); 51 52 lisaaPelaajat(); 53 54 Level.CreateBorders(1.0, false); 55 Level.BackgroundColor = Color.Orange; 56 57 21 LisaaNappaimet(); 58 22 } 59 23 60 24 void PiirraYmpyra() 61 25 { 62 PhysicsObject pallo = new PhysicsObject( 10.0,10.0, Shapes.Triangle);26 PhysicsObject pallo = new PhysicsObject(20.0,20.0, Shapes.Circle); 63 27 pallo.X = RandomGen.NextInt( -300,300 ); 64 28 pallo.Y = RandomGen.NextInt(-300, 300); … … 68 32 Vector impulssi = new Vector(900.0, 0.0); 69 33 pallo.Hit(impulssi); 70 pallo.Restitution = 1.0;34 pallo.Restitution = 0.5; 71 35 72 36 } … … 79 43 uhri.Y =y; 80 44 Add(uhri); 81 82 83 }84 void lisaaPelaajat()85 {86 pelaaja1 = new PlatformCharacter(40, 60);87 pelaaja1.Mass = 1.0;88 pelaaja1.Image = LoadImage("Bulla");89 pelaaja1.X = 0;90 pelaaja1.Y = Level.Bottom + 120;91 92 93 94 Add(pelaaja1);95 45 } 96 46 47 void LisaaNappaimet() 48 { 49 Keyboard.Listen(Key.Left, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(-1000,0)); 50 Keyboard.Listen(Key.Right, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(1000, 0)); 51 Keyboard.Listen(Key.Down, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(0, -1000)); 52 Keyboard.Listen(Key.Up, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(0, 1000)); 53 } 97 54 98 99 100 101 102 103 104 55 void VaihdaPainovoimaa(Vector suunta) 56 { 57 Gravity = suunta; 58 } 105 59 106 60
Note: See TracChangeset
for help on using the changeset viewer.