Space Shoot Up - My First Game!

Show off your games, demos and other (playable) creations.
User avatar
ZoNe
Prole
Posts: 16
Joined: Thu Feb 06, 2014 9:32 pm

Space Shoot Up - My First Game!

Post by ZoNe »

Hi, this is my first game i have ever worked on.. EVER, on LOVE or any other engine.. it is UNFINISHED to say the least but the concept is there and it is playable.. all the artwork is my own (hence why its so crap! haha :'D never was my forte!) the soundtrack is off Castlevania on the NES, just used this for checking the sound code and i take no credit for the soundtrack.

Now i am a newbie into this world so this is my interpretation of what i have learned from youtube videos, forums and headsratching and figuring it out.. please scrutinise the code and the game and let me know how I'm doing :) ... ENJOY! :)

ZoNe!

EDIT: LATEST VERSION! - updated with fix to highscores and image directory issues :) also added SFX! :p
Attachments
SSU.love
(5.59 MiB) Downloaded 215 times
Last edited by ZoNe on Sun Mar 30, 2014 6:05 pm, edited 2 times in total.
User avatar
Jimanzium
Party member
Posts: 103
Joined: Sun Jun 03, 2012 2:39 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by Jimanzium »

Got an error straight away: player.lua:5: could not open file/images/player1.png. Does not exist
User avatar
Jimanzium
Party member
Posts: 103
Joined: Sun Jun 03, 2012 2:39 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by Jimanzium »

Ok, found the problem. Renamed the "Images" folder "images" 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")"
Attachments
ssul.love
(5.49 MiB) Downloaded 172 times
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by SneakySnake »

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.
Last edited by SneakySnake on Sun Mar 30, 2014 2:55 pm, edited 2 times in total.
User avatar
ZoNe
Prole
Posts: 16
Joined: Thu Feb 06, 2014 9:32 pm

Re: Space Shoot Up - My First Game!

Post by ZoNe »

Jimanzium wrote:Got an error straight away: player.lua:5: could not open file/images/player1.png. Does not exist
apologies for that :)
Jimanzium wrote:Ok, found the problem. Renamed the "Images" folder "images""
and thank you for that :)
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")"
not sure what the problem was here as seemed to work for me also?? :/ should i be changing this part of the code or not then?

thanks for the help though and the feedback :)

ZoNe!
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by SneakySnake »

ZoNe 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")"
not sure what the problem was here as seemed to work for me also?? :/ should i be changing this part of the code or not then?
The problem is that love.filesystem.newFile does not actually create a new file on disk.
It creates a new File object.

What you should do is only read the scores if scores.lua exists.
I made some modifications to greatly simplify the loading of the high scores. It uses love.filesystem.load to load and run scores.lua, instead of manually parsing it.
You can check it out here: https://gist.github.com/crumblingstatue ... a0b0d1a017
The green lines are the added lines, the red lines are the removed lines.

Once you have fixed the letter casing issue with Images/ and the score loading, upload a new .love file so we can all play the fixed version.
User avatar
ZoNe
Prole
Posts: 16
Joined: Thu Feb 06, 2014 9:32 pm

Re: Space Shoot Up - My First Game!

Post by ZoNe »

okay thanks :)

Here is a working version.. i hope :/
Last edited by ZoNe on Wed Apr 02, 2014 8:51 pm, edited 1 time in total.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by SneakySnake »

ZoNe wrote:okay thanks :)

Here is a working version.. i hope :/
Nope, it doesn't work if scores.lua doesn't exist.

You only seemed to have incorporated Jimanzium's changes, which still break on the first run.

Why didn't you incorporate my changes instead? I shared them with you for a reason.
User avatar
ZoNe
Prole
Posts: 16
Joined: Thu Feb 06, 2014 9:32 pm

Re: Space Shoot Up - My First Game!

Post by ZoNe »

SneakySnake wrote:
ZoNe wrote:okay thanks :)

Here is a working version.. i hope :/
Nope, it doesn't work if scores.lua doesn't exist.

You only seemed to have incorporated Jimanzium's changes, which still break on the first run.

Why didn't you incorporate my changes instead? I shared them with you for a reason.
sorry there mind was adrift.. this okay?

the coding at lines 124 and 155 is okay though yeah?

thanks btw :)
Last edited by ZoNe on Wed Apr 02, 2014 8:51 pm, edited 1 time in total.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Space Shoot Up - My First Game!

Post by SneakySnake »

ZoNe wrote:the coding at lines 124 and 155 is okay though yeah?
Looks okay, although you probably don't have to write to a file every time the high score is updated.
It's enough to only write it on love.quit()

You should update your original post with the fixed .love, so people who want to try your game can play it without having to read through the whole topic.
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests