- Timestamp:
- 2015-06-29 14:41:26 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/TapaniS/ProjectStar/ProjectStar/ProjectStar/ProjectStar.cs
r6510 r6518 10 10 { 11 11 Image taustaKuva = LoadImage("Kentta"); 12 Vector nopeusYlos = new Vector(0, 200); 13 Vector nopeusOikealle = new Vector(200, 0); 14 Vector nopeusVasemmalle = new Vector(-200, 0); 15 16 PhysicsObject ukko; 12 17 13 18 public override void Begin() … … 17 22 //Level.CreateBorders(); 18 23 24 ukko = new PhysicsObject( 40.0, 40.0); 25 26 for (int i = 0; i < 20; i++) 27 { 28 Vector kentanPiste = Level.GetRandomPosition(); 19 29 20 30 31 Add(ukko); 32 ukko.Color = Color.Purple; 33 34 PhysicsObject taso = PhysicsObject.CreateStaticObject(60.0, 20.0); 35 taso.IgnoresGravity = true; 36 Add(taso); 37 taso.Position = kentanPiste; 38 } 39 40 Gravity = new Vector(0.0, -800.0); 41 42 43 LiikutaUkkoa(); 44 21 45 // TODO: Kirjoita ohjelmakoodisi tähän 22 46 … … 24 48 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 25 49 } 50 51 void LiikutaUkkoa() 52 { 53 Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, "Ukko: Liikuta ukkoa ylös", ukko, nopeusYlos); 54 Keyboard.Listen(Key.D, ButtonState.Down, AsetaNopeus, "Ukko: Liikuta ukkoa oikealle", ukko, nopeusOikealle); 55 Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Ukko: Liikuta ukkoa oikealle", ukko, nopeusVasemmalle); 56 } 57 58 void AsetaNopeus(PhysicsObject Ukko, Vector nopeus) 59 { 60 ukko.Velocity = nopeus; 61 } 62 26 63 }
Note: See TracChangeset
for help on using the changeset viewer.