Search found 24 matches

by emonk
Sun Sep 07, 2008 1:28 am
Forum: Support and Development
Topic: Finding out if a line hits a circle.
Replies: 3
Views: 1367

Re: Finding out if a line hits a circle.

With a line segment and a circle there are three broad categories of situations: Both endpoints inside the Circle One endpoint inside the Circle and one outside Neither endpoint inside the circle You can figure out which of those is applicable by calculating the distance of each endpoint from the ce...
by emonk
Sat Sep 06, 2008 2:55 am
Forum: Support and Development
Topic: Finding coordinates around a circle when given an angle
Replies: 1
Views: 927

Re: Finding coordinates around a circle when given an angle

The x,y coordinates of a point on the perimeter of a circle are given by: x = radius * math.cos(angle); y = radius * math.sin(angle); The math library trig functions take angles expressed as radians, so be aware of conversion if that's not how you express your angles. Look up the math.rad() and math...
by emonk
Thu Sep 04, 2008 7:47 am
Forum: Support and Development
Topic: Bring back readline!
Replies: 16
Views: 4359

Re: Bring back readline!

I had a play with building a C++ app using PhysFS and Lua last week, just to see if I could. Once I got that working (and learned a bit about Lua along the way) I figured I'd have a go at hooking the Lua io library to PhysFS... took about 4 hours of messing around to redirect the platform calls to P...
by emonk
Tue Sep 02, 2008 9:33 pm
Forum: Support and Development
Topic: Making games standalone from LOVE?
Replies: 8
Views: 1927

Re: Making games standalone from LOVE?

The zip archive format allows for having a zip file appended to a stub executable for making self-extracting zip executables. I've seen plenty of variations on this theme for windows, but don't know of many instances of it on other platforms. So single-file distribution of Love is a matter of append...
by emonk
Tue Sep 02, 2008 9:18 pm
Forum: Support and Development
Topic: Rounding random numbers to the nearest hundredth?
Replies: 3
Views: 3843

Re: Rounding random numbers to the nearest hundredth?

I'm gonna need some more explaining but I think I know what you are trying to say. Will go a bit more in-depth and fix some basic assumption errors in the above code at the same time :) <LECTURE> Lua's standard math library includes two functions for rounding: math.floor(x) and math.ceil(x) . Both ...
by emonk
Tue Sep 02, 2008 8:47 pm
Forum: Support and Development
Topic: Callback hooks.
Replies: 7
Views: 2101

Re: Callback hooks.

I think the idea is that Love provides the stuff that is difficult/slow to do from Lua, and we do the rest. Providing a hooking mechanism for Update, Draw, etc. is simple enough to do in Lua. Personally I'd rather have control over it from my script than have to rely on the engine to get it right al...
by emonk
Tue Sep 02, 2008 7:35 am
Forum: Support and Development
Topic: Rounding random numbers to the nearest hundredth?
Replies: 3
Views: 3843

Re: Rounding random numbers to the nearest hundredth?

How can I round random numbers to the nearest hundredth? Lua's math library doesn't have a 'round to n places' function, but you can use the math.floor() library function and some simple math to do something similar: local rounded = math.floor(unrounded * 100 + 0.5) / 100; You can use that to add a...
by emonk
Sun Aug 31, 2008 2:06 am
Forum: Support and Development
Topic: I'm a complete and total nub.
Replies: 3
Views: 1612

Re: I'm a complete and total nub.

Mr. Strange wrote:Although I'm finding love to be an excellent tool, I don't think I'd recommend it as a tool for actually learning lua. I think a simple interpreter would be a better place to start.
I on the other hand knew absolutely nothing about Lua before playing with LÖVE.

To each their own ;)
by emonk
Thu Aug 28, 2008 10:42 am
Forum: Support and Development
Topic: killing a set of elements from a list...
Replies: 10
Views: 2073

Re: killing a set of elements from a list...

Just to clarify for me then - table.maxn and # are functionally identical so long as the table is packed, correct? Pretty much, yeah. If your table has no nil values then #t == table.maxn(t). But if there are gaps in the table then table.maxn is probably what you really want to use. Absolutely. If ...
by emonk
Thu Aug 28, 2008 10:02 am
Forum: Support and Development
Topic: How to change font size dynamically?
Replies: 3
Views: 2059

Re: How to change font size dynamically?

You should put this in the "keypressed" function, rather than checking "isDown" - that will return true 60 times a second, and overflow your stack (apparently) Uhhh... no. Code gets called 60 times per second (assuming vsync, etc) but returns each time. No stack problem. That's why I use love.timer...