Search found 234 matches
- Tue Apr 25, 2017 2:14 pm
- Forum: Support and Development
- Topic: [Solved]Collision with map doesnt work
- Replies: 4
- Views: 3880
Re: [Solved]Collision with map doesnt work
-- Axis aligned bounding box(AABB) collision -- Returns true if the rectangles overlap function aabb(x1,y1,w1,h1, x2,y2,w2,h2) return x1 < x2 + w2 and x1 + w1 > x2 and y1 < y2 + h2 and h1 + y1 > y2 end -- Same thing, but o1 and o2 are tables containing at least x, y, w, and h function aabb2(o1, o2)...
- Sat Apr 22, 2017 3:13 am
- Forum: General
- Topic: Best GUI library?
- Replies: 7
- Views: 9894
Re: Best GUI library?
After countless times of trying to reinvent the wheel I tried a few libraries, but couldn't settle on anything. Right now I'm using Nuklear, it's an immediate mode GUI so it's a little different, but I like it.
- Tue Apr 18, 2017 2:07 am
- Forum: Support and Development
- Topic: How to make a simple Constructor in lua
- Replies: 4
- Views: 4035
Re: How to make a simple Constructor in lua
Bare minimum could be something along the lines of:
Code: Select all
function constructor(x, y)
return {
x = x or math.random()*100,
y = y or math.random()*100
}
end
-- Then create instances
local objects = {}
for i = 1, 10 do
objects[i] = constructor()
print(i, objects[i].x, objects[i].y)
end
- Tue Apr 11, 2017 1:05 am
- Forum: Support and Development
- Topic: Easy programming 'language' for all - concept and discussion
- Replies: 12
- Views: 11289
Re: Easy programming 'language' for all - concept and discussion
Trainsported was a cool game that used programmable AI to complete challenges or "battle" your trains online. I highly recommend checking it out.
- Tue Mar 28, 2017 10:01 pm
- Forum: General
- Topic: Touch to table
- Replies: 3
- Views: 3182
Re: Touch to table
Lua is all about tables. Put the touch events into a table and tinker from there... local touches = {} function love.touchpressed(id, x, y, dx, dy, pressure) local t = { id = id, x = x, y = y, dx = dx, dy = dy, p = pressure } table.insert(touches, t) end local lg = love.graphics function love.draw()...
- Tue Mar 28, 2017 1:08 pm
- Forum: General
- Topic: Sharing lua library have resources (image)
- Replies: 4
- Views: 3067
Re: Sharing lua library have resources (image)
AFAIK you can put whatever you want in the folder with the LOVE exe and it will be included in every project you make, so long as you require it. I'd avoid this though because when/if you want to share your creations, you'd have to copy the files into your project directory before you zip it up or n...
- Fri Mar 17, 2017 5:05 pm
- Forum: Support and Development
- Topic: Movement Speed Fix Help
- Replies: 9
- Views: 4501
Re: Movement Speed Fix Help
The problem lies in the hardware.
- Wed Mar 08, 2017 2:29 pm
- Forum: Support and Development
- Topic: Simple game with ipairs (for school)
- Replies: 11
- Views: 8310
Re: Simple game with ipairs (for school)
I'm not entirely sure with pairs/ipairs(I try to avoid it anyways (If I recall, in terms or speed it goes: pairs -> ipairs -> numeral iteration) ), but you shouldn't remove table items inside an iteration, unless you are traversing backwards. -- It would be fine for things like: for i, e in ipairs(e...
- Sat Feb 11, 2017 2:13 pm
- Forum: Support and Development
- Topic: [SOLVED] Problem of local nil value with collision
- Replies: 11
- Views: 9844
Re: Problem of local nil value with collision
I got it... The problem was that after a bullet hits an enemy, the bullet is removed, but you didn't return from the loop after. So the next iteration it uses the next enemy but the bullet is already gone. Replace the loop with this: (also removes the need for the nope variable) for i=#bullets,1,-1 ...
- Sat Feb 11, 2017 2:03 pm
- Forum: Support and Development
- Topic: Forum Problems
- Replies: 46
- Views: 20301
Re: Forum Problems
The forum offically broke...