comparison planet.d @ 6:eb6059f7035a

Added planet
author zzzzrrr <mason.green@gmail.com>
date Sat, 21 Mar 2009 16:42:08 -0400
parents
children 4ee9e4a0c03b
comparison
equal deleted inserted replaced
5:6f455ef24063 6:eb6059f7035a
1 /*
2 * Copyright (c) 2009, Mason Green (zzzzrrr)
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * * Neither the name of the polygonal nor the names of its contributors may be
15 * used to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 module openmelee.planet;
31
32 import blaze.dynamics.bzBody : bzBody;
33 import blaze.bzWorld: bzWorld;
34 import blaze.dynamics.bzBodyDef;
35 import blaze.collision.shapes.bzCircle : bzCircleDef;
36 import blaze.common.bzMath: bzVec2;
37
38 class Planet
39 {
40
41 bzWorld world;
42
43 this(bzWorld world) {
44 this.world = world;
45 init();
46 }
47
48 void init() {
49 // Create planet
50 bzVec2 position = bzVec2.zeroVect;
51 float angle = 0.0f;
52 auto bd = new bzBodyDef(position, angle);
53 auto rBody = world.createBody(bd);
54 float radius = 7.0f;
55 float density = 7.5f;
56 auto sd = new bzCircleDef(density, radius);
57 float friction = 1.0f;
58 float restitution = 0.1f;
59 sd.friction = friction;
60 sd.restitution = restitution;
61 rBody.createShape(sd);
62 }
63 }