- Timestamp:
- 2012-07-04 14:35:49 (9 years ago)
- Location:
- 2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3.cs
r3492 r3540 10 10 { 11 11 PlatformCharacter pelaaja1; 12 Image[] ssprites = LoadImages("run 1", "run 2", "run 3"); 12 13 Image[] pictures = LoadImages("ff", "stand 2", "stand 3", "stand 4"); 14 Image[] kävelyVasemmalle; 15 Image[] vasemmallePaikallaan; 16 Image[] vasemmalleTippuminen; 17 Image[] tippumisAnimaatio = LoadImages("fall 1","fall 2"); 13 18 public override void Begin() 14 19 { 15 20 // TODO: Kirjoita ohjelmakoodisi tähän 21 MediaPlayer.Play( "Kalimba" ); 22 kävelyVasemmalle = Image.Mirror(ssprites); 23 vasemmallePaikallaan = Image.Mirror(pictures); 24 vasemmalleTippuminen = Image.Mirror(tippumisAnimaatio); 16 25 LuoPelaaja(); 26 Gravity = new Vector(0, -500); 27 Level.CreateBorders(); 17 28 keyboard(); 18 29 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 21 32 void LuoPelaaja() 22 33 { 23 pelaaja1 = new PlatformCharacter(8 3.0, 94.0);34 pelaaja1 = new PlatformCharacter(85.0, 96.0); 24 35 Add(pelaaja1); 25 pelaaja1.Animation = new Animation(pictures); 26 pelaaja1.Animation.Start(); 27 pelaaja1.Animation.FPS = 5; 36 pelaaja1.RightIdleAnimation = new Animation(pictures); 37 pelaaja1.RightIdleAnimation.FPS = 7; 38 pelaaja1.LeftIdleAnimation = new Animation(vasemmallePaikallaan); 39 pelaaja1.LeftIdleAnimation.FPS = 7; 40 pelaaja1.RightWalkingAnimation = new Animation(ssprites); 41 pelaaja1.RightWalkingAnimation.FPS = 18; 42 pelaaja1.LeftWalkingAnimation = new Animation(kävelyVasemmalle); 43 pelaaja1.LeftWalkingAnimation.FPS = 18; 44 AddCollisionHandler(pelaaja1,palautaAnimation); 45 } 46 void palautaAnimation(PhysicsObject tormaaja, PhysicsObject kohde) 47 { 48 pelaaja1.RightIdleAnimation = new Animation(pictures); 49 pelaaja1.RightIdleAnimation.FPS = 7; 50 pelaaja1.LeftIdleAnimation = new Animation(vasemmallePaikallaan); 51 pelaaja1.LeftIdleAnimation.FPS = 7; 52 pelaaja1.RightWalkingAnimation = new Animation(ssprites); 53 pelaaja1.RightWalkingAnimation.FPS = 18; 54 pelaaja1.LeftWalkingAnimation = new Animation(kävelyVasemmalle); 55 pelaaja1.LeftWalkingAnimation.FPS = 18; 28 56 } 29 57 30 58 void keyboard() 31 59 { 32 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, pelaaja1 );33 //.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null);34 60 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, pelaaja1, -50.0); 61 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, pelaaja1,50.0 ); 62 Keyboard.Listen(Key.Up, ButtonState.Down, hyppaa, null, pelaaja1); 35 63 } 36 void LiikutaPelaajaa(PlatformCharacter pelaaja )64 void LiikutaPelaajaa(PlatformCharacter pelaaja,double Nopeus ) 37 65 38 66 { 39 pelaaja.Walk(20.0); 40 41 67 pelaaja.Walk(Nopeus); 68 69 } 70 void hyppaa(PlatformCharacter pelaaja) 71 { 72 pelaaja.Jump(200.0); 73 pelaaja.RightWalkingAnimation = pelaaja.RightIdleAnimation = new Animation(tippumisAnimaatio); 74 pelaaja.RightWalkingAnimation.FPS = 4; 75 pelaaja.RightIdleAnimation.FPS = 4; 76 pelaaja.LeftWalkingAnimation = pelaaja.LeftIdleAnimation = new Animation(vasemmalleTippuminen); 77 pelaaja.LeftWalkingAnimation.FPS = 4; 78 pelaaja.LeftIdleAnimation.FPS = 4; 42 79 } 43 80 } -
2012/27/MattiR/FysiikkaPeli3/FysiikkaPeli3/FysiikkaPeli3Content/FysiikkaPeli3Content.contentproj
r3492 r3540 55 55 <Processor>TextureProcessor</Processor> 56 56 </Compile> 57 <Compile Include="stand 4.png"> 58 <Name>stand 4</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 63 <ItemGroup> 57 64 <Compile Include="stand 3.png"> 58 65 <Name>stand 3</Name> … … 60 67 <Processor>TextureProcessor</Processor> 61 68 </Compile> 62 <Compile Include="stand 4.png"> 63 <Name>stand 4</Name> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="run 1.png"> 72 <Name>run 1</Name> 64 73 <Importer>TextureImporter</Importer> 65 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 <Compile Include="run 2.png"> 77 <Name>run 2</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 <Compile Include="run 3.png"> 82 <Name>run 3</Name> 83 <Importer>TextureImporter</Importer> 84 <Processor>TextureProcessor</Processor> 85 </Compile> 86 </ItemGroup> 87 <ItemGroup> 88 <Compile Include="fall 1.png"> 89 <Name>fall 1</Name> 90 <Importer>TextureImporter</Importer> 91 <Processor>TextureProcessor</Processor> 92 </Compile> 93 </ItemGroup> 94 <ItemGroup> 95 <Compile Include="fall 2.png"> 96 <Name>fall 2</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 </Compile> 100 </ItemGroup> 101 <ItemGroup> 102 <Compile Include="Kalimba.mp3"> 103 <Name>Kalimba</Name> 104 <Importer>Mp3Importer</Importer> 105 <Processor>SongProcessor</Processor> 66 106 </Compile> 67 107 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.