- Timestamp:
- 2015-06-09 15:04:16 (7 years ago)
- Location:
- 2015/24/OskariL
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/24/OskariL/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.cs
r5929 r5949 2 2 using Jypeli.Controls; 3 3 using Jypeli.Widgets; 4 4 using Jypeli.Effects; 5 using Jypeli.Content; 6 using Jypeli.Assets; 7 using Jypeli.GameObjects; 5 8 public class Tasohyppelypeli1 : PhysicsGame 6 9 { … … 21 24 22 25 Timer liikutusajastin; 26 Timer liikutusajastin2; 27 28 EasyHighScore topLista = new EasyHighScore(); 23 29 24 30 25 31 public override void Begin() 26 32 { 27 Gravity = new Vector(0, -1000); 33 Gravity = new Vector(0, -1900); 34 35 SetWindowSize((int)(Screen.Width), (int)Screen.Height); 28 36 29 37 LuoKentta(); … … 32 40 33 41 Camera.Follow(pelaaja1); 34 Camera.ZoomFactor = 1.2;35 Camera.StayInLevel = false;42 Camera.ZoomFactor = 2; 43 Camera.StayInLevel = true; 36 44 37 45 liikutusajastin = new Timer(); … … 40 48 liikutusajastin.Start(); 41 49 50 liikutusajastin2 = new Timer(); 51 liikutusajastin2.Interval = 0.01; 52 liikutusajastin2.Timeout += SiirraPelaajaaVasemmalle; 53 54 42 55 peliKaynnissa = true; 43 56 44 57 58 } 59 void SiirraPelaajaaVasemmalle() 60 { 61 pelaaja1.Push(new Vector(nopeus, 0.0)); 45 62 } 46 63 void SiirraPelaajaaOikeammalle() … … 58 75 kentta.SetTileMethod('P', LisaaPahis); 59 76 kentta.SetTileMethod('p', LuoParsakaali); 60 kentta.Execute(); 77 kentta.SetTileMethod('B', LisaaPommi); 78 kentta.Execute(20, 20); 61 79 62 80 Level.CreateLeftBorder(); … … 66 84 oikeaReuna.Tag = "oikea"; 67 85 68 69 86 Level.Background.CreateGradient(Color.SkyBlue, Color.Azure); 70 87 } … … 74 91 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 75 92 taso.Position = paikka; 76 taso.Color = Color.Emerald;93 taso.Color = new Color(4, 146, 208); 77 94 taso.Tag = "seina"; 78 95 … … 94 111 pelaaja1 = new PlatformCharacter(leveys, korkeus); 95 112 pelaaja1.Position = paikka; 96 pelaaja1.Mass = 3. 0;113 pelaaja1.Mass = 3.25; 97 114 pelaaja1.Image = pelaajanKuva; 98 115 AddCollisionHandler(pelaaja1, "seina", TormaaTasoon); … … 100 117 AddCollisionHandler(pelaaja1, "vihu", TormaaTasoon); 101 118 AddCollisionHandler(pelaaja1, "oikea", TormaaOikeaanReunaan); 119 AddCollisionHandler(pelaaja1, "pommi", Rajahdys); 120 102 121 Add(pelaaja1); 103 122 } … … 106 125 PhysicsObject vihollinen = new PhysicsObject(leveys, korkeus); 107 126 vihollinen.Color = Color.Azure; 108 vihollinen.Shape = Shape. Octagon;127 vihollinen.Shape = Shape.Rectangle; 109 128 vihollinen.Position = paikka; 110 129 vihollinen.IgnoresGravity = true; … … 113 132 114 133 } 134 void LisaaPommi(Vector paikka, double leveys, double korkeus) 135 { 136 PhysicsObject pommi = new PhysicsObject(leveys, korkeus); 137 pommi.Color = Color.Black; 138 pommi.Shape = Shape.Triangle; 139 pommi.Position = paikka; 140 pommi.IgnoresGravity = true; 141 pommi.CanRotate = true; 142 pommi.Tag = "pommi"; 143 144 Add(pommi); 145 146 147 } 115 148 void LisaaPahis(Vector paikka, double leveys, double korkeus) 116 149 { 117 118 150 119 151 PhysicsObject pahis = new PhysicsObject(leveys, korkeus); … … 156 188 void Hyppaa(PlatformCharacter hahmo, double nopeus) 157 189 { 158 hahmo. Jump(nopeus);190 hahmo.ForceJump(nopeus); 159 191 } 160 192 … … 185 217 pisteNaytto.Title = "Pisteet:"; 186 218 pisteNaytto.BindTo(pisteLaskuri); 187 pisteLaskuri.AddOverTime(-3, 10);188 219 Add(pisteNaytto); 189 220 } 221 190 222 void TormaaTasoon(PhysicsObject tormaaja, PhysicsObject kohde) 191 223 { … … 193 225 { 194 226 MessageDisplay.Add("Kuolit! :("); 195 Keyboard.Disable(Key.Up);196 liikutusajastin.Stop();197 peliKaynnissa = false;227 // Keyboard.Disable(Key.Up); 228 // liikutusajastin.Stop(); 229 // peliKaynnissa = false; 198 230 } 199 231 200 232 } 201 233 … … 203 235 { 204 236 MessageDisplay.Add("Pääsit kentän läpi"); 205 Gravity = Vector.Zero; 206 StopAll(); 207 Keyboard.Disable(Key.Up); 208 209 } 210 211 212 237 liikutusajastin.Stop(); 238 liikutusajastin2.Start(); 239 pisteLaskuri.Value += 10; 240 } 241 242 void Rajahdys(PhysicsObject pelaaja1, PhysicsObject pommi) 243 { 244 Explosion rajahdys = new Explosion(100); 245 rajahdys.Position = pommi.Position; 246 rajahdys.Speed = 400.0; 247 rajahdys.Force = 36; 248 //rajahdys.ShockwaveColor = new Color(4, 146, 208); 249 Add(rajahdys); 250 251 } 252 213 253 } -
2015/24/OskariL/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/ContentPipeline-{D1054F62-B0A3-4AC6-A229-ECA6D20A1699}.xml
r5929 r5949 18 18 <Options>None</Options> 19 19 <Output>C:\MyTemp\OskariL\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta1.xnb</Output> 20 <Time>2015-06-09T1 1:03:23.5645603+03:00</Time>20 <Time>2015-06-09T14:53:59.8064603+03:00</Time> 21 21 </Item> 22 22 <Item> -
2015/24/OskariL/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/Tasohyppelypeli1Content.contentproj
r5929 r5949 78 78 </Compile> 79 79 </ItemGroup> 80 <ItemGroup> 81 <Compile Include="kartta.png"> 82 <Name>kartta</Name> 83 <Importer>TextureImporter</Importer> 84 <Processor>TextureProcessor</Processor> 85 </Compile> 86 </ItemGroup> 80 87 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 81 88 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/24/OskariL/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta1.txt
r5929 r5949 1 ############################################################################ 2 ............................................................................ 3 ..............*.........................*................................... 4 N..........V......VV........*............................................... 5 .....*.......................p....................p......................... 6 ..............V....*........................................p............... 7 .........P...........V....*................*................................ 8 .........P.................................................................. 9 .........P...V......**.........*.......*.........*.......................... 10 ......p.V.V......V......**............*....*....p........*.......*.......... 11 ............................................................................ 12 VVVVVVVVVVVVVV.........V..VVVVVVVVVVVVV.....VVVVV...VVVVVV.....VVV.......VV. 13 ..................VVV.................VV.........VVVp.V.............VVVVVV.. 14 ############################################################################ 1 ################################################################################################################## 2 ######## ###### 3 ######## ###### 4 ######## ###### 5 ######## N ###### 6 ######## ###### 7 ######## ###### 8 ######## ###### 9 ######## ###### 10 ######## ###### 11 ######## ###### 12 ######## ###### 13 ######## ###### 14 ######## ###### 15 ######## ###### 16 ##################################################################################################################
Note: See TracChangeset
for help on using the changeset viewer.