diodontidae necandi - for LudumDare 14

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

diodontidae necandi - for LudumDare 14

Post by athanazio » Mon Apr 20, 2009 12:52 pm

Hey,
as result for my participation in the LudumDare 14,
here is the diodontidae necandi !!

http://www.ludumdare.com/compo/2009/04/ ... l-version/
how_to_play.png
how_to_play.png (120.76 KiB) Viewed 1352 times
You control a diodontidae fish that needs to kill the pigs that are trashing the sea,
eat the garbage at the end of the sea, and throw batteries on the pigs !

cheers

http://www.athanazio.com/wp-content/upl ... are14.love
Nothing is simple but everything is possible.

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: diodontidae necandi - for LudumDare 14

Post by bartbes » Mon Apr 20, 2009 1:15 pm

I already played it (from the ludum dare thread) I took some time before I realized I had to throw batteries at the pigs, but it was fun afterwards.

User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: diodontidae necandi - for LudumDare 14

Post by athanazio » Mon Apr 20, 2009 1:59 pm

here are my lessons learned notes from this game =)

lessons learned
1. create the menu navigation at the start of the competition

As I was fighting agains some physics problems during the development process most of the menu was left behind. Then I realized 30 minutes to the end that my menu would be an image =) and a play button...

The lesson on this would be, use time in the middle of the nightmares to do these brainless activities, because what can go wrong while build a menu ? =)

2. draw in the paper build and color in the computer

That helped alot, I save my day manipulate the lines with inkscape, but ... in order to slice images I have a nightmare with inkscape, go with Gimp works as a breeze

3. dont split images, let the engine split for you

ahhhh I spend some hours cutting images lol !!, could use something like http://love2d.org/docs/love_graphics_draws_1.html to draw a subsprite of the image ...


4. make physics work for you

Oh Well after the physics hit me in the head, I learned some details and was able to make it work in a decent way, special note for the boats that hang around over the sea, for that I created a sequence of x,y that is the path to the boats, and I try to follow the path, I believe if I make the water line as an object and change its group to only colide with the boat would be the best to move the boat around.

5. clean the tables in one place only.

Not sure why, buit when I was removing items from my objects list in teh collision handler the LOVE was just crashing ... workaroiund that I found : flag to items to be removed and remove in the update() method and one by one from each table, this is call at the end of the update() for each cleanable table :

Code: Select all

--- clean the tables
function cleanTable(table2Clean)

    for n=1,table.getn(table2Clean),1 do 
    	if table2Clean[n].dirty ~= nill then 
    		table2Clean[n].poly:destroy()
    		table2Clean[n].body:destroy()
        	table.remove( table2Clean, n )
        	break
        end  
    end
end
and at the collision handler, I dont remove the pig from the list, just flag it
and I believe that this would be a nice way to animate the pig booom =)
by using a multistate, like alive/almost dead/dying/im outa here :)
would change the image section, or play an animation ... and at the end remove from the list
that would be great ...

Code: Select all

function killThePig( id )

    love.audio.play( audioCollision, 1 )
	pigsKilled = pigsKilled +1
	
	for n=1,table.getn(pigs),1 do 
	    if pigs[n].poly:getData() == id then
			pigs[n].dirty = true
	        break
	    end  
	end
end

6. reusable files should be in a folder

I'm using for labels the .lua classes that I made called LOVEly-eyes, but I had this problem with the Text object that wasnt transparent ... Oh well I went in the code changed the super class, Rectangle to handle this and the Text is transparent by default, cool, but but but ... :) after that I just copied all the files from the LOVEly-eyes folder to my game folder ... too bad because I copied a main.lua file together ... If I wasnt using subversion would be a nightmare ... now LOVELy-eyes are in a separated folder =)

7. use a version control system

I used subversion, saved me when I made an stupid folder copy ... revert and just lost some minutes of work... bu remember keep on committing =)


8. put together a zip with everything

Better that just the .love file, create a package with the execs, the best would be create an installer.

9. level up level up !!!

people like rewards, so more than the score I should add level concept, just with faster attack of the pigs, or a different scenario with different speed .. hummmm that would be cool a .lua file for each level :)

10. collision has 2 sides ... A and B

It took me some time to realize that A and B collision data, first they are the DATA from the polygon nothing else, just disconnected data, not a reference, not and pointer ... hehehhe string data what makes very nice and unplugged from the code, and you have to test both sides, if wherever A colide on B and the oposite, this was my colision code

Code: Select all

function collision(a, b, c)

	if string.starts(a, "pig") and string.starts(b, "battery") then 
		killThePig( a )
		removeTheBattery( b )
	elseif string.starts(b, "pig") and string.starts(a, "battery") then 
		killThePig( b )
		removeTheBattery( a )
	elseif a == DIODONTIDAE and string.starts(b, "food") then 
		eatFood( b )
    elseif b == DIODONTIDAE and string.starts(a, "food") then 
		eatFood( a )
    end 

end 

function string.starts(String,Start)
   return string.sub(String,1,string.len(Start))==Start
end
note that I used start() because I add the object id after the type, so I can grabb it from the list, something like "crap_2", "crap_3"


11. scroll the view is possible Luke... use the force !

Ha ! not the force, at the end I solved the screen scrolling with a simple solution, calculated a shif from the main character and update this shift in the update() method and every single draw has this shift. So the camera is following the character, thats stays in the screen all the time, and to avoid the char to drop outside the world I add invisible walls on left and right side and check if the cameraX is in the possible range,

this in the start of the code

Code: Select all

    
startCameraX = love.graphics.getWidth( ) / 2
    startCameraY = 200
    
    cameraX = -startCameraX
    cameraXLimit = {}
    cameraXLimit.start  = 0
    cameraXLimit.finish = -2905


+ cameraX on each draw

Code: Select all

    love.graphics.draw(diodontidae.image, 
        diodontidae.theChar:getX() + cameraX,   
        diodontidae.theChar:getY())
    
------ draw the batteries
    for n=1,table.getn(batteries),1 do 
        love.graphics.draw(
            imageBattery, 
            batteries[n].body:getX() + cameraX, 
            batteries[n].body:getY(), 
            batteries[n].body:getAngle() )
    end
this on the update()

Code: Select all

    cameraX = startCameraX - diodontidae.theChar:getX()

    -- keep the camera in the boundaries
    if cameraX > cameraXLimit.start then 
    	cameraX = cameraXLimit.start
    elseif cameraX < cameraXLimit.finish then 
    	cameraX = cameraXLimit.finish
    end
Nothing is simple but everything is possible.

User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: diodontidae necandi - for LudumDare 14

Post by athanazio » Mon Apr 20, 2009 11:45 pm

Nothing is simple but everything is possible.

User avatar
Garotas*Gostosas
Prole
Posts: 41
Joined: Fri Apr 03, 2009 12:15 am

Re: diodontidae necandi - for LudumDare 14

Post by Garotas*Gostosas » Tue Apr 21, 2009 10:23 pm

respect! thanks for this post. really helps!

wish the other contestants could contribute their insights too! ;)

i figuered out this game intantly. but my sea never got messed up like in your video? wasn't i playing long enough? my score was 133 and i quit because i thought you just can't die... :ehem:

you question though: how did you differanciate between the batteries thrown be the pig itself (non - lethal) and the batteries pushed by the fish (lethal)? do they somehow "activate" on entering the water?
I LOVE GAME, YEAH!

User avatar
athanazio
Citizen
Posts: 96
Joined: Fri Apr 10, 2009 3:12 am
Location: Rio de Janeiro - Brazil
Contact:

Re: diodontidae necandi - for LudumDare 14

Post by athanazio » Tue Apr 21, 2009 11:27 pm

there is a new updated version that gets harder as the time goes ...
http://www.athanazio.com/wp-content/upl ... di_v1.love

and btw i didnt diferentiate :) But I could do it by making then lethal as they colide with something else different than the pig, that would be a good upgrade
thx for the idea !
Nothing is simple but everything is possible.

User avatar
Garotas*Gostosas
Prole
Posts: 41
Joined: Fri Apr 03, 2009 12:15 am

Re: diodontidae necandi - for LudumDare 14

Post by Garotas*Gostosas » Wed Apr 22, 2009 5:39 am

athanazio wrote:there is a new updated version that gets harder as the time goes ...
http://www.athanazio.com/wp-content/upl ... di_v1.love
I'll check it out!
athanazio wrote: and btw i didnt diferentiate :)
oh... i thought when a pig throws a battery it doesnt kills an other pig when it hits it :ehem: gonna check this version out, too!
I LOVE GAME, YEAH!

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests