Changeset 6559 for 2015


Ignore:
Timestamp:
2015-06-30 10:51:15 (8 years ago)
Author:
iisaaira
Message:

gasdfgdf

Location:
2015/27/TapaniS
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/TapaniS/ProjectStar/ProjectStar/ProjectStar/ProjectStar.cs

    r6518 r6559  
    99public class ProjectStar : PhysicsGame 
    1010{ 
    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  
    1811    public override void Begin() 
    1912    { 
    20         Level.Background.Image = taustaKuva; 
    21         Camera.ZoomToLevel(); 
    22         //Level.CreateBorders(); 
     13        // TODO: Kirjoita ohjelmakoodisi tähän 
    2314 
    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än 
    4615 
    4716        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    4817        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    4918    } 
    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  
    6319} 
Note: See TracChangeset for help on using the changeset viewer.