Mercurial > projects > openmelee
annotate ships/orz.d @ 22:4fce5596d1f6
ai work
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Thu, 26 Mar 2009 16:56:30 -0400 |
parents | 7f74e064dad5 |
children | 441eb7672404 |
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.orz; |
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, PI; | |
38 | |
18 | 39 import openmelee.ships.ship; |
0 | 40 |
41 // UrQuan Dreadnought | |
42 class Orz : Ship | |
43 { | |
44 | |
6 | 45 float scale = 0.025; |
0 | 46 |
47 this(bzWorld world) { | |
6 | 48 |
49 super(world); | |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
50 engineForce = bzVec2(500, 0); |
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
51 turnForce = bzVec2(0, 5000); |
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
52 rightTurnPoint = bzVec2(-0.5, 0); |
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
53 leftTurnPoint = bzVec2(0.5, 0); |
0 | 54 |
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(20,15); |
0 | 58 bodyDef.angle = PI/2; |
5 | 59 bodyDef.allowFreeze = false; |
0 | 60 |
6 | 61 rBody = world.createBody(bodyDef); |
7
2217fd1fe384
added angular and linear velocity limit
zzzzrrr <mason.green@gmail.com>
parents:
6
diff
changeset
|
62 float density = 5.0f; |
0 | 63 |
64 // Body | |
65 auto b = new bzPolyDef(density); | |
66 b.vertices.length = 4; | |
67 b.vertices[0] = bzVec2(42,14) * scale; | |
68 b.vertices[1] = bzVec2(-28,21) * scale; | |
69 b.vertices[2] = bzVec2(-28,-28) * scale; | |
70 b.vertices[3] = bzVec2(42,-21) * scale; | |
5 | 71 shapes.add(rBody.createShape(b)); |
0 | 72 |
73 // Top Wing | |
74 auto tWing = new bzPolyDef(density); | |
75 tWing.vertices.length = 5; | |
76 tWing.vertices[4] = bzVec2(-28,21) * scale; | |
77 tWing.vertices[3] = bzVec2(-70,63) * scale; | |
78 tWing.vertices[2] = bzVec2(-49,63) * scale; | |
79 tWing.vertices[1] = bzVec2(70,14) * scale; | |
80 tWing.vertices[0] = bzVec2(42,14) * scale; | |
5 | 81 shapes.add(rBody.createShape(tWing)); |
0 | 82 |
83 // Bottom Wing | |
84 auto bWing = new bzPolyDef(density); | |
85 bWing.vertices.length = 5; | |
86 bWing.vertices[0] = bzVec2(-28,-28) * scale; | |
87 bWing.vertices[1] = bzVec2(-70,-63) * scale; | |
88 bWing.vertices[2] = bzVec2(-49,-63) * scale; | |
89 bWing.vertices[3] = bzVec2(70,-21) * scale; | |
90 bWing.vertices[4] = bzVec2(42,-21) * scale; | |
5 | 91 shapes.add(rBody.createShape(bWing)); |
0 | 92 |
5 | 93 rBody.setMassFromShapes(); |
22 | 94 //setPlanetGravity(); |
95 calcRadius(); | |
6 | 96 } |
0 | 97 } |