2 Urggr - An horizontal scrolling shoot'em up.
3 Copyright 2008 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Urggr.
7 Urggr is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Urggr is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 sg
= require
'fail.scenegraph'
23 col
= require
'fail.bullet.collision'
25 Level
= fail
.utils
.class
30 -- The top level container of the rendering scene graph.
31 -- Just a group because there's nothing else currently,
32 -- and this project won't be needing anything more sophisticated
34 self
.renderablegroup
= sg
.Group()
36 -- Create the bullet collision world
37 local broadphase
= col
.AxisSweep3(
38 fail
.math
.Vector3f( -1000, -1000, -1000 ),
39 fail
.math
.Vector3f( 1000, 1000, 1000 ) )
40 self
.btcollisionworld
= col
.World( broadphase
)
42 self
:addGameObject( urggr
.Camera() )
43 self
:addGameObject( urggr
.PlayerShip( self
) )
44 self
:addGameObject( urggr
.TestObstacle( self
) )
48 function Level
:addGameObject( gobj
)
49 table.insert( self
.gameobjects
, gobj
)
52 function Level
:addRenderable( renderable
)
53 self
.renderablegroup
:add( renderable
)
56 function Level
:addCollisionObject( colobj
)
57 self
.btcollisionworld
:addObject( colobj
)
60 function Level
:update( deltatime
)
61 self
.btcollisionworld
:performDiscreteCollisionDetection()
63 for i
,v
in ipairs( self
.gameobjects
) do
68 function Level
:evaluateRender( renderpass
)
69 self
.renderablegroup
:evaluate( renderpass
)