Changeset 8186


Ignore:
Timestamp:
2016-07-28 11:05:28 (3 years ago)
Author:
almajono
Message:
 
Location:
2016/30/AleksiN/name
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2016/30/AleksiN/name/name/name/name.cs

    r8168 r8186  
    66using Jypeli.Effects; 
    77using Jypeli.Widgets; 
    8  
     8using System.Linq; 
    99public class name : PhysicsGame 
    1010{ 
     
    1818    { 
    1919 
     20        Level.Width = Screen.Width * 25; 
     21 
    2022        SmoothTextures = true; 
    21         //IsFullScreen = true; 
    22         Camera.Follow(bikePhysicsObject); 
    23  
     23        IsFullScreen = false; 
     24         
    2425        AddPlayer(); 
    2526        Points(); 
    2627        Keys(); 
    2728 
    28         Surface level = Surface.CreateBottom(Level, 30, 100, 10, 100); 
     29        Camera.Follow(bikePhysicsObject); 
     30 
     31        Surface level = Surface.CreateBottom(Level, 200, 300, 200, 20); 
    2932        Add(level); 
    3033        Gravity = new Vector(0.0, -800.0); 
     
    5457        rightTire.Image = tire; 
    5558        bikePhysicsObject.Image = motorbike; 
    56         this.bike = new PhysicsStructure(leftTire, rightTire, bikePhysicsObject); 
     59        this.bike = new PhysicsStructure(rightTire, leftTire, bikePhysicsObject); 
    5760        bikePhysicsObject.IgnoresCollisionResponse = true; 
    5861        Add(this.bike); 
    5962        Add(bikePhysicsObject); 
     63        bike.KineticFriction = 1.0; 
     64        bike.Restitution = 1; 
     65        bike.Y += 100; 
    6066    } 
    6167    void Keys() 
    6268    { 
    63         Keyboard.Listen(Key.Down, ButtonState.Down, Movement, null, new Vector(-2000, 0)); 
    64         Keyboard.Listen(Key.Up, ButtonState.Down, Movement, null, new Vector(2000, 0)); 
    65         Keyboard.Listen(Key.Left, ButtonState.Down, ChangeAngle, null, 2.5); 
    66         Keyboard.Listen(Key.Right, ButtonState.Down, ChangeAngle, null, -2.5); 
     69        Keyboard.Listen(Key.Down, ButtonState.Down, Movement, null, new Vector(-3000, 0)); 
     70        Keyboard.Listen(Key.Up, ButtonState.Down, Movement, null, new Vector(3000, 0)); 
     71        Keyboard.Listen(Key.Left, ButtonState.Down, ChangeAngle, null, 1.0); 
     72        Keyboard.Listen(Key.Right, ButtonState.Down, ChangeAngle, null, -1.0); 
    6773        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    6874    } 
    6975    void Movement(Vector movement) 
    7076    { 
    71         bike.Push(movement); 
     77        if(GetObjectAt(bikePhysicsObject.Position - new Vector(0, bike.Height / 2) * 0.9, 0.1) != null) 
     78        { 
     79            bike.Push(movement); 
     80        } 
    7281    } 
    7382    void ChangeAngle(double ammount) 
Note: See TracChangeset for help on using the changeset viewer.