Help with starting

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.
Post Reply
LitPotato2895
Prole
Posts: 1
Joined: Tue May 11, 2021 11:45 pm

Help with starting

Post by LitPotato2895 »

So, im not sure if i missed something, or if this is how its supposed to work, but i opened LOVE and it just said no game, can anyone tell me what i should do or what i did wrong? Thank you! :nyu:
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Help with starting

Post by ReFreezed »

Check the wiki: https://love2d.org/wiki/Getting_Started

Basically, you need to create a main.lua file in a folder, and then tell LÖVE to run that folder.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
JJSax
Prole
Posts: 47
Joined: Fri Apr 04, 2014 3:59 am

Re: Help with starting

Post by JJSax »

To expand upon ReFreezed's response, You'll want to make a new folder and put a file called main.lua inside it.

Code: Select all

	-- main.lua
	function love.load()
		-- set up your initial variables here.  Love2d will call this for you.  No need to call it yourself.
		x = 0
		y = 0	
	end
	
	function love.update(dt) -- dt stands for delta time.  Basically using it will modulate everything to the second.  See below.
		x = x + 10 * dt -- this will move by 10 pixels per second
		y = y + 10 * dt -- without the dt x and y would move at a variable rate depending on your system performance.
	end
	
	function love.draw()
		love.graphics.setColor(1,0,0,1) -- rgba ranging from 0-1
		love.graphics.circle("fill", x, y, 5) -- draw a red circle at x,y with a radius of 5
	end
Now you can run the code by dragging and dropping the folder containing main.lua onto love2d's .exe file. The result will be the dot moving diagonally from the top left to down and to the right.

Other Love2d predefined functions can be found here. This should help you get a grasp of how you can interact with Love2d. Love2d is absolutely BLESSED with phenomenal wiki support. If you look on the left hand side of the wiki you'll see a menu that should help direct you to a good place to find what you need.
User avatar
tomxp411
Prole
Posts: 29
Joined: Thu Apr 08, 2021 5:41 pm

Re: Help with starting

Post by tomxp411 »

I have a batch file that I use to start Lua programs in development, something like this:

Code: Select all

%~d0
cd %~dp0
start "Lua Game" "C:\Program Files\LOVE\love.exe" %~dp0
You can change "Lua Game" to any text.. that's the title of the window that opens with the game in it. I think this actually gets ignored, since LOVE sets the title itself.

You also need the main.lua (as described above).

Then run the batch file to start the game.

Once you have a fairly complete package, you can create a LOVE file, which is basically a packaged version of the code and assets... but this is where you start.
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Help with starting

Post by GVovkiv »

LitPotato2895 wrote: Tue May 11, 2021 11:54 pm So, im not sure if i missed something, or if this is how its supposed to work, but i opened LOVE and it just said no game, can anyone tell me what i should do or what i did wrong? Thank you! :nyu:
https://studio.zerobrane.com/ nice IDE for Lua and Love
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 0 guests