Mercurial > projects > openmelee
annotate ships/urQuan.d @ 32:741313c302ed default tip
updated demo
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Mon, 06 Apr 2009 23:39:59 -0400 |
parents | 2bf818f8b005 |
children |
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 */ | |
18 | 31 module openmelee.ships.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 | |
18 | 39 import openmelee.ships.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); |
12 | 50 engineForce = bzVec2(500, 0); |
13 | 51 turnForce = bzVec2(0, 9000); |
12 | 52 rightTurnPoint = bzVec2(-0.5, 0); |
53 leftTurnPoint = bzVec2(0.5, 0); | |
54 | |
0 | 55 auto bodyDef = new bzBodyDef; |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
56 //bodyDef.isBullet = true; |
14 | 57 bodyDef.position = bzVec2(30,5); |
5 | 58 bodyDef.allowFreeze = false; |
24 | 59 bodyDef.allowSleep = false; |
6 | 60 rBody = world.createBody(bodyDef); |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
61 float density = 5.0f; |
0 | 62 |
63 // Head | |
64 auto head = new bzPolyDef; | |
65 head.vertices.length = 8; | |
66 head.vertices[0] = bzVec2(42,49) * scale; | |
67 head.vertices[7] = bzVec2(63,49) * scale; | |
68 head.vertices[6] = bzVec2(70,45.5) * scale; | |
69 head.vertices[5] = bzVec2(73.5,38.5) * scale; | |
70 head.vertices[4] = bzVec2(73.5,-42) * scale; | |
71 head.vertices[3] = bzVec2(70,-49) * scale; | |
72 head.vertices[2] = bzVec2(63,-56) * scale; | |
73 head.vertices[1] = bzVec2(42,-56) * scale; | |
5 | 74 shapes.add(rBody.createShape(head)); |
0 | 75 |
76 // Body | |
77 auto b = new bzPolyDef(density); | |
78 b.vertices.length = 4; | |
79 b.vertices[0] = bzVec2(-70,-28) * scale; | |
80 b.vertices[3] = bzVec2(-70,24.5) * scale; | |
81 b.vertices[2] = bzVec2(42,24.5) * scale; | |
82 b.vertices[1] = bzVec2(42,-31.5) * scale; | |
5 | 83 shapes.add(rBody.createShape(b)); |
0 | 84 |
85 // Top Strut | |
86 auto tStrut = new bzPolyDef(density); | |
87 tStrut.vertices.length = 4; | |
88 tStrut.vertices[0] = bzVec2(0,24.5) * scale; | |
89 tStrut.vertices[3] = bzVec2(-28,24.5) * scale; | |
90 tStrut.vertices[2] = bzVec2(-28,42) * scale; | |
91 tStrut.vertices[1] = bzVec2(0,42) * scale; | |
5 | 92 shapes.add(rBody.createShape(tStrut)); |
0 | 93 |
94 // Top Wing | |
95 auto tWing = new bzPolyDef(density); | |
96 tWing.vertices.length = 4; | |
97 tWing.vertices[0] = bzVec2(-70,42) * scale; | |
98 tWing.vertices[3] = bzVec2(-49,63) * scale; | |
99 tWing.vertices[2] = bzVec2(28,63) * scale; | |
100 tWing.vertices[1] = bzVec2(28,42) * scale; | |
5 | 101 shapes.add(rBody.createShape(tWing)); |
0 | 102 |
103 // Bottom Strut | |
104 auto bStrut = new bzPolyDef(density); | |
105 bStrut.vertices.length = 4; | |
106 bStrut.vertices[0] = bzVec2(0,-31.5) * scale; | |
107 bStrut.vertices[3] = bzVec2(0,-49) * scale; | |
108 bStrut.vertices[2] = bzVec2(-28,-49) * scale; | |
109 bStrut.vertices[1] = bzVec2(-28,-31.5) * scale; | |
5 | 110 shapes.add(rBody.createShape(bStrut)); |
0 | 111 |
112 // Bottom Wing | |
113 auto bWing = new bzPolyDef(density); | |
114 bWing.vertices.length = 4; | |
115 bWing.vertices[0] = bzVec2(-70,-49) * scale; | |
116 bWing.vertices[3] = bzVec2(28,-49) * scale; | |
117 bWing.vertices[2] = bzVec2(28,-70) * scale; | |
118 bWing.vertices[1] = bzVec2(-42,-70) * scale; | |
5 | 119 shapes.add(rBody.createShape(bWing)); |
0 | 120 |
5 | 121 rBody.setMassFromShapes(); |
25 | 122 setPlanetGravity(); |
22 | 123 calcRadius(); |
0 | 124 } |
125 } |