Just Beginning Love

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.
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Just Beginning Love

Post by osgeld » Fri Apr 24, 2009 3:19 am

Nec wrote:Im new to Lua and Love (I figure why not try my hand at some Lua). Im not knew to programming, though. Im a Java programmer and Ive got to say that these posts helped quite a bit. Ive just got to get used to the way Lua goes about things (no curly braces :()
for anyone new to lua, i suggest you get core lua and browse through

http://www.lua.org/manual/5.1

then adapt to love

btw, to the op, joshparrisjosh

i am fairly well versed with luaplayer, so feel free to post comparisons

reason love works is lua callbacks, it is possible to do it with any lua based system, but LP went for a down and basic approach to it, and they are loosely talked about

a good way to think about it is if instead of 1 main loop, you have 1 main loop broken up into parts to help organize

when love starts (even without a script) it automatically loops until told to quit, the Callbacks are then refreshed (except for function load)

vs psp luaplayer (and variants) start at the top of a script and race for the EOF, unless caught in a loop the program almost instantly dumps back out

User avatar
bartbes
Sex machine
Posts: 4944
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Just Beginning Love

Post by bartbes » Fri Apr 24, 2009 5:24 am

joshparrisjosh wrote:Why doesn't this work, by the way?
Something like this is going to be in 0.6.0 (next version)
joshparrisjosh wrote: I mean the parameters for the most part makes sense, but I can't seem to get them to do what I want at all.
How does I change the screen resolution. This probably sounds dumb but I can't get it to change no matter what I type. Ist there a specific way that this is done?
Using width and height, if you want 1024 x 768 you do:
width = 1024
height = 768

joshparrisjosh
Prole
Posts: 3
Joined: Mon Apr 20, 2009 5:27 pm

Re: Just Beginning Love

Post by joshparrisjosh » Fri Apr 24, 2009 12:39 pm

Hey osgeld

crazy meeting you outside of the evilmana forums. ^^

Okay, so let me just say this to make sure that I completely understand. Exactly like with luaplayer, when launching a love script the first thing that's done is the entire script is executed. However, unlike in luaplayer, with love the callbacks are refreshed until told to stop.

Thanks actually makes a lot more sense, for some reason I was under the impression that the entire script was being refreshed, instead of just the callbacks.

So does that means, that these two code segments would be for the most part equivalent,

Code: Select all

   font = love.graphics.newFont(love.default_font, 12)
   love.graphics.setFont(font)
   message = "Boo I'm a ghost."

function update(dt)
   if love.keyboard.isDown(love.key_up) then
      message = "::ghost noise::"
   end
end

function draw()
   love.graphics.draw(message, 100, 100)
end

Code: Select all

function load()
   font = love.graphics.newFont(love.default_font, 12)
   love.graphics.setFont(font)
   message = "message"
end

function update(dt)
   if love.keyboard.isDown(love.key_up) then
      message = "this is the new sound"
   end
end

function draw()
   love.graphics.draw(message, 100, 100)
end


Also, this is exactly what my config file looks like

Code: Select all

author = "Your Name"
title = "My Awesome Game"
width = 100	
height = 100
Whenever I launch the love file... the music starts, but the screen is completely black and the parameters are definitely not equal to 100x100.

User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Just Beginning Love

Post by osgeld » Fri Apr 24, 2009 1:12 pm

pretty much, but you want to use the load function as some of love's stuff wont work outside of callbacks

and i dunno about the config file, i hardly use it, i usually just do

Code: Select all

love.graphics.setMode( width, height, fullscreen, vsync, fsaa ) 

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

Re: Just Beginning Love

Post by Robin » Fri Apr 24, 2009 1:15 pm

How about changing
joshparrisjosh wrote:

Code: Select all

(...)
function draw()
   love.graphics.draw(message, 100, 100)
end
into

Code: Select all

(...)
function draw()
   love.graphics.draw(message, 50, 50)
end
If your window really is 100x100, the first text is just outside the window.
Help us help you: attach a .love.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests