Page 1 of 1

Help with starting

Posted: Tue May 11, 2021 11:54 pm
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:

Re: Help with starting

Posted: Wed May 12, 2021 12:42 am
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.

Re: Help with starting

Posted: Wed May 12, 2021 4:59 am
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.

Re: Help with starting

Posted: Wed May 12, 2021 6:38 am
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.

Re: Help with starting

Posted: Wed May 12, 2021 8:57 am
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