Changeset 5256 for 2014/27


Ignore:
Timestamp:
2014-07-01 22:08:24 (5 years ago)
Author:
mijoilmo
Message:

Tein liikkumisen uudestaan. Outo bugi että lieska ei näy kun peruuttaa vaikka pitäisi periaatteessa koodin mukaan näkyä.

Location:
2014/27/AleksanteriV
Files:
8 added
16 edited

Legend:

Unmodified
Added
Removed
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Player.cs

    r5254 r5256  
    99public class Player : PhysicsObject 
    1010{ 
     11    GameObject thrusterEffect; 
    1112    public void rotate(double rotSpeed) 
    1213    { 
    13         this.Angle += Angle.FromDegrees(rotSpeed); 
     14        this.AngularVelocity = rotSpeed; 
    1415    } 
    15     public void throttle() 
     16    public void thrusterStart(double speed) 
    1617    { 
    17         this.Push(Vector.FromLengthAndAngle(100, this.Angle + Angle.RightAngle)); 
     18        this.thrusterEffect.IsVisible = true; 
     19        this.Push(Vector.FromLengthAndAngle(speed*800, this.Angle + Angle.RightAngle)); 
     20    } 
     21    public void thrusterEnd() 
     22    { 
     23        this.thrusterEffect.IsVisible = false; 
     24        //if this.ids, enable ids 
    1825    } 
    1926    public Player() 
     
    2128    { 
    2229        this.Image = Proto236b.images["player"]; 
    23         this.AngularDamping = 0.5; 
     30        bool IDS = true; //inertial dampening system, katsotaan pistetäänkö ostettavaksi peliin 
     31        if (IDS == true) 
     32        { 
     33            this.LinearDamping = 0.97; 
     34        } 
     35        else 
     36        { 
     37            this.LinearDamping = 1; 
     38        } 
     39        this.AngularDamping = 0.7; 
     40 
     41        this.thrusterEffect = new GameObject(40,40); 
     42        thrusterEffect.Image = Proto236b.images["player_thruster"]; 
     43        thrusterEffect.IsVisible = false; 
     44        thrusterEffect.Y -= 20; 
     45        Add(thrusterEffect); 
    2446    } 
    2547} 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor.cs

    r5254 r5256  
    1616    { 
    1717        Keyboard.Listen(Key.Escape, ButtonState.Down, Exit, "Lopeta Peli"); 
    18         Keyboard.Listen(Key.Up, ButtonState.Down, player.throttle, "Lento"); 
    19         Keyboard.Listen(Key.Left, ButtonState.Down, player.rotate, "Lento", 2.8); 
    20         Keyboard.Listen(Key.Right, ButtonState.Down, player.rotate, "Lento", -2.8); 
     18        Keyboard.Listen(Key.Up, ButtonState.Down, player.thrusterStart, "Lento", 1.0); 
     19        Keyboard.Listen(Key.Up, ButtonState.Up, player.thrusterEnd, "Lento"); 
     20        Keyboard.Listen(Key.Down, ButtonState.Down, player.thrusterStart, "Lento", -0.2); 
     21        Keyboard.Listen(Key.Down, ButtonState.Up, player.thrusterEnd, "Lento"); 
     22        Keyboard.Listen(Key.Left, ButtonState.Down, player.rotate, "Lento", 4.0); 
     23        Keyboard.Listen(Key.Right, ButtonState.Down, player.rotate, "Lento", -4.0); 
    2124    } 
    2225    void LoadAllImages() 
    2326    { 
    24         images["background0"] = LoadImage("graphics/backgrounds/space_background"); 
    25         images["player"] = LoadImage("graphics/ships/player"); 
    26         images["tile0"] = LoadImage("graphics/tiles/tile0.png"); 
     27        images["background0"] =                 LoadImage("graphics/backgrounds/space_background"); 
     28        images["player"] =                      LoadImage("graphics/ships/player"); 
     29        images["player_thruster"] =             LoadImage("graphics/effects/thrusters/thruster0.1"); 
     30        images["tile0"] =                       LoadImage("graphics/tiles/tile0.png"); 
    2731    } 
    2832    void LoadLevel(string level) 
     
    3034        ClearAll(); 
    3135        Add(this.player); 
     36        Camera.Follow(this.player); 
    3237        AssignKeys(); 
    3338        LevelFromImage("graphics/levels/" + level); 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor.csproj.Debug.cachefile

    r5254 r5256  
    33Content\graphics\ships\player.xnb 
    44Content\graphics\levels\test.xnb 
     5Content\graphics\effects\thrusters\thruster0.1.xnb 
     6Content\graphics\effects\thrusters\thruster0.2.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/obj/x86/Debug/Protokolla236TrueSurvivor.csproj.FileListAbsolute.txt

    r5254 r5256  
    2222D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\obj\x86\Debug\Protokolla236TrueSurvivor.pdb 
    2323D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\levels\test.xnb 
     24D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\effects\thrusters\thruster0.1.xnb 
     25D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\effects\thrusters\thruster0.2.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/obj/x86/Debug/cachefile-{5156C658-EF8C-4216-BA6D-9928D133FE72}-targetpath.txt

    r5254 r5256  
    33Content\graphics\ships\player.xnb 
    44Content\graphics\levels\test.xnb 
     5Content\graphics\effects\thrusters\thruster0.1.xnb 
     6Content\graphics\effects\thrusters\thruster0.2.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivorContent/Protokolla236TrueSurvivorContent.contentproj

    r5254 r5256  
    7676    </Compile> 
    7777  </ItemGroup> 
     78  <ItemGroup> 
     79    <Compile Include="graphics\effects\thrusters\thruster0.1.png"> 
     80      <Name>thruster0.1</Name> 
     81      <Importer>TextureImporter</Importer> 
     82      <Processor>TextureProcessor</Processor> 
     83    </Compile> 
     84    <Compile Include="graphics\effects\thrusters\thruster0.2.png"> 
     85      <Name>thruster0.2</Name> 
     86      <Importer>TextureImporter</Importer> 
     87      <Processor>TextureProcessor</Processor> 
     88    </Compile> 
     89  </ItemGroup> 
    7890  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    7991  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivorContent/obj/x86/Debug/ContentPipeline.xml

    r5254 r5256  
    3636      <Options>None</Options> 
    3737      <Output>D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\levels\test.xnb</Output> 
    38       <Time>2014-07-01T21:19:39.9080298+03:00</Time> 
     38      <Time>2014-07-01T22:04:07.5999133+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>graphics\effects\thrusters\thruster0.1.png</Source> 
     42      <Name>graphics\effects\thrusters\thruster0.1</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\effects\thrusters\thruster0.1.xnb</Output> 
     47      <Time>2014-07-01T20:02:35.7742205+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>graphics\effects\thrusters\thruster0.2.png</Source> 
     51      <Name>graphics\effects\thrusters\thruster0.2</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>D:\Csharp feat jypeli\AleksanteriV2014\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\effects\thrusters\thruster0.2.xnb</Output> 
     56      <Time>2014-07-01T20:02:35.7952206+03:00</Time> 
    3957    </Item> 
    4058    <BuildSuccessful>true</BuildSuccessful> 
Note: See TracChangeset for help on using the changeset viewer.