Search found 1558 matches
- Tue Apr 05, 2016 7:52 am
- Forum: General
- Topic: Mini Functions Repository
- Replies: 48
- Views: 41433
Re: Mini Functions Repository
Clamp function A shorter version : local function clamp(value, min, max) return math.min(max, math.max(value, min)) end Or in case you need to assign the value within the function : local function clamp(value, min, max) value = math.min(max, math.max(value, min)) return value end This cheatsheet wo...
- Sun Mar 20, 2016 10:26 am
- Forum: General
- Topic: Modules and scope
- Replies: 9
- Views: 5358
Re: Modules and scope
My other question is about global variables. In my game I'd like to make a small number of variables (well, really pseudo constants) accessible to all modules, for example the size of the map, MAPSIZE. Where's the best place to define such things? I read something about _G, the environment table bu...
- Sat Feb 13, 2016 8:51 am
- Forum: General
- Topic: Create a class without external libraries
- Replies: 21
- Views: 7102
Re: Create a class without external libraries
Implementing OOP with closures is a nice, simple and elegant method though. I am definitely not advocating against, but for the sake of discussion, I would just like to point out it seems this approach involves more memory consumption . Steve Litt also discussed the topic here . I would love to hear...
- Fri Feb 12, 2016 8:47 am
- Forum: General
- Topic: Create a class without external libraries
- Replies: 21
- Views: 7102
Re: Create a class without external libraries
I would just suggest to go along with PiL's approach, chapter 16.
Also, even though I do not consider this to be anywhere formal, here is the bare-bones light class implementation I am mostly using when I need one.
Also, even though I do not consider this to be anywhere formal, here is the bare-bones light class implementation I am mostly using when I need one.
- Fri Feb 12, 2016 8:35 am
- Forum: General
- Topic: aabb collision need help...
- Replies: 2
- Views: 2137
Re: aabb collision with metatables? need help
Let us say obj is an array list holding the objects you are trying to perform collision checks upon. SInce they are ordered, you can basically go with nested for loops. for i in ipairs(obj) do for j in ipairs(obj) do if i ~= j then -- This is just to avoid testing an object against itself, as it wil...
- Tue Jan 05, 2016 8:31 am
- Forum: General
- Topic: Post-0.10.0 feature wishlist
- Replies: 177
- Views: 91844
Re: Post-0.10.0 feature wishlist
Would it be possible to add Moonscript-Support? What I mean is the ability to directly pack .moon (alongside of .lua) files in a .love file and let LÖVE take care of the rest. There used to be a fork of LOVE that did this, made by leafo himself if I recall correctly, but the reasoning against its d...
- Sat Jan 02, 2016 11:17 am
- Forum: General
- Topic: Ideas to setup Lua, LuaRocks and LÖVE on Windows
- Replies: 1
- Views: 2907
Ideas to setup Lua, LuaRocks and LÖVE on Windows
Happy New Year, folks. I am starting out a new and fresh Lua Installation on my computer (running under Windows), and I was wondering what would be the optimal setup to work with Lua. I have a couple of ideas, but I am just looking for (better ?) ideas. I have been using Notepad++ before, and also L...
- Wed Dec 23, 2015 10:30 am
- Forum: General
- Topic: LÖVE 0.10.0 released
- Replies: 86
- Views: 80451
Re: LÖVE 0.10.0 released
Awesome! There's been a fairly long time I've played with Löve... So there's a lot of things I need to catch up with...
But I am definitely keeping an eye on this. Keep it up, guys!
But I am definitely keeping an eye on this. Keep it up, guys!
- Tue Dec 01, 2015 1:44 pm
- Forum: Support and Development
- Topic: Are the path algorithms in jumper deterministic?
- Replies: 1
- Views: 1124
Re: Are the path algorithms in jumper deterministic?
Hi, Bobbyjones I think I can go with a yes. Algorithms in Jumper are deterministic. Sort of. See, pathfinding algorithms implemented in Jumper are devised in a way they look for the (near) optimal path given two locations on grid. Unless the map changes, given the same locations, the optimal path is...
- Wed Nov 04, 2015 11:53 am
- Forum: General
- Topic: Colors Collison
- Replies: 5
- Views: 2463
Re: Colors Collison
I'm a fan of spatial-hashing. Take a table, and assign each location on screen a value. 1 for top left. 16 for top right, 17 for just below top left, you get the idea. For a 16:9 aspect ratio, that's 144 cells. In each cell, have a table. Now, on each update, you clear those tables, and then iterat...