Mercurial > projects > openmelee
annotate urQuan.d @ 8:4ee9e4a0c03b
changed license header
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 19:44:19 -0400 |
parents | 2217fd1fe384 |
children | 2ecd16840900 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2009, Mason Green (zzzzrrr) | |
8 | 3 * http://www.dsource.org/projects/openmelee |
0 | 4 * |
5 * All rights reserved. | |
6 * | |
7 * Redistribution and use in source and binary forms, with or without modification, | |
8 * are permitted provided that the following conditions are met: | |
9 * | |
10 * * Redistributions of source code must retain the above copyright notice, | |
11 * this list of conditions and the following disclaimer. | |
12 * * Redistributions in binary form must reproduce the above copyright notice, | |
13 * this list of conditions and the following disclaimer in the documentation | |
14 * and/or other materials provided with the distribution. | |
15 * * Neither the name of the polygonal nor the names of its contributors may be | |
16 * used to endorse or promote products derived from this software without specific | |
17 * prior written permission. | |
18 * | |
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 */ | |
2 | 31 module openmelee.urQuan; |
0 | 32 |
33 import blaze.dynamics.bzBody : bzBody; | |
34 import blaze.bzWorld: bzWorld; | |
35 import blaze.dynamics.bzBodyDef; | |
36 import blaze.collision.shapes.bzPolygon : bzPolyDef; | |
37 import blaze.common.bzMath: bzVec2; | |
38 | |
2 | 39 import openmelee.ship; |
0 | 40 |
41 // UrQuan Dreadnought | |
42 class UrQuan : Ship | |
43 { | |
44 | |
6 | 45 float scale = 0.025; |
0 | 46 |
47 this(bzWorld world) { | |
48 | |
6 | 49 super(world); |
0 | 50 auto bodyDef = new bzBodyDef; |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
51 //bodyDef.isBullet = true; |
0 | 52 bodyDef.position = bzVec2(10,5); |
5 | 53 bodyDef.allowFreeze = false; |
6 | 54 rBody = world.createBody(bodyDef); |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
55 float density = 5.0f; |
0 | 56 |
57 // Head | |
58 auto head = new bzPolyDef; | |
59 head.vertices.length = 8; | |
60 head.vertices[0] = bzVec2(42,49) * scale; | |
61 head.vertices[7] = bzVec2(63,49) * scale; | |
62 head.vertices[6] = bzVec2(70,45.5) * scale; | |
63 head.vertices[5] = bzVec2(73.5,38.5) * scale; | |
64 head.vertices[4] = bzVec2(73.5,-42) * scale; | |
65 head.vertices[3] = bzVec2(70,-49) * scale; | |
66 head.vertices[2] = bzVec2(63,-56) * scale; | |
67 head.vertices[1] = bzVec2(42,-56) * scale; | |
5 | 68 shapes.add(rBody.createShape(head)); |
0 | 69 |
70 // Body | |
71 auto b = new bzPolyDef(density); | |
72 b.vertices.length = 4; | |
73 b.vertices[0] = bzVec2(-70,-28) * scale; | |
74 b.vertices[3] = bzVec2(-70,24.5) * scale; | |
75 b.vertices[2] = bzVec2(42,24.5) * scale; | |
76 b.vertices[1] = bzVec2(42,-31.5) * scale; | |
5 | 77 shapes.add(rBody.createShape(b)); |
0 | 78 |
79 // Top Strut | |
80 auto tStrut = new bzPolyDef(density); | |
81 tStrut.vertices.length = 4; | |
82 tStrut.vertices[0] = bzVec2(0,24.5) * scale; | |
83 tStrut.vertices[3] = bzVec2(-28,24.5) * scale; | |
84 tStrut.vertices[2] = bzVec2(-28,42) * scale; | |
85 tStrut.vertices[1] = bzVec2(0,42) * scale; | |
5 | 86 shapes.add(rBody.createShape(tStrut)); |
0 | 87 |
88 // Top Wing | |
89 auto tWing = new bzPolyDef(density); | |
90 tWing.vertices.length = 4; | |
91 tWing.vertices[0] = bzVec2(-70,42) * scale; | |
92 tWing.vertices[3] = bzVec2(-49,63) * scale; | |
93 tWing.vertices[2] = bzVec2(28,63) * scale; | |
94 tWing.vertices[1] = bzVec2(28,42) * scale; | |
5 | 95 shapes.add(rBody.createShape(tWing)); |
0 | 96 |
97 // Bottom Strut | |
98 auto bStrut = new bzPolyDef(density); | |
99 bStrut.vertices.length = 4; | |
100 bStrut.vertices[0] = bzVec2(0,-31.5) * scale; | |
101 bStrut.vertices[3] = bzVec2(0,-49) * scale; | |
102 bStrut.vertices[2] = bzVec2(-28,-49) * scale; | |
103 bStrut.vertices[1] = bzVec2(-28,-31.5) * scale; | |
5 | 104 shapes.add(rBody.createShape(bStrut)); |
0 | 105 |
106 // Bottom Wing | |
107 auto bWing = new bzPolyDef(density); | |
108 bWing.vertices.length = 4; | |
109 bWing.vertices[0] = bzVec2(-70,-49) * scale; | |
110 bWing.vertices[3] = bzVec2(28,-49) * scale; | |
111 bWing.vertices[2] = bzVec2(28,-70) * scale; | |
112 bWing.vertices[1] = bzVec2(-42,-70) * scale; | |
5 | 113 shapes.add(rBody.createShape(bWing)); |
0 | 114 |
5 | 115 rBody.setMassFromShapes(); |
6 | 116 setGravity(); |
0 | 117 } |
118 } |