im making a Five Nights At Freddy's fan game, and I've made the title screen, the static, and the character files.
My question is, how do I load them correctly and draw them correctly? This is what I did:
function love.load()
local bg = love.graphics.newImage("C:\Users\USERNAME\Desktop\Love2D Lua engine\love-0.9.2-win32\game\titlescreen.png");
local x = 800;
local y = 600;
local staticGif = love.graphics.newImage("C:\Users\USERNAME\Desktop\Love2D Lua engine\love-0.9.2-win32\game\static.gif");
local x2 = 800;
local y2 = 600;
end
function love.draw()
love.graphics.draw(bg, x, y);
love.graphics.draw(staticGif, x2, y2);
end
I'm new to Love2D's API, but I came from ROBLOX so I mastered ROBLOX's API so I know Lua well enough to do this... but again, Love2D's API is new to me.
First off, welcome to the forum. We're happy to help.
But a few helpful tips. First, you posted this in the wrong forum. There is a help and support forum right below this one. Please use it. And secondly, please please please use more descriptive thread titles. We already have enough newbies posting the same exact thread title hoping for help. We can't find your thread to help you with your problem if we can't tell what your problem is. You can edit your thread title if you wish. But you cannot move the thread yourself so maybe a mod will be able to do that.
Anyway, to help you with your actual question the first thing I am going to mention is that you cannot load images like that from absolute paths like that. The image must be in the .love file itself or inside its "Identity directory" and you must use its relative path without the absolute stuff. If you tried to give this .love to someone else, they would not be able to load the game because the images would not exist at that location on their disk.
Secondly, what I would suggest is looking into using game states. So you can have the title and the game and the options all in their own states and switch between them cleanly. There are a few libraries already existing here that can help with that. I believe HUMP is one. I'm not sure. Someone else can probably answer that. (I write my own state library and if I posted it it would confuse the heck out of almost anybody just trying to figure out what the code does. lol)
Anyway, Löve's API is pretty easy to understand and well documented (I suggest browsing the Wiki non stop) and Lua is easy as well and has plenty of documentation online so it should be easy to figure out with some Google-fu.
Jasoco wrote:And secondly, please please please use more descriptive thread titles. We already have enough newbies posting the same exact thread title hoping for help. We can't find your thread to help you with your problem if we can't tell what your problem is.
help me im a newbie #2 isn't exactly a more descriptive title...