Ignore:
Timestamp:
2012-06-05 10:36:54 (11 years ago)
Author:
ramipasa
Message:

Alallalallalalalalall

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/YAG2DSS.cs

    r2785 r2788  
    1313{ 
    1414    ALTKHandler altkHandler; 
    15     PhysicsObject po; 
    1615    GameObject Kursori; 
    17  
    18     ExplosionSystem expSystem; 
    1916 
    2017    public override void Begin() 
    2118    { 
     19        #region Cursor handling 
    2220        Kursori = new GameObject(32, 32); 
    2321        Kursori.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "cursor.png")); 
     
    2624        Mouse.ListenMovement(0.1, handler, ""); 
    2725        Add(Kursori); 
     26        #endregion 
    2827 
    29         expSystem = new ExplosionSystem(Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "communist_trollface.png")), 500); 
    30         Add(expSystem); 
     28        //PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     29        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ShowExit, "Lopeta peli"); 
     30    } 
    3131 
    32         PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    33         Keyboard.Listen(Key.Escape, ButtonState.Pressed, ShowExit, "Lopeta peli"); 
    34         Keyboard.Listen(Key.LeftControl, ButtonState.Down, ShootProjectile, ""); 
    35  
    36         //IsMouseVisible = true; 
    37  
    38         Level.CreateBorders(0.5, false); 
    39  
    40         po = new PhysicsObject(50.0, 50.0); 
    41         po.Shape = Shape.Octagon; 
    42         po.X = -200; 
    43         po.Y = -150.0; 
    44         po.Restitution = 1.0; 
    45         po.AngularDamping = 0.02; 
    46         po.MomentOfInertia = 50.0; 
    47         AddCollisionHandler(po, HandleCollision); 
    48         po.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "communist_trollface.png")); 
    49         Add(po); 
    50         //AddCollisionHandler(po,  
    51         po.Hit(new Vector(500.0, 0.0)); 
    52  
    53         Light light = new Light(); 
    54         light.Distance = 75.0; 
    55         light.Intensity = 0.75; 
    56         Add(light); 
    57     } 
     32    #region XNA / ALTK-Based Code 
    5833 
    5934    private void HandleCursor(AnalogState analogState) 
    6035    { 
    6136        Kursori.AbsolutePosition = new Vector(Kursori.Position.X + analogState.MouseMovement.X, Kursori.Position.Y + analogState.MouseMovement.Y); 
    62     } 
    63  
    64     private void HandleCollision(PhysicsObject x, PhysicsObject y) 
    65     { 
    66         if (x.Velocity.X < 0) 
    67         { 
    68             if (x.Velocity.Y < 0) 
    69             { 
    70                 ALTKHandler.StaticAnimHandler.AddStaticAnim(0, new Microsoft.Xna.Framework.Vector2(Convert.ToSingle(x.Right), Convert.ToSingle(x.Bottom))); 
    71             } 
    72             else 
    73             { 
    74                 ALTKHandler.StaticAnimHandler.AddStaticAnim(0, new Microsoft.Xna.Framework.Vector2(Convert.ToSingle(x.Right), Convert.ToSingle(x.Top))); 
    75             } 
    76         } 
    77         else 
    78         { 
    79             if (x.Velocity.Y < 0) 
    80             { 
    81                 ALTKHandler.StaticAnimHandler.AddStaticAnim(0, new Microsoft.Xna.Framework.Vector2(Convert.ToSingle(x.Left), Convert.ToSingle(x.Bottom))); 
    82             } 
    83             else 
    84             { 
    85                 ALTKHandler.StaticAnimHandler.AddStaticAnim(0, new Microsoft.Xna.Framework.Vector2(Convert.ToSingle(x.Left), Convert.ToSingle(x.Top))); 
    86             } 
    87         } 
    88  
    89         expSystem.AddEffect(new Vector(x.X, x.Y), 1000); 
    9037    } 
    9138 
     
    9542 
    9643        InitALTK(); 
    97     } 
    98  
    99     private void ShootProjectile() 
    100     { 
    101         Projectile proj = new Projectile(40.0, 10.0, Color.Red); 
    102         proj.Position = Vector.ComponentProduct(po.Position, Vector.FromLengthAndAngle(po.Width, po.Angle)); 
    103         proj.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "communist_trollface.png")); 
    104         Add(proj); 
    105         proj.Hit(Vector.FromLengthAndAngle(100.0, po.Angle)); 
    10644    } 
    10745 
     
    13371        //MessageDisplay.Add(Convert.ToString(ALTK.Cursor.SecPosX + "; " + ALTK.Cursor.SecPosY)); 
    13472 
    135         if (Keyboard.GetKeyState(Key.Up) == ButtonState.Down) 
    136         { 
    137             Vector impulssi = Vector.FromLengthAndAngle(2.0, po.Angle); 
    138             po.Hit(impulssi); 
    139         } 
     73        //if (Keyboard.GetKeyState(Key.Up) == ButtonState.Down) 
     74        //{ 
     75        //    Vector impulssi = Vector.FromLengthAndAngle(2.0, po.Angle); 
     76        //    po.Hit(impulssi); 
     77        //} 
    14078 
    141         if (Keyboard.GetKeyState(Key.Left) == ButtonState.Down) 
    142         { 
    143             po.Angle = Angle.FromDegrees(po.Angle.Degrees - 5.0); 
    144         } 
     79        //if (Keyboard.GetKeyState(Key.Left) == ButtonState.Down) 
     80        //{ 
     81        //    po.Angle = Angle.FromDegrees(po.Angle.Degrees - 5.0); 
     82        //} 
    14583 
    146         if (Keyboard.GetKeyState(Key.Right) == ButtonState.Down) 
    147         { 
    148             po.Angle = Angle.FromDegrees(po.Angle.Degrees + 5.0); 
    149         } 
     84        //if (Keyboard.GetKeyState(Key.Right) == ButtonState.Down) 
     85        //{ 
     86        //    po.Angle = Angle.FromDegrees(po.Angle.Degrees + 5.0); 
     87        //} 
    15088 
    151         if (Keyboard.GetKeyState(Key.Down) == ButtonState.Down) 
    152         { 
    153             if (po.Velocity.Angle == po.Angle) 
    154             { 
    155                 Vector impulssi = Vector.FromLengthAndAngle(-2.0, po.Angle); 
    156                 po.Hit(impulssi); 
    157             } 
    158         } 
     89        //if (Keyboard.GetKeyState(Key.Down) == ButtonState.Down) 
     90        //{ 
     91        //    if (po.Velocity.Angle == po.Angle) 
     92        //    { 
     93        //        Vector impulssi = Vector.FromLengthAndAngle(-2.0, po.Angle); 
     94        //        po.Hit(impulssi); 
     95        //    } 
     96        //} 
    15997 
    16098        if (ALTK.GameHandler.DoUpdate) 
     
    191129        } 
    192130    } 
     131 
     132    #endregion 
    193133} 
Note: See TracChangeset for help on using the changeset viewer.