Search found 1558 matches

by Roland_Yonaba
Tue Apr 05, 2016 7:52 am
Forum: General
Topic: Mini Functions Repository
Replies: 48
Views: 41283

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...
by Roland_Yonaba
Sun Mar 20, 2016 10:26 am
Forum: General
Topic: Modules and scope
Replies: 9
Views: 5349

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...
by Roland_Yonaba
Sat Feb 13, 2016 8:51 am
Forum: General
Topic: Create a class without external libraries
Replies: 21
Views: 7087

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...
by Roland_Yonaba
Fri Feb 12, 2016 8:47 am
Forum: General
Topic: Create a class without external libraries
Replies: 21
Views: 7087

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.
by Roland_Yonaba
Fri Feb 12, 2016 8:35 am
Forum: General
Topic: aabb collision need help...
Replies: 2
Views: 2132

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...
by Roland_Yonaba
Tue Jan 05, 2016 8:31 am
Forum: General
Topic: Post-0.10.0 feature wishlist
Replies: 177
Views: 91492

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...
by Roland_Yonaba
Sat Jan 02, 2016 11:17 am
Forum: General
Topic: Ideas to setup Lua, LuaRocks and LÖVE on Windows
Replies: 1
Views: 2897

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...
by Roland_Yonaba
Wed Dec 23, 2015 10:30 am
Forum: General
Topic: LÖVE 0.10.0 released
Replies: 86
Views: 79237

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!
by Roland_Yonaba
Tue Dec 01, 2015 1:44 pm
Forum: Support and Development
Topic: Are the path algorithms in jumper deterministic?
Replies: 1
Views: 1121

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...
by Roland_Yonaba
Wed Nov 04, 2015 11:53 am
Forum: General
Topic: Colors Collison
Replies: 5
Views: 2460

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...