Changeset 7733 for 2016


Ignore:
Timestamp:
2016-07-04 17:08:09 (3 years ago)
Author:
sieerinn
Message:

Objektien luontia aloitettu

Location:
2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/VenienteFragore.cs

    r7732 r7733  
    99public class VenienteFragore : SimplePhysics.Game 
    1010{ 
     11    private delegate void ObjectMethod(Vector position, double width, double height, Dictionary<string, string> properties); 
     12    private Dictionary<string, ObjectMethod> objectMethods; 
     13 
    1114    public VenienteFragore() : base(tileSize: 50) 
    1215    { 
     
    1518    public override void Begin() 
    1619    { 
     20        objectMethods = new Dictionary<string, ObjectMethod>(); 
     21        objectMethods.Add("ball", TestBall); 
     22        objectMethods.Add("player", CreatePlayer); 
     23 
    1724        var tileMap = TiledTileMap.FromLevelAsset("thehub"); 
    1825        tileMap.SetTileMethod("Tile Layer 1", TileMethod); 
    19         tileMap.SetObjectMethod("Object Layer 1", ObjectMethod); 
     26        tileMap.SetObjectMethod("Object Layer 1", CreateObject); 
    2027        tileMap.Execute(); 
    2128 
     
    2936    } 
    3037 
    31     private void ObjectMethod(Vector position, double width, double height, Angle angle, Shape shape, string name, Dictionary<string, string> properties) 
     38    private void CreateObject(Vector position, double width, double height, Angle angle, Shape shape, string name, Dictionary<string, string> properties) 
     39    { 
     40        objectMethods[name](position, width, height, properties); 
     41    } 
     42 
     43    void TestBall(Vector position, double width, double height, Dictionary<string, string> properties) 
    3244    { 
    3345        var testObject = new SimplePhysics.Object(TileSize * 0.99, TileSize * 0.99); 
     
    3951        testObject.CollisionIgnoreGroup = 1; 
    4052        Add(testObject); 
     53    } 
     54 
     55    void CreatePlayer(Vector position, double width, double height, Dictionary<string, string> properties) 
     56    { 
     57         
    4158    } 
    4259 
Note: See TracChangeset for help on using the changeset viewer.