source: 2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/Dreamcast.cs @ 7348

Revision 7348, 2.2 KB checked in by karkaite, 4 years ago (diff)

I started making my own game.

Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class Dreamcast : PhysicsGame
10{
11   
12    public override void Begin()
13    {
14        CreateLevel();
15       
16       
17
18        // TODO: Kirjoita ohjelmakoodisi tähän
19
20        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
21        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
22    }
23    void CreateLevel()
24    {
25        TileMap boxes = TileMap.FromLevelAsset ("Hassebproject");
26        boxes.SetTileMethod('i', Obstacles );
27        boxes.SetTileMethod('W', Wall);
28        boxes.SetTileMethod('#', Ground);
29        boxes.SetTileMethod('C', Characters);
30        boxes.Execute(20, 20);
31
32    }
33    void Obstacles(Vector place, double width, double height)
34    {
35        PhysicsObject obstacles = PhysicsObject.CreateStaticObject(width, height);
36        obstacles.Position = place;
37        obstacles.Shape = Shape.Rectangle;
38        obstacles.Color = Color.GreenYellow;
39        obstacles.CollisionIgnoreGroup = 1;
40        Add(obstacles);
41    }
42
43    void Wall(Vector place, double width, double height)
44    {
45        PhysicsObject wall = PhysicsObject.CreateStaticObject(width, height);
46        wall.Position = place;
47        wall.Shape = Shape.Rectangle;
48        wall.Color = Color.Brown;
49        wall.CollisionIgnoreGroup = 1;
50        Add(wall);
51    }
52    void Ground(Vector place, double width, double height)
53    {
54        PhysicsObject ground = PhysicsObject.CreateStaticObject(width, height);
55        ground.Position = place;
56        ground.Color = Color.Gray;
57        ground.Shape = Shape.Rectangle;
58        ground.CollisionIgnoreGroup = 1;
59        Add(ground);
60    }
61    void Characters(Vector place, double height, double width)
62    {
63        PhysicsObject characters = PhysicsObject.CreateStaticObject(width, height);
64        characters.Position = place;
65        characters.Color = Color.Red;
66        characters.Shape = Shape.Rectangle;
67        characters.CollisionIgnoreGroup = 1;
68        Add(characters);
69    }
70     
71
72
73   
74       
75
76
77}
Note: See TracBrowser for help on using the repository browser.