Ignore:
Timestamp:
2017-07-04 11:54:53 (4 years ago)
Author:
npo17_42
Message:

tekeminen jatkuu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2017/27/OskariK/OK/OK/OK/OK.cs

    r8840 r8863  
    77using Jypeli.Widgets; 
    88 
    9 public class OK : Game 
     9public class OK : PhysicsGame 
    1010{ 
    11     PhysicsObject command; 
    12     PhysicsObject feed; 
     11    GameObject command; 
     12    GameObject feed; 
     13    GameObject portrait; 
     14    GameObject foe; 
     15 
     16    PhysicsObject Pointer; 
     17 
     18    Vector nopeusYlos = new Vector(0, 100); 
     19    Vector nopeusAlas = new Vector(0, -100); 
     20    Vector nopeusVasen = new Vector(-200, 0); 
     21    Vector nopeusOikea = new Vector(200, 0); 
     22 
    1323    public override void Begin() 
    1424    { 
    1525        LuoAlue(); 
     26        luopelaaja(); 
    1627        Kontrollit(); 
    1728 
     
    2334        Level.Background.Color = Color.White; 
    2435 
    25         command = new PhysicsObject(400.0, 300.0); 
     36        command = new GameObject(450.0, 300.0); 
    2637        command.Shape = Shape.Rectangle; 
    2738        command.Color = Color.Black; 
    28         command.X = 100.00; 
    29         command.Y = -250.00; 
     39        command.X = 370.00; 
     40        command.Y = -330.00; 
     41        command.Image = LoadImage("Kökkö"); 
    3042        Add(command); 
    3143 
    32         feed = new PhysicsObject(700.00, 300.00); 
     44        feed = new GameObject(1000.00, 300.00); 
    3345        feed.Shape = Shape.Rectangle; 
    3446        feed.Color = Color.Black; 
    35         feed.X = -500.00; 
    36         feed.Y = -250.00; 
     47        feed.X = -400.00; 
     48        feed.Y = -330.00; 
    3749        Add(feed); 
    3850 
    39         portrait = new PhysicsObject(100.00, 300.00); 
     51        portrait = new GameObject(250.00, 300.00); 
     52        portrait.Shape = Shape.Rectangle; 
     53        portrait.Color = Color.Black; 
     54        portrait.X = 750.00; 
     55        portrait.Y = -330.00; 
     56        Add(portrait); 
     57 
     58        foe = new GameObject(1800.00, 700.00); 
     59        foe.Shape = Shape.Rectangle; 
     60        foe.Color = Color.Blue; 
     61        foe.X = -10.00; 
     62        foe.Y = 200.00; 
     63        Add(foe); 
    4064    } 
    4165 
     66    PhysicsObject luopelaaja() 
     67    { 
     68        Pointer = new PhysicsObject (10.0, 10.0); 
     69        Pointer.Color = Color.White; 
     70        Pointer.X = 190.00; 
     71        Pointer.Y = -220.00; 
     72        Add(Pointer,3); 
     73        return Pointer; 
     74  } 
     75 
     76    void AsetaNopeus(PhysicsObject Pointer, Vector nopeus) 
     77    { 
     78        Vector sijainti = Pointer.Position + nopeus; 
     79        if (sijainti.Y > command.Top) return; 
     80        else if (sijainti.Y < command.Bottom) return; 
     81 
     82        Pointer.MoveTo(Pointer.Position + nopeus, 1000.00); 
     83         
     84    } 
    4285    void Kontrollit () 
    43     { Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); } 
     86    { 
     87        Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 
     88        //Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 
     89 
     90        Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); 
     91        //Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 
     92 
     93        //Keyboard.Listen(Key.Left, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusVasen); 
     94        ///Keyboard.Listen(Key.Left, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 
     95 
     96        //Keyboard.Listen(Key.Right, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusOikea); 
     97        //Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 
     98 
     99        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); } 
    44100} 
Note: See TracChangeset for help on using the changeset viewer.