Changeset 2024 for 2011/24


Ignore:
Timestamp:
2011-06-15 14:59:38 (8 years ago)
Author:
jajusaar
Message:
 
Location:
2011/24/JaniS/Virus Infection/Virus Infection/Virus Infection
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 2011/24/JaniS/Virus Infection/Virus Infection/Virus Infection/Kentta.txt

    r1989 r2024  
    1 ï»¿###################################################################### 
    2 ###################################################################### 
    3 ##..O.#....................#........................................## 
    4 ##....#....¤...............#........................................## 
    5 ##....#............#...@...#........................................## 
    6 ##....#......¤.....#.......#.........H..........H...........H.......## 
    7 ##..............¤..#................................................## 
    8 ##........¤........#................................................## 
    9 ################################################################....## 
    10 ##...............#............................#.....................## 
    11 ##...M...........#............................#.....................## 
    12 ##...............#..............#.............#.....................## 
    13 ##...............#..............#.............#.....................## 
    14 ##..............................#...................................## 
    15 ##..............................#...................................## 
    16 ###################################################################### 
     1 
     2 
     3 
     4 
     5 
     6########################## 
     7#....o.############.M....# 
     8#......############......# 
     9#..####################..# 
     10#.......##########.......# 
     11#####...##########...##### 
     12#.......##########.......# 
     13#..####################..# 
     14#..####################..# 
     15#........................# 
     16#....x......x.......x....# 
     17#........................# 
     18########################## 
  • 2011/24/JaniS/Virus Infection/Virus Infection/Virus Infection/Peli.cs

    r1989 r2024  
    99public class Peli : PhysicsGame 
    1010{ 
     11    PhysicsObject pelaaja = new PhysicsObject(20, 20); 
     12 
     13 
    1114    public override void Begin() 
    1215    { 
    13          
    14          
     16        LuoKentta(); 
     17        Ohjaus(); 
    1518    } 
    1619 
     20    void LiikutaPelaajaa(Vector vektori) 
     21    { 
     22        pelaaja.Push(vektori); 
     23    } 
     24 
     25 
     26    void LuoKentta() 
     27    { 
     28        TileMap ruudut = TileMap.FromFile("Kentta.txt"); 
     29        ruudut.SetTileMethod('#', LuoPalikka); 
     30        ruudut.SetTileMethod('o', LuoPelaaja); 
     31        ruudut.SetTileMethod('x', LuoVirukset); 
     32        ruudut.Execute(50, 60); 
     33        Level.BackgroundColor = Color.Black; 
     34        Mouse.IsCursorVisible = true; 
     35    } 
     36 
     37    void LuoPalikka(Vector paikka, double leveys, double korkeus) 
     38    { 
     39        PhysicsObject palikka = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     40        palikka.Position = paikka; 
     41        palikka.Shape = Shape.Rectangle; 
     42        palikka.Color = Color.DarkBlue; 
     43        palikka.Restitution = 1.0; 
     44        Add(palikka); 
     45    } 
     46    void LuoPelaaja(Vector paikka, double leveys, double korkeus) 
     47    { 
     48         
     49        pelaaja.Position = paikka; 
     50        pelaaja.Shape = Shape.Circle; 
     51        pelaaja.Color = Color.Yellow; 
     52        Add(pelaaja); 
     53        AddCollisionHandler(pelaaja, KasitteleTormays); 
     54    } 
     55    void LuoVirukset(Vector paikka, double leveys, double korkeus) 
     56    { 
     57        PhysicsObject virus = new PhysicsObject(25, 25); 
     58        virus.Position = paikka; 
     59        virus.Shape = Shape.Circle; 
     60        virus.Color = Color.Red; 
     61        Add(virus); 
     62        Vector impulssi = new Vector(-50.0, 200.0); 
     63        virus.Hit(impulssi); 
     64        virus.Restitution = 1.0; 
     65    } 
     66    void Ohjaus() 
     67    { 
     68        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 
     69 
     70        Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); 
     71        Keyboard.Listen(Key.Left, ButtonState.Released, PysaytaPelaaja, null, new Vector(0, 0)); 
     72        Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0)); 
     73        Keyboard.Listen(Key.Right, ButtonState.Released, PysaytaPelaaja, null, new Vector(0, 0)); 
     74        Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000)); 
     75        Keyboard.Listen(Key.Up, ButtonState.Released, PysaytaPelaaja, null, new Vector(0, 0)); 
     76        Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); 
     77        Keyboard.Listen(Key.Down, ButtonState.Released, PysaytaPelaaja, null, new Vector(0, 0)); 
     78    } 
     79    void PysaytaPelaaja(Vector Zero) 
     80    { 
     81        pelaaja.Velocity = Zero; 
     82    } 
     83    void KasitteleTormays(PhysicsObject pelaaja, PhysicsObject kohde) 
     84    { 
     85        
     86    } 
    1787} 
     88 
  • 2011/24/JaniS/Virus Infection/Virus Infection/Virus Infection/Virus Infection.csproj

    r1989 r2024  
    118118    <Content Include="Game.ico" /> 
    119119    <Content Include="GameThumbnail.png" /> 
    120     <Content Include="Kentta.txt" /> 
     120    <Content Include="Kentta.txt"> 
     121      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     122    </Content> 
    121123  </ItemGroup> 
    122124  <ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.