help me im a newbie

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
RBXcpmoderator12345
Citizen
Posts: 59
Joined: Sat Mar 07, 2015 11:53 pm

help me im a newbie

Post by RBXcpmoderator12345 »

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:

Code: Select all

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.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: help me im a newbie

Post by Jasoco »

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.

Welcome!
RBXcpmoderator12345
Citizen
Posts: 59
Joined: Sat Mar 07, 2015 11:53 pm

Re: help me im a newbie

Post by RBXcpmoderator12345 »

Thanks. I'm going to re-post in the right forum this time
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: help me im a newbie

Post by s-ol »

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...

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests