Ive been using LÖVE for a while now, And i felt as though i needed to accomplish something and make progress in my ability to use this awesome engine.
So.. I thought i would make a sandbox for the physics, with it you are able to create static lines, dynamic circles and rectangles in a scrollable infinite* world.
This was mainly done as a concept for me, learning how to use tables** and data types, and how games are made from scratch without boiler plate code.
I realise my code is not neat and could most probably be optimized but again its part of my learning curve on making efficient code.
Things that i would like to learn:
How to destroy bodies (specifically table-wise)
String manipulation imo LUA sucks for this, Im used to PHP
So here it is DOWNLOAD
Controls:
Left Mouse and Drag = Create object (Size dependant on drag distance)
Right Mouse and Drag to screen sides = Scroll throughout infinite* world
Mouse Scroll = Change Tool
Escape = End sandbox
* = Infinite isnt strictly true, The drag can go on forever although the world width and height is defined by the physics world
** = I havent fully learnt how to use tables correctly, Im still stuck in my old array ways
First mini LÖVE project
Re: First mini LÖVE project
i havent had a chance to check this out yet, but just wondering what your struggling with on tables
Re: First mini LÖVE project
I shove all of my physics bodies into a table "bodyTable" by means of "bodyTable[n]"
I wish to be able to destroy my body "bodyTable[n].body:destroy()" and then re-sort the table so that the destroyed body is no longer in my table thus not being indexed in my main body drawing loop
I think i tried table.remove(t) but it failed in the drawing loop
I wish to be able to destroy my body "bodyTable[n].body:destroy()" and then re-sort the table so that the destroyed body is no longer in my table thus not being indexed in my main body drawing loop
I think i tried table.remove(t) but it failed in the drawing loop
Re: First mini LÖVE project
Cool.
In drawBodies(), instead of using numeric for, you can use generic for. This way it will still work of you use table.remove().
In drawBodies(), instead of using numeric for, you can use generic for. This way it will still work of you use table.remove().
Code: Select all
function drawBodies()
for i,v in ipairs(bodyHolder) do
-- stuff
end
end
Re: First mini LÖVE project
Thank you Rude, id seen that kind of loop before in one of the examples but I thought nothing of it, but now it seems rather useful/powerful!
By the way I think you should change your username to polite or kind, because your quite the opposite of rude heh
By the way I think you should change your username to polite or kind, because your quite the opposite of rude heh
Re: First mini LÖVE project
Neat! Perhaps you could add a physics boundary, though, since creating a physics object outside of the world causes the game to crash (and not change the resolution back in GNOME).
Who is online
Users browsing this forum: Bing [Bot] and 1 guest