View cmd and a command to turn off the window

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.
lecrafteur
Prole
Posts: 19
Joined: Sun Jan 29, 2012 5:03 pm

Re: View cmd and a command to turn off the window

Post by lecrafteur »

It worked, thank you
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: View cmd and a command to turn off the window

Post by Robin »

Jasoco wrote:I didn't know the love.conf() function worked inside main.lua. (I never tested it myself.)
It doesn't. It calls love.conf() before main.lua is loaded.
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: View cmd and a command to turn off the window

Post by Jasoco »

And there you go. That was the problem. I suspected as much when you uploaded a main.lua instead of a .love file.
lecrafteur
Prole
Posts: 19
Joined: Sun Jan 29, 2012 5:03 pm

Re: View cmd and a command to turn off the window

Post by lecrafteur »

Thank you all for your response
Now I just want my window closes and the command prompt is 10 seconds, it's possible?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: View cmd and a command to turn off the window

Post by Robin »

lecrafteur wrote:Now I just want my window closes and the command prompt is 10 seconds, it's possible?
Huh? Maybe you could ask your question in French, so someone here who is good in both English and French can help you.
Help us help you: attach a .love.
lecrafteur
Prole
Posts: 19
Joined: Sun Jan 29, 2012 5:03 pm

Re: View cmd and a command to turn off the window

Post by lecrafteur »

Ok !
Bon je la poste en français,
je voudrais que quand ma fenêtre est éteinte,le cmd reste allumé pendant quelque seconde,sinon voici le code:

Code: Select all

if life < dead then
print("GAME OVER")
print("Votre score:"..score)
print("Votre manche:"..manche)
love.event.push('q')
end
Bon bah merci si vous trouvez mon problème ! :D
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: View cmd and a command to turn off the window

Post by Robin »

I don't even speak French, but now I know what you mean. :P

First, you probably will want to stop using the console for things like printing scores, and printing them on your game window instead.

Secondly, you'll need a timer:

Code: Select all

-- other code

function love.update(dt)
  --other code
  if not time_dead then
    if life < dead then
      print("GAME OVER")
      print("Votre score:"..score)
      print("Votre manche:"..manche)
      time_dead = 0
  else
    time_dead = time_deat + dt
    if time_dead > 10 then -- to wait 10 seconds. Use 1, if you want to wait 1 second 
      love.event.push('q')
    end
  end
end

--other code
Help us help you: attach a .love.
lecrafteur
Prole
Posts: 19
Joined: Sun Jan 29, 2012 5:03 pm

Re: View cmd and a command to turn off the window

Post by lecrafteur »

Merci,mais il y a un problème
time_deat n'existe pas et sa fait planter le jeux.
Sinon merci et google traduction est ton ami :D
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: View cmd and a command to turn off the window

Post by Robin »

Oh, silly me. I forgot an end:

Code: Select all

-- other code

function love.update(dt)
  --other code
  if not time_dead then
    if life < dead then
      print("GAME OVER")
      print("Votre score:"..score)
      print("Votre manche:"..manche)
      time_dead = 0
    end -- this one
  else
    time_dead = time_deat + dt
    if time_dead > 10 then -- to wait 10 seconds. Use 1, if you want to wait 1 second 
      love.event.push('q')
    end
  end
end

--other code
That should work.
Help us help you: attach a .love.
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: View cmd and a command to turn off the window

Post by Ellohir »

lecrafteur wrote:Merci,mais il y a un problème
time_deat n'existe pas et sa fait planter le jeux.
Je crois que time_deat est un typo. Ça devrait être time_dead.

(time_deat is a typo, right?)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests