Mercurial > projects > openmelee
diff melee/melee.d @ 24:441eb7672404
impleneted steer to avoid
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Fri, 27 Mar 2009 16:05:24 -0400 |
parents | e79347dd38a3 |
children | 2bf818f8b005 |
line wrap: on
line diff
--- a/melee/melee.d Thu Mar 26 20:35:58 2009 -0400 +++ b/melee/melee.d Fri Mar 27 16:05:24 2009 -0400 @@ -31,6 +31,7 @@ module openmelee.melee.melee; import tango.io.Stdout; +import tango.util.container.LinkedList : LinkedList; version(distrib) import tango.io.vfs.ZipFolder; import tango.time.StopWatch; @@ -58,6 +59,8 @@ const ITERS_PER_SECOND = 100; const k_maxContactPoints = 100; +alias LinkedList!(Ship) ObjectList; + // Melee settings struct Settings { float hz = 60; @@ -92,6 +95,7 @@ class Melee { + ObjectList objectList; Settings settings; float timeStep; const bzVec2 gravity = bzVec2(0.0f, 0.0f); @@ -100,9 +104,10 @@ AI ai; Human human; + Ship ship1; Ship ship2; - Planet planet; + Ship planet; bool running; @@ -115,6 +120,8 @@ int pointCount; this() { + + objectList = new ObjectList; } void init() { @@ -125,14 +132,18 @@ scope renderer = new Renderer; m_boundaryListener = new BoundaryListener(this); - m_contactListener = new ContactListener(this); initWorld(); running = true; draw = new Render(world, ship1, ship2, settings); human = new Human(ship1); - ai = new AI(ship2, world); - + + objectList.add(planet); + objectList.add(ship1); + objectList.add(ship2); + + ai = new AI(ship2, objectList); + gui.begin(cfg).retained; gui.push(`main`); GLViewport(`glview`).renderingHandler(&draw.draw) @@ -190,13 +201,12 @@ void initWorld() { // Define world boundaries - worldAABB.lowerBound.set(-100.0f, -150.0f); - worldAABB.upperBound.set(100.0f, 150.0f); + worldAABB.lowerBound.set(-400.0f, -250.0f); + worldAABB.upperBound.set(400.0f, 250.0f); world = new bzWorld(worldAABB, gravity, allowSleep); world.boundaryListener = m_boundaryListener; - world.contactListener = m_contactListener; - ship1 = new UrQuan(world); - ship2 = new Orz(world); + ship2 = new UrQuan(world); + ship1 = new Orz(world); ship2.rBody.angle = 3.14159265/4; planet = new Planet(world); //auto asteroids = new Asteroid(world);