Changeset 4642
- Timestamp:
- 2013-07-24 15:07:13 (10 years ago)
- Location:
- 2013/30/JesseM/alone in the dark
- Files:
-
- 39 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/30/JesseM/alone in the dark/alone in the dark/alone in the dark/alone_in_the_dark.cs
r4587 r4642 9 9 public class alone_in_the_dark : PhysicsGame 10 10 { 11 Image olionKuva = LoadImage("ukkeli"); 12 Image[] ukkelinKavely = LoadImages("animaatio", "animaatio2"); 13 14 PhysicsObject pelaaja; 15 16 const double nopeus = 555; 17 11 18 public override void Begin() 12 19 { … … 23 30 //ruudut.SetTileMethod(Color.yellow, LuoHirvio); 24 31 ruudut.SetTileMethod("0026FF", LuoOvi); 25 32 ruudut.SetTileMethod("FF006E", LuoPelaaja); 26 33 ruudut.Execute(20, 20); 27 34 Level.BackgroundColor = Color.Gray; 28 Camera.ZoomToLevel(); 35 //Camera.ZoomToLevel(); 36 Camera.Follow(pelaaja); 37 Camera.ZoomFactor = 10.5; 38 39 IsMouseVisible = true; 29 40 } 30 41 … … 48 59 } 49 60 50 { 61 void LuoPelaaja(Vector paikka, Double leveys, Double korkeus) 62 { 63 pelaaja = new PhysicsObject(10, 10); 64 pelaaja.Position = paikka; 65 pelaaja.Color = Color.Pink; 66 pelaaja.LinearDamping = 0.8; 67 Add(pelaaja); 68 pelaaja.Animation = new Animation(ukkelinKavely); 69 pelaaja.Animation.FPS = 10; 70 //pelaaja.Animation.Start(); 71 //pelaaja.Image = olionKuva; 72 pelaaja.CanRotate = false; 73 LuoNappaimet(pelaaja); 74 } 51 75 76 void LuoNappaimet(PhysicsObject pelaaja) 77 { 78 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, nopeus), pelaaja); 79 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0,-nopeus), pelaaja); 80 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-nopeus, 0), pelaaja); 81 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(nopeus, 0), pelaaja); 82 Keyboard.Listen(Key.W, ButtonState.Released, animaationpysaytys, null); 83 Keyboard.Listen(Key.S, ButtonState.Released, animaationpysaytys, null); 84 Keyboard.Listen(Key.A, ButtonState.Released, animaationpysaytys, null); 85 Keyboard.Listen(Key.D, ButtonState.Released, animaationpysaytys, null); 86 Mouse.ListenMovement(0.5, Tahtaa, "Tähtää aseella"); 87 } 52 88 89 void LiikutaPelaajaa(Vector vektori, PhysicsObject pelaaja) 90 { 91 pelaaja.Push(vektori); 92 pelaaja.Animation.Resume(); 93 } 94 95 void Tahtaa(AnalogState hiirenLiike) 96 { 97 Vector suunta = (Mouse.PositionOnWorld - pelaaja.AbsolutePosition).Normalize(); 98 pelaaja.Angle = suunta.Angle - Angle.RightAngle; 99 } 100 101 void animaationpysaytys() 102 103 { 104 pelaaja.Animation.Stop(); 105 } 53 106 } 54 107 … … 56 109 57 110 58 } -
2013/30/JesseM/alone in the dark/alone in the dark/alone in the darkContent/alone in the darkContent.contentproj
r4587 r4642 52 52 </Compile> 53 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="ukkeli.png"> 56 <Name>ukkeli</Name> 57 <Importer>TextureImporter</Importer> 58 <Processor>TextureProcessor</Processor> 59 </Compile> 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="animaatio.png"> 63 <Name>animaatio</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="animaatio2.png"> 70 <Name>animaatio2</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 54 75 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 55 76 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.