- Timestamp:
- 2015-06-30 10:51:15 (8 years ago)
- Location:
- 2015/27/TapaniS
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/TapaniS/ProjectStar/ProjectStar/ProjectStar/ProjectStar.cs
r6518 r6559 9 9 public class ProjectStar : PhysicsGame 10 10 { 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;17 18 11 public override void Begin() 19 12 { 20 Level.Background.Image = taustaKuva; 21 Camera.ZoomToLevel(); 22 //Level.CreateBorders(); 13 // TODO: Kirjoita ohjelmakoodisi tähän 23 14 24 ukko = new PhysicsObject( 40.0, 40.0);25 26 for (int i = 0; i < 20; i++)27 {28 Vector kentanPiste = Level.GetRandomPosition();29 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 45 // TODO: Kirjoita ohjelmakoodisi tähän46 15 47 16 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 48 17 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 49 18 } 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 63 19 }
Note: See TracChangeset
for help on using the changeset viewer.