My first project, advice and tips welcome!

Show off your games, demos and other (playable) creations.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

My first project, advice and tips welcome!

Post by ninwa »

Note: For friends I may have linked here who need help installing the game you must first download the Love platform installer from http://www.love2d.org. After it's installed download and open the latest version of the game from below. :) Welcome to playing with Love!

Hey all,

Before yesterday (Oct. 10th) I had never written a line of LUA in my life. I've written in a few other languages and something about Love2D really appealed to me. I had to try it out, and so far, it's been a whole boat load of fun. I've decided to write a side scrolling space shooter with my girlfriend (she's the "idea director" :)) dedicated to our little pup beagle. I was hoping a few people would try it out and give any advice/pointers that I should keep in mind going forward.

Screenshot:
Image

Tips
  • Try using the laser on the cat fliers :)
  • Missiles work best on the urples, try to time your attacks against their firing rate!
  • Final boss will reflect projectiles with his shield!
Controls
  • Arrow Keys - Movement
  • Spacebar - Fire
  • 'r' - Toggles projectile type
  • 's' - Toggle audio (new)
Downloads: As with any project, I need to set some goals for myself. A point at which I will go, "Ok. This is done. I will not add another line of code to this." Frankly, if I don't, I will never stop working on something. Here are my goals:

Goals:
  • At least 15 types of enemies.
  • At least 6 levels.
  • One "super enemy" at the end of each level.
  • Interface for swapping projectile player is using.
  • Menu system and game over screen
Last edited by ninwa on Fri Oct 15, 2010 6:02 am, edited 22 times in total.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: My first project, advice and tips welcome!

Post by TechnoCat »

Pretty sweet game, especially a first game. Your dog's gun shoots crazy fast. lol

Your code is clean and fairly well commented. I just don't get what "main.love" is doing in there.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: My first project, advice and tips welcome!

Post by ninwa »

Ah just disregard that, it's probably from when I was playing around with getting Love packages to work. I will make sure that's not in there the next update I put out. I wrote a little batch file that just packages everything in my dev folder and makes the .love.

Thanks for checking it out and I'm glad you enjoyed it. :) And actually, the pups firing rate is something that was a lot slower earlier and I plan on modifying in the future.

I hope to add:
  • Enemies dropping Bones and their projectiles
  • Pressing 'r' will toggle projectiles with a small UI at the bottom
  • At least 10 levels and 20 different monsters
  • A soundtrack (going to compose it myself, or at least try, hehe)
  • A game menu that lets you choose which level you want to play after having unlocked it
  • A game-over screen & continues
spirulence
Prole
Posts: 8
Joined: Tue Sep 21, 2010 8:27 pm

Re: My first project, advice and tips welcome!

Post by spirulence »

If you're looking for some help with the soundtrack, I'd be happy to oblige. I'm not a musician by trade, but I do write my own brand of electronic music as a hobby.

Here's some examples:
http://www.archive.org/download/AMidsum ... capade.mp3
http://www.archive.org/download/NewSqua ... Square.mp3
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: My first project, advice and tips welcome!

Post by TechnoCat »

Okay, so I notice you are using a lot of table indexing with numbers. And then referencing the next one using table#+1 and so on.
And then to compensate for the big loops that might come out of this, I saw you doing a cleanup function that checks for cases when everything is not visible.

You might want to look into using functions like "table.insert()" and "table.remove()" and then a "for i,v ipairs(table) do" for tables and set references that are off screen to nill. Lua has a garbage collector it calls itself.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: My first project, advice and tips welcome!

Post by ninwa »

TechnoCat wrote:Okay, so I notice you are using a lot of table indexing with numbers. And then referencing the next one using table#+1 and so on.
And then to compensate for the big loops that might come out of this, I saw you doing a cleanup function that checks for cases when everything is not visible.

You might want to look into using functions like "table.insert()" and "table.remove()" and then a "for i,v ipairs(table) do" for tables and set references that are off screen to nill. Lua has a garbage collector it calls itself.
This is exactly the kind of information I was hoping would come out of this. I KNEW there was a better way of doing that, but I rushed coding to get it to work. Once I had something that worked "well enough" I didn't bother reconsidering it. Thank you very much. There is actually a few things in the code that was limited by the way I was doing it (for example, multi-staged waves with tons of enemies) because after so long the tables become far too large (especially projectiles) and I consider that unacceptable.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: My first project, advice and tips welcome!

Post by ninwa »

spirulence wrote:If you're looking for some help with the soundtrack, I'd be happy to oblige. I'm not a musician by trade, but I do write my own brand of electronic music as a hobby.

Here's some examples:
http://www.archive.org/download/AMidsum ... capade.mp3
http://www.archive.org/download/NewSqua ... Square.mp3
Fantastic tracks, definitely a lot better than anything I will likely come up with. I plan on trying though. Just to say "I made everything here :)" I might bother you with some questions in the future.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: My first project, advice and tips welcome!

Post by TechnoCat »

Oops, I meant "for i,v in ipairs(table) do", but hopefully you are reading about that in a reference already.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: My first project, advice and tips welcome!

Post by ninwa »

TechnoCat wrote:Oops, I meant "for i,v in ipairs(table) do", but hopefully you are reading about that in a reference already.
You bet. :) I rewrote all of the code to use this instead. I like it so much better. Here's my new cleanup function.

Code: Select all

function performCleanup()
		-- Remove dead enemies, but only if
		-- their fade timer (controls their death animation) 
		-- has expired.
		for i,v in ipairs(enemies) do
			if( (v["alive"] == false) and
				(love.timer.getTime() - v["fade_timer"] > 3)
			  ) then
				table.remove(enemies,i)
			end
		end

		-- Remove off-screen projectiles from
		-- our projectile table.
		for i, v in ipairs(projectiles) do
			if( not(v[1] > -70)    and 
			    not(v[1] < 1000) ) then
				table.remove(projecties,i)
			end
		end
end
Thanks again. :)
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: My first project, advice and tips welcome!

Post by TechnoCat »

your background doesn't tile correctly. Uncertain if this is actually off by a pixel or if it just needs to be drawn with math.floor on the x value.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 37 guests