diff --git a/main.lua b/main.lua index 55968e3..59422a2 100644 --- a/main.lua +++ b/main.lua @@ -6,6 +6,10 @@ function love.load() load_sprites() + load_font() + + load_data() + player = newAnimation(love.graphics.newImage("assets/img/animation/player-test-size.png"),20,30,1) fog = newAnimation(love.graphics.newImage("assets/img/fog/fog-sheet-resize.png"),20,30,1) chaser = newAnimation(love.graphics.newImage("assets/img/chaser/dr2.png"),26,33,1) @@ -24,6 +28,7 @@ function love.load() create_chaser() choose_drone() + change_title() end @@ -36,6 +41,9 @@ function love.update(dt) --play drone corresponding to current space if not playing if p_x == chaser_x and p_y == chaser_y then stop_old_drone(current_drone) + + change_title() + elseif terrain<5 and sound_switched == false then stop_old_drone(current_drone) choose_drone() @@ -97,6 +105,8 @@ function love.draw() draw_player() draw_portal() + draw_text() + end function load_sounds() @@ -306,5 +316,47 @@ function check_player_on_portal() create_grid() choose_drone() create_portal() + change_title() end end + +function load_data() + environment = {} + for line in love.filesystem.lines("assets/data/environments.txt") do + table.insert(environment, line) + end + + sense = {} + for line in love.filesystem.lines("assets/data/senses.txt") do + table.insert(sense, line) + end + + transition = {} + for line in love.filesystem.lines("assets/data/transition.txt") do + table.insert(transition, line) + end + +end + +function draw_text() + love.graphics.print(title, 100, 100) +end + +function change_title() + current_env = environment[love.math.random(#environment)] + current_sense = sense[love.math.random(#sense)] + current_transition = transition[love.math.random(#transition)] + + if love.math.random(2)>1 then + title=current_transition..' '..current_env + else + title=current_sense..' of '..current_env + end + +end + +function load_font() + font = love.graphics.newFont(18) + love.graphics.setFont(font) + +end