Hia, Ive recently joined LOVE and ive been scripting LUA since 2008. Ive been using the ROBLOX game engine for that and ive been reading the wiki and basicly copy and pasting. I would then edit my scripts and such. The output printed a few errors and I understand this may look like a failed script to you (Trust me I know) but I would appreciate if you would fix this.
function love.draw()
love.graphics.print("Hello World", 400, 300)
end
sound = love.audio.newSource("pling.wav", "static") -- the "static" tells LÖVE to load the file into memory, good for short sound effects
music = love.audio.newSource("music.wav") -- if "static" is omitted, LÖVE will stream the file from disk, good for longer music tracks
love.audio.play(sound)
love.audio.play(music)
This is how everything for me is set up...
Folder wich contains the files
main.lua
pling.wav
music.wav
Last edited by NobleFlame on Wed Jul 06, 2011 8:21 pm, edited 7 times in total.
You shouldn't be doing that stuff there, it is bad practice to manipulate the game in the main file, please use love.load (or whatever function is appropriate at the time).
Other than that it should just work (and play both once).
Also, FORMAT. Don't write your posts completely in bold, don't double-post and use the code tag where applicable.
Alright thanks for the tip. So let me get this straight...
create a new Lua file.
Input the Audio code...
And on main.lua I run the code from there?
How would I use this function 'love.load'?
Everything is still the same though..
Last edited by bartbes on Wed Jul 06, 2011 6:31 pm, edited 1 time in total.
Reason:Edited to remove DISOBEY (I am not happy about this, next time you'll get an official warning!)
function love.load()
sound = love.audio.newSource("pling.wav", "static")
music = love.audio.newSource("music.wav")
love.audio.play(sound)
love.audio.play(music)
end
function love.draw()
love.graphics.print("Hello World", 400, 300)
end
Alright now output prints, Pling.wav does not exist. Do I have to provide some kind of tag? I thaught love.Audio was a global instance thats gets audio files.
Do I have to place my Audio files in a certain folder?
NobleFlame wrote:I really need help. Where do I store the pling.wav?
Wherever you want. If you store pling.wav (you really should be using .ogg though. There are... Issues with some other formats) in a directory called 'audio' you'd load it by doing:
NobleFlame wrote:Alright now output prints, Pling.wav does not exist. Do I have to provide some kind of tag? I thaught love.Audio was a global instance thats gets audio files.
Do I have to place my Audio files in a certain folder?
NobleFlame wrote:I really need help. Where do I store the pling.wav?
bartbes wrote:don't double-post
Wait longer than 1:20 hours before double posting. More like a fair few or a day.