Lockup after love.filesystem.require

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
lbhoward
Prole
Posts: 23
Joined: Tue Feb 17, 2009 6:12 pm

Lockup after love.filesystem.require

Post by lbhoward »

Yet another problem in which I'm certain I'm overlooking something >.< I have 3 LUA files - the first 2 work absolutely perfectly - but (as mentioned I'm doing a college project) I need to add a sort of 'company' spash logo. Instead of messing with my perfectly functioning level_one.lua and menu.lua I added a new main.lua

Code: Select all

function load()
   
   androidsplash = love.graphics.newImage("UI/androidsplash.png")
   androidsplash:setCenter(0, 0)
   android_splash = love.graphics.newAnimation(androidsplash, 800, 500, 0.2)
   android_splash:setMode(love.mode_once)
   
   splashtime = 0
   
end


function draw()

   love.graphics.draw(android_splash, 400, 250)
   
end


function update(dt)

   android_splash:update(dt)

   splashtime = splashtime + 0.01
   
   if splashtime > 4 then
   love.filesystem.require("menu.lua")
   load()
   end
   
end
So as you can see - I call upon my menu.lua when the splash has been displayed for roughly 4 seconds - I also call load() on my menu.lua.

It loads up perfectly - the music starts playing and I see my main menu - however, keys do not seem to respond - so I'm guessing it's refusing to update? As mentioned the menu.lua functions perfectly when it acts as main.lua - what could be the problem here?

I use 'function load()' etc in my menu.lua - I did read it may be necesary to do 'load() = function' - any truth to this?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lockup after love.filesystem.require

Post by bartbes »

It checks at startup which callbacks are defined, so if you want to add a callback later you should have one now, so add:

Code: Select all

function keypressed() end
to your code (or keyreleased, whatever you were using)

EDIT: and the load = function is not necessary.
lbhoward
Prole
Posts: 23
Joined: Tue Feb 17, 2009 6:12 pm

Re: Lockup after love.filesystem.require

Post by lbhoward »

Just this second figured out that I forgot to add keypressed() >.< Did attempt to delete the post before anyone replied =P Thank you very much for the help though.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Google [Bot] and 3 guests