forked from TomK32/APRI50
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.lua
64 lines (56 loc) · 1.68 KB
/
game.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require 'entities/map'
game = {
title = 'APRI50',
debug = false,
graphics = {
mode = { }
},
renderer = require('renderers/default'),
fonts = { },
version = require('version'),
url = 'http://ananasblau.com/apri50',
current_level = 1,
dna_length = 10,
matchers = {
markable = {'A', nil, nil, 'C', nil, nil, 'G', nil, nil, 'T'},
transforming = {'C', 'T', nil, 'G', 'A', nil, 'A', 'C', 'T', nil},
consuming = {nil, 'C', 'G', 'G', 'G', nil, nil, 'T', nil, nil},
liquifying = {nil, nil, nil, nil, nil, nil, nil, 'C', nil, 'T'},
growable = {'A', 'C', 'G', nil, 'T', 'G', 'T', nil, nil, 'G'}
}
}
function game:createFonts(offset)
local font_file = 'fonts/Comfortaa-Regular.ttf'
self.fonts = {
lineHeight = (20 + offset) * 1.7,
small = love.graphics.newFont(font_file, 14 + offset),
regular = love.graphics.newFont(font_file, 20 + offset),
large = love.graphics.newFont(font_file, 24 + offset),
very_large = love.graphics.newFont(font_file, 48 + offset)
}
end
function game:setMode(mode)
self.graphics.mode = mode
love.graphics.setMode(mode.width, mode.height, mode.fullscreen or self.graphics.fullscreen)
if self.graphics.mode.height < 600 then
self:createFonts(-2)
else
self:createFonts(0)
end
end
function game:startMenu()
love.mouse.setVisible(true)
game.current_state = StartMenu()
end
function game:start()
game.stopped = false
love.mouse.setVisible(false)
game.current_state = MapState()
game.renderer.map_view = game.current_state.view
end
function game:mutator()
game.current_state = Mutator()
end
function game:showCredits()
game.current_state = State(self, 'Credits', CreditsView())
end