game: add a sonicboost handler
This commit is contained in:
parent
639da2abd2
commit
8cb038eddf
3 changed files with 23 additions and 1 deletions
|
@ -25,12 +25,16 @@
|
|||
|
||||
local Game = Object:extend()
|
||||
|
||||
local SonicBoost = require "game.subgame.sonic-boost"
|
||||
|
||||
local binser = require "libs.binser"
|
||||
|
||||
function Game:new()
|
||||
self.slot = -1
|
||||
self.gametime = 0
|
||||
|
||||
self.subgame = {}
|
||||
self.subgame.sonicboost = SonicBoost(self)
|
||||
end
|
||||
|
||||
function Game:setData(data)
|
||||
|
|
18
sonic-boost.love/game/subgame/sonic-boost.lua
Normal file
18
sonic-boost.love/game/subgame/sonic-boost.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local SonicBoost = Object:extend()
|
||||
|
||||
function SonicBoost:new(controller)
|
||||
self.controller = controller
|
||||
self.datas = {}
|
||||
|
||||
self.datas.characters = require "datas.characters"
|
||||
end
|
||||
|
||||
function SonicBoost:getCharacterData(name)
|
||||
return self.datas.character[name]
|
||||
end
|
||||
|
||||
function SonicBoost:getData()
|
||||
return self.datas
|
||||
end
|
||||
|
||||
return SonicBoost
|
|
@ -73,7 +73,7 @@ function Character:new(charcontroller, rail, character, id)
|
|||
end
|
||||
|
||||
function Character:characterInit(char)
|
||||
self.data = game.characters:getCharacterData(char)
|
||||
self.data = game.subgame.sonicboost:getCharacterData(char)
|
||||
|
||||
self.lifeicon = self.data.assets.lifeicon
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue