Jimanzium wrote:Renamed the "Images" folder "images"
Good job!
SneakySnake wrote:Jimanzium wrote:and then fixed another problem by changing line 43 of main.lua with "love.filesystem.write("scores.lua","0")" instead of "scores = love.filesystem.newFile("scores.lua")"
Why was this a problem? The original code works fine for me. However, your change breaks the game if
scores.lua does not exist:
Code: Select all
Error: main.lua:130: attempt to compare nil with number
stack traceback:
main.lua:130: in function 'update'
[string "boot.lua"]:421: in function <[string "boot.lua"]:387>
[C]: in function 'xpcall'
EDIT: Never mind, the original breaks too if scores.lua does not exist. With your modifications, it only breaks on first run.
ZoNe wrote:please scrutinise the code and the game and let me know how I'm doing
As you might have already figured out by now, you should take care to reference file names with the correct letter casing, as some filesystems are case sensitive.
You really shouldn't "make up" your own LÖVE functions. You created a function called love.restart(), but there is no such function in LÖVE. One could mistakenly believe that there is a LÖVE callback named love.restart(), while in reality, there isn't. Just name it restart() or something else.
You should learn about
local variables.
A local declaration can make reasoning about a variable a lot easier, as it tells the reader the scope of the variable.
Local variables can also be faster to access in many cases.
As for the game, what I'm missing is sound effects. Killing an enemy is a lot more satisfying if there is a nice explosion sound or something similar. If you want an easy way to generate sound effects, check out
sfxr.