When I try and load a game on Love2D (for GD50), I am unable to get the game to work. I know that there is no problem in the code, as I tried with different codes, even with code downloaded from the course's website. No game at all is running. The file that I try to run is called main.lua
, and the error is
Error
boot.lua:577: Cannot load game at path 'C:/Users/Arnav Khanna/Downloads/main.lua'.
Make sure a folder exists at the specified path.
Traceback
[C]: in function 'error'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Code:
--[[
GD50 2018
Pong Remake
pong-0
"The Day-0 Update"
-- Main Program --
Author: Colton Ogden
[email protected]
Originally programmed by Atari in 1972. Features two
paddles, controlled by players, with the goal of getting
the ball past your opponent's edge. First to 10 points wins.
This version is built to more closely resemble the NES than
the original Pong machines or the Atari 2600 in terms of
resolution, though in widescreen (16:9) so it looks nicer on
modern systems.
]]
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
--[[
Runs when the game first starts up, only once; used to initialize the game.
]]
function love.load()
love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT, {
fullscreen = false,
resizable = false,
vsync = true
})
end
--[[
Called after update by LÖVE2D, used to draw anything to the screen, updated or otherwise.
]]
function love.draw()
love.graphics.printf(
'Hello Pong!', -- text to render
0, -- starting X (0 since we're going to center it based on width)
WINDOW_HEIGHT / 2 - 6, -- starting Y (halfway down the screen)
WINDOW_WIDTH, -- number of pixels to center within (the entire screen here)
'center') -- alignment mode, can be 'center', 'left', or 'right'
end
Even if I run it in different directories or with a terminal window, it doesn't work. Please may somebody help?
C:/Users/Arnav Khanna/Downloads/main (1).lua
is not a path, it is a file name. The path isC:/Users/Arnav Khanna/Downloads
. but as far as I know love looks for a file named "main.lua" in the path. What isboot.lua
?main.lua
and it still didn't work (I have updated the error message above). The code is not an assignment, it is just the first example code from the first lecture. I have posted it above as well. As I am relatively new toLua
, I am not sure whatboot.lua
is, but I presume that it is some sort of library/program that Love2D runs to start my code, which raises an error. If you could please tell me what I am doing wrong I would be very grateful to you.