1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//1. Module anem
module spacearea;

//2. Imports 
import 
    arc.physics.world,
    arc.physics.shapes.box,
    arc.math.routines,
    arc.types,
    asteroid;

//3. Define space area globally 
SpaceArea area;

//4. Space area derives from world
class SpaceArea : World
{
    //5. Initialize spacearea with walls that keep ship in playing bounds 
    this()
    {        
        super(Rect(0,0,800,600), 10, Point(0,0));
        
        walls[0] = new Box(Size(800,10), float.max);
        walls[0].translation.set(400, 0 - 6);
        addChild(walls[0]);
        
        walls[1] = new Box(Size(800,10), float.max);
        walls[1].translation.set(400, 600 + 6);
        addChild(walls[1]);
        
        walls[2] = new Box(Size(10,600), float.max);
        walls[2].translation.set(0 - 6, 300);
        addChild(walls[2]);
        
        walls[3] = new Box(Size(10,600), float.max);
        walls[3].translation.set(800 + 6, 300);
        addChild(walls[3]);
    }
    
    //6. Setup asteroids depending on level number 
    void setupAsteroids(uint levelNum)
    {
        for (int i = 0; i < levelNum; ++i)
            Asteroid.createRandomAsteroid();
    }
    
private:
    //7. 4 walls that keep players in bounds 
    Box walls[4];
}