summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-05-26 23:05:49 +0200
committerAki <nthirtyone@gmail.com>2017-05-26 23:05:49 +0200
commit87f870c0f4eb81e92aee929439692ecc2b95226a (patch)
tree1b9f4de110f69b0718cb34d4649e0299da5822a6
parent8e7c7d2a4ca74fcb58f36424b05a96d358208e39 (diff)
downloadroflnauts-87f870c0f4eb81e92aee929439692ecc2b95226a.zip
roflnauts-87f870c0f4eb81e92aee929439692ecc2b95226a.tar.gz
roflnauts-87f870c0f4eb81e92aee929439692ecc2b95226a.tar.bz2
World updated to new oop module
-rw-r--r--not/World.lua53
1 files changed, 22 insertions, 31 deletions
diff --git a/not/World.lua b/not/World.lua
index 88be97a..1ced718 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -1,29 +1,27 @@
+require "not.Object"
+
--- `World`
-- Used to manage physical world and everything inside it: clouds, platforms, nauts, background etc.
-- TODO: Possibly move common parts of `World` and `Menu` to abstract class `Scene`.
-World = {
- world = --[[love.physics.newWorld]]nil,
- Nauts = --[[{not.Hero}]]nil,
- Platforms = --[[{not.Platform}]]nil,
- Clouds = --[[{not.Cloud}]]nil,
- Decorations = --[[{not.Decoration}]]nil,
- Effects = --[[{not.Effect}]]nil,
- Rays = --[[{not.Ray}]]nil,
- camera = --[[not.Camera]]nil,
- -- cloud generator
- clouds_delay = 5,
- -- Map
- map = nil,
- background = nil,
- -- Gameplay status
- lastNaut = false,
- -- "WINNER"
- win_move = 0,
- -- Music
- music = nil
-}
+World = Object:extends()
-World.__index = World
+World.world =--[[love.physics.newWorld]]nil
+World.Nauts =--[[{not.Hero}]]nil
+World.Platforms =--[[{not.Platform}]]nil
+World.Clouds =--[[{not.Cloud}]]nil
+World.Decorations =--[[{not.Decoration}]]nil
+World.Effects =--[[{not.Effect}]]nil
+World.Rays =--[[{not.Ray}]]nil
+World.camera =--[[not.Camera]]nil
+World.music =--[[not.Music]]nil
+-- cloud generator
+World.clouds_delay = 5
+-- Map
+World.map = nil
+World.background = nil
+-- Gameplay status
+World.lastNaut = false
+World.win_move = 0 -- "WINNER"
require "not.Platform"
require "not.Player"
@@ -35,13 +33,6 @@ require "not.Music"
-- Constructor of `World` ZA WARUDO!
function World:new (map, nauts)
- local o = setmetatable({}, self)
- o:init(map, nauts)
- return o
-end
-
--- Init za warudo
-function World:init (map, nauts)
-- Box2D physical world.
love.physics.setMeter(64)
self.world = love.physics.newWorld(0, 9.81*64, true)
@@ -401,9 +392,9 @@ function World:controlpressed (set, action, key)
local map = self:getMapName()
local nauts = {}
for _,naut in pairs(self:getNautsAll()) do
- table.insert(nauts, {naut.name, naut:getControlSet()})
+ table.insert(nauts, {naut.name, naut:getControllerSet()})
end
- local new = World:new(map, nauts)
+ local new = World(map, nauts)
changeScene(new)
end
for k,naut in pairs(self:getNautsAll()) do