Search found 994 matches

by Taehl
Sun Feb 24, 2013 3:20 am
Forum: Support and Development
Topic: Why use ipairs and not just #?
Replies: 8
Views: 5268

Re: Why use ipairs and not just #?

Are you sure about that, Xgoff? I use #table all the time, and have never had any behavior like that. I thought that ipairs always behaved exactly the same as #table in regards to sequential numeric indices and nils.
by Taehl
Sat Feb 23, 2013 7:58 pm
Forum: Support and Development
Topic: Why use ipairs and not just #?
Replies: 8
Views: 5268

Re: Why use ipairs and not just #?

Numeric for is faster than ipairs, so I'd suggest using it in time-critical code (ie., inside love.update and love.draw), but elsewhere, ipairs is fine.
by Taehl
Sat Feb 23, 2013 8:17 am
Forum: Support and Development
Topic: Box2D crash issues
Replies: 4
Views: 1540

Re: Box2D crash issues

You definitely don't need a semicolon to have multiple statements on one line. Lua simply ignores the symbol. It's allowed only because some programmers are so used to using it. Lua doesn't care about whitespace, and in fact, you could put the entire program in one obscenely long line if you really ...
by Taehl
Sat Feb 23, 2013 6:33 am
Forum: General
Topic: What's everyone working on? (tigsource inspired)
Replies: 1791
Views: 1499514

Re: What's everyone working on? (tigsource inspired)

Our project is coming along nicely. (That's 42 FPS on a netbook) http://dl.dropbox.com/u/3713769/temp/crystals.b.1.png We've got working physics, some graphics and particles, asteroids which break apart when damaged, ships with multiple turrets, and AI-controlled skirmishers. It doesn't yet have sou...
by Taehl
Sat Feb 23, 2013 1:52 am
Forum: Support and Development
Topic: How would I create an idle state?
Replies: 4
Views: 2341

Re: How would I create an idle state?

Very easy to do. All you need is a variable for keeping track of which way you're facing. Personally, I'd keep animation state as a variable, too, and save yourself some code. Try this: require 'AnAL' ---- function love.load() love.graphics.setBackgroundColor(255,255,255) imgIdle1 = love.graphics.ne...
by Taehl
Fri Feb 22, 2013 7:34 am
Forum: Support and Development
Topic: Box2D crash issues
Replies: 4
Views: 1540

Box2D crash issues

So far, I've found the following Box2D crashes in Love: - Creating bodies within the scope of a collision callback - Unknown crash using world:queryBoundingBox, in the following code: shoot = function(self) self.shootTarget = nil local x,y = self.b:getPosition() world:queryBoundingBox( x-400,y-400, ...
by Taehl
Fri Feb 22, 2013 3:55 am
Forum: General
Topic: Advice on code optimization and bug issue
Replies: 7
Views: 5378

Re: Advice on code optimization and bug issue

I turn to Audacity for most of my sound-manipulation needs, since it's free, open-source, and small. There may be a better/faster/more-convenient one out there, but Audacity can do more than convert, which comes in handy. If you use Linux, chances are you already have it installed.
by Taehl
Fri Feb 22, 2013 1:47 am
Forum: General
Topic: Advice on code optimization and bug issue
Replies: 7
Views: 5378

Re: Advice on code optimization and bug issue

Personally, I'd recommend using libraries. They save you from having to re-invent the wheel, solving boring problems when you could be learning by solving important, game-making problems. I suppose it would be a good exercise to do it your own way once or twice, but you could probably also learn a l...
by Taehl
Thu Feb 21, 2013 10:56 pm
Forum: General
Topic: Advice on code optimization and bug issue
Replies: 7
Views: 5378

Re: Advice on code optimization and bug issue

Issue You've got code checking the keyboard in two different places. In one you check "if left then ... elseif right", and in the other you "if right then ... elseif left", which is producing your weird behavior. Since you set the variables "moving" and "direction...
by Taehl
Thu Feb 21, 2013 10:26 pm
Forum: Support and Development
Topic: [Problem] How I use collisions?
Replies: 1
Views: 1084

Re: [Problem] How I use collisions?

Well, you can use that in all sorts of ways. You just pass the coordinates, width, and height of two squares, and it will return whether or not they overlap. You can use that in an if statement to do stuff (like triggering an event, collision, removing one, whatever). I'll give you an example which ...