Changeset 909
- Timestamp:
- 2010-06-16 13:48:39 (13 years ago)
- Location:
- 2010/24/joaamaka/The hole
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/joaamaka/The hole/Content/Content.contentproj
r891 r909 68 68 </Compile> 69 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="ohje.png"> 72 <Name>ohje</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 77 <ItemGroup> 78 <Compile Include="warning.png"> 79 <Name>warning</Name> 80 <Importer>TextureImporter</Importer> 81 <Processor>TextureProcessor</Processor> 82 </Compile> 83 </ItemGroup> 70 84 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 71 85 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/24/joaamaka/The hole/Peli.cs
r903 r909 14 14 15 15 PlatformCharacter olio; 16 Vector aloituspaikka; 16 17 17 const int ruudunLeveys = 50;18 const int ruudunKorkeus = 20;18 const int ruudunLeveys = 100; 19 const int ruudunKorkeus = 30; 19 20 20 21 protected override void Begin() … … 48 49 49 50 // Asetetaan painovoima 50 Gravity = new Vector(0, - 1000);51 Gravity = new Vector(0, -700); 51 52 52 53 luoKentta(); … … 61 62 TileMap ruudut = TileMap.FromFile("TextFile1.txt"); 62 63 ruudut['-'] = lisaaTaso; 63 ruudut['*'] = lisaaPelaajat;64 64 ruudut['_'] = lisaaTaso2; 65 65 ruudut['.'] = lisaaTaso3; 66 ruudut['!'] = lisaaTaso4; 67 ruudut[':'] = lisaaTaso5; 66 68 ruudut[','] = lisaaPiikit; 69 ruudut['*'] = lisaaPelaajat; 67 70 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 71 aloituspaikka = olio.Position; 68 72 Level.CreateBorders(); 69 73 AddCollisionHandler(olio, KasitteleOlionTormays); 70 71 72 74 } 73 75 … … 79 81 return taso; 80 82 } 83 84 PhysicsObject lisaaTaso3() 85 { 86 PhysicsObject nuoli2 = new PhysicsObject(50, 50, Shapes.Rectangle); 87 nuoli2.IgnoresGravity = true; 88 nuoli2.IgnoresCollisionResponse = true; 89 nuoli2.X = 100; 90 nuoli2.Y = 50; 91 nuoli2.Image = LoadImage("nuoli2"); 92 return nuoli2; 93 } 94 95 PhysicsObject lisaaTaso4() 96 { 97 PhysicsObject ohje = new PhysicsObject(150, 50, Shapes.Rectangle); 98 ohje.IgnoresGravity = true; 99 ohje.IgnoresCollisionResponse = true; 100 ohje.X = -100; 101 ohje.Y = 50; 102 ohje.Image = LoadImage("ohje"); 103 return ohje; 104 } 105 106 PhysicsObject lisaaTaso5() 107 { 108 PhysicsObject varoitus = new PhysicsObject(100, 50, Shapes.Rectangle); 109 varoitus.IgnoresGravity = true; 110 varoitus.IgnoresCollisionResponse = true; 111 varoitus.X = -100; 112 varoitus.Y = 50; 113 varoitus.Image = LoadImage("warning"); 114 return varoitus; 115 } 116 117 PhysicsObject lisaaPiikit() 118 { 119 PhysicsObject piikit = new PhysicsObject(100, 50, Shapes.Rectangle); 120 piikit.Tag = "piikki"; 121 piikit.IgnoresGravity = true; 122 piikit.IgnoresCollisionResponse = true; 123 piikit.X = 100; 124 piikit.Y = 50; 125 piikit.Image = LoadImage("Spikes"); 126 return piikit; 127 } 128 129 void KasitteleOlionTormays(PhysicsObject olio, PhysicsObject kohde) 130 { 131 if (kohde.Tag == "piikki") 132 { 133 olio.Position = aloituspaikka; 134 } 135 //tähän kirjoitetaan mitä halutaan tehdä, kun pallo törmää johonkin 136 } 137 138 139 PhysicsObject lisaaTaso2() 140 { 141 PhysicsObject nuoli = new PhysicsObject(50, 50, Shapes.Rectangle); 142 nuoli.IgnoresGravity = true; 143 nuoli.IgnoresCollisionResponse = true; 144 nuoli.X = 100; 145 nuoli.Y = 50; 146 nuoli.Image = LoadImage("nuoli"); 147 return nuoli; 148 } 149 150 void lisaaNappaimet() 151 { 152 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, null); 153 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä"); 154 155 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", olio, -nopeus); 156 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", olio, nopeus); 157 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", olio, hyppyVoima); 158 159 ControllerOne.Listen(Button.Start, ButtonState.Pressed, ShowControlHelp, null); 160 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu"); 161 162 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, liikuta, "Liikkuu vasemmalle", olio, -nopeus); 163 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, liikuta, "Liikkuu oikealle", olio, nopeus); 164 ControllerOne.Listen(Button.A, ButtonState.Pressed, hyppaa, "Hyppää", olio, hyppyVoima); 165 } 166 167 168 void liikuta(PlatformCharacter hahmo, double nopeus) 169 { 170 hahmo.Push(new Vector (nopeus, 0)); 171 } 172 173 void hyppaa(PlatformCharacter hahmo, double voima) 174 { 175 hahmo.Jump(voima); 176 } 177 81 178 82 179 PhysicsObject lisaaPelaajat() … … 94 191 } 95 192 96 PhysicsObject lisaaPiikit()97 {98 PhysicsObject piikit = new PhysicsObject(50, 50, Shapes.Rectangle);99 piikit.IgnoresGravity = true;100 piikit.IgnoresCollisionResponse = true;101 piikit.X = 100;102 piikit.Y = 50;103 piikit.Image = LoadImage("Spikes");104 return piikit;105 }106 107 void KasitteleOlionTormays(PhysicsObject olio, PhysicsObject kohde)108 {109 //tähän kirjoitetaan mitä halutaan tehdä, kun pallo törmää johonkin110 }111 112 113 PhysicsObject lisaaTaso2()114 {115 PhysicsObject nuoli = new PhysicsObject(50, 50, Shapes.Rectangle);116 nuoli.IgnoresGravity = true;117 nuoli.IgnoresCollisionResponse = true;118 nuoli.X = 100;119 nuoli.Y = 50;120 nuoli.Image = LoadImage("nuoli");121 return nuoli;122 }123 124 PhysicsObject lisaaTaso3()125 {126 PhysicsObject nuoli2 = new PhysicsObject(50, 50, Shapes.Rectangle);127 nuoli2.IgnoresGravity = true;128 nuoli2.IgnoresCollisionResponse = true;129 nuoli2.X = 100;130 nuoli2.Y = 50;131 nuoli2.Image = LoadImage("nuoli2");132 return nuoli2;133 }134 135 void lisaaNappaimet()136 {137 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet");138 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä");139 140 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", olio, -nopeus);141 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", olio, nopeus);142 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", olio, hyppyVoima);143 }144 145 146 void liikuta(PlatformCharacter hahmo, double nopeus)147 {148 hahmo.Push(new Vector (nopeus, 0));149 }150 151 void hyppaa(PlatformCharacter hahmo, double voima)152 {153 hahmo.Jump(voima);154 }155 193 } -
2010/24/joaamaka/The hole/TextFile1.txt
r903 r909 1 ---------------------------- 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - . _ - 11 - - 12 - * - 13 - - 14 ------------- -------- 15 16 17 18 ,,,,,,, 1 ----------------- 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - : - 9 - - 10 - ! . _ - 11 - - 12 - * - 13 - - 14 ----- ----- 15 - - 16 -, - 17 - - 18 - - 19 - - 20 - - 21 - - 22 -, - 23 - - 24 - - 25 - - 26 - - 27 - - 28 -, - 29 - - 30 - - 31 - - 32 - - 33 - - 34 -, - 35 - - 36 - - 37 - - 38 - - 39 - - 40 -, - 41 - - 42 - - 43 - - 44 - - 45 - - 46 -, - 47 - - 48 - - 49 - - 50 - - 51 - - 52 -, - 53 - - 54 - - 55 - - 56 - - 57 - - 58 -, - 59 - - 60 - - 61 - - 62 - - 63 - - 64 -, - 65 - - 66 - - 67 - - 68 - - 69 - - 70 -,,,,,,,- 19 71 20 72
Note: See TracChangeset
for help on using the changeset viewer.