- Timestamp:
- 2010-07-07 14:54:44 (13 years ago)
- Location:
- 2010/27/viaawipi/samsh cubes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/viaawipi/samsh cubes/Peli.cs
r1127 r1151 3 3 using Jypeli.Widgets; 4 4 using Jypeli.Assets; 5 using Jypeli.Effects; 5 6 6 7 7 8 class Tasohyppely : PhysicsGame 8 9 { 10 const int rulev = 50; 11 const int rukor = 50; 9 12 const double nopeus = 200; 10 13 const double hyppyVoima = 3000; … … 25 28 26 29 // Zoomataan lähemmäksi 27 Camera.ZoomFactor = 1.0; 28 30 Camera.ZoomToLevel(); 29 31 Camera.StayInLevel = true; 30 32 31 33 seuraavaKentta(); 32 MessageDisplay.Add("Etsi iso tähti!");33 34 } 34 35 … … 53 54 void luoKentta() 54 55 { 56 TileMap ruudut = TileMap.FromFile("kentta.txt"); 57 ruudut['#'] = Luotaso; 58 ruudut.Insert(rulev, rukor); 59 55 60 Level.CreateBorders(); 56 61 Level.Background.CreateGradient(Color.White, Color.SkyBlue); 57 62 Level.Background.Image = LoadImage("aa"); 58 lisaaTaso(-200, -350); 59 lisaaTaso(0, -400); 60 lisaaTaso(200, -350); 61 lisaaTaso(-400, -300); 62 lisaaTaso(50, -400); 63 lisaaTaso(400, -300); 63 64 64 65 lisaaPelaajat(); 65 66 } 66 67 67 void lisaaTaso(double x, double y)68 PhysicsObject Luotaso() 68 69 { 69 PhysicsObject taso = PhysicsObject.CreateStaticObject(200, 100); 70 taso.Color = Color.Green; 71 taso.X = x; 72 taso.Y = y; 73 taso.Image = LoadImage("dd"); 74 Add(taso); 70 PhysicsObject taso = PhysicsObject.CreateStaticObject(50.0, 50.0); 71 return taso; 75 72 } 76 73 … … 104 101 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 105 102 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 103 Keyboard.Listen(Key.P, ButtonState.Pressed, poks1, "rajauta"); 104 Keyboard.Listen(Key.O, ButtonState.Pressed, poks2, "rajauta"); 105 Keyboard.Listen(Key.I, ButtonState.Pressed, HeitaKranaatti , "rajauta"); 106 106 107 107 Keyboard.Listen(Key.A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); … … 132 132 } 133 133 134 void PelaajaOsuu(PhysicsObject collidingObject, PhysicsObject otherObject)134 void PelaajaOsuu(PhysicsObject collidingObject, PhysicsObject pum) 135 135 { 136 { 137 } 136 138 137 } 138 void poks1() 139 { 140 Explosion rajahdys = new Explosion(10.0); 141 rajahdys.Position = pelaaja2.Position; 142 rajahdys.X-=40; 143 rajahdys.Y -= 25; 144 rajahdys.Speed = 1000.0; 145 rajahdys.Force =50; 146 rajahdys.ShockwaveColor = Color.Cyan; 147 Add(rajahdys); 148 } 149 void poks2() 150 { 151 Explosion rajahdys = new Explosion(10.0); 152 rajahdys.Position = pelaaja1.Position; 153 rajahdys.Y -= 15; 154 rajahdys.Speed = 1000.0; 155 rajahdys.Force =50; 156 rajahdys.ShockwaveColor = Color.Red; 157 Add(rajahdys); 158 } 159 void pumpum () 160 { 161 PhysicsObject pum = PhysicsObject.CreateStaticObject(20.0, 20.0); 162 pum.Position = pelaaja2.Position; 163 pum.Shape = Shapes.Circle; 164 Add(pum); 165 } 166 void HeitaKranaatti() 167 { 168 ClusterGrenade kranaatti = new ClusterGrenade(4.0, 2); 169 kranaatti.X = pelaaja1.X; 170 kranaatti.Y = pelaaja1.Y; 171 Add(kranaatti); 172 Vector heittoVoima = Vector.FromLengthAndAngle(10, Angle.Degrees(0)); 173 kranaatti.Hit(heittoVoima); 174 } 139 175 } -
2010/27/viaawipi/samsh cubes/samsh cubes.csproj
r1127 r1151 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="kentta.txt" /> 91 92 </ItemGroup> 92 93 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.