Search found 192 matches

by trubblegum
Tue Apr 03, 2012 10:06 pm
Forum: Support and Development
Topic: Can't make a bullet
Replies: 9
Views: 1441

Re: Can't make a bullet

A simple way to make bullets would be something like : function bullet(x, y) return {x = x, y = y} end -- a bullet constructor bullets = {} -- a table to hold bullets table.insert(bullets, bullet(player.x, player.y)) -- a new bullet in the bullets table for i, b in ipairs(bullets) do -- iterating ov...
by trubblegum
Tue Apr 03, 2012 9:52 pm
Forum: General
Topic: Hi, I'm new.
Replies: 9
Views: 1303

Re: Hi, I'm new.

My eyes! :cry:
Please start here : https://love2d.org/wiki/Main_Page
by trubblegum
Tue Apr 03, 2012 9:48 pm
Forum: Libraries and Tools
Topic: Quick and dirty vector class
Replies: 10
Views: 1771

Quick and dirty vector class

Since I wrote this up in the support section, I figured I'd expand it a little into a lightweight vector class, and a (admittedly, quick) search revealed nothing similar in recent times, so why not share. Don't get me wrong .. HUMP.vector is a fine lib. This is just a quick-and-dirty snippet which m...
by trubblegum
Mon Apr 02, 2012 12:39 pm
Forum: Support and Development
Topic: Moving to mouse.
Replies: 8
Views: 1055

Re: Moving to mouse.

rokit boy wrote:Oh god I'm tired.
Then go to bed.
You are wasting your time (and ours) on problems (not to mention creating problems that don't exist) which you could easily solve if you were rested.
by trubblegum
Mon Apr 02, 2012 11:31 am
Forum: Support and Development
Topic: Libraries
Replies: 24
Views: 2782

Re: Libraries

Apparently, the way Inny showed is preferred. Personally, I like to see exactly what's going into my tables, but the nature of interpreted languages is such that indentation actually hurts your code. And no. Omitting the indents is not a realistic option. Certainly obj.var = func is preferable to th...
by trubblegum
Mon Apr 02, 2012 10:35 am
Forum: Support and Development
Topic: Moving to mouse.
Replies: 8
Views: 1055

Re: Moving to mouse.

rokit boy wrote:Ok thanks, how do I make the player move in that direction?
You're kidding, right?
by trubblegum
Mon Apr 02, 2012 8:23 am
Forum: Support and Development
Topic: Moving to mouse.
Replies: 8
Views: 1055

Re: Moving to mouse.

Don't know why you'd do all that work converting to degrees and back, but the functions are there if you really need to. love.load = function() vector = { length = function(v) return math.sqrt((v.x * v.x) + (v.y * v.y)) end, normal = function(v) l = vector.length(v); return {x = v.x / l, y = v.y / l...
by trubblegum
Sun Apr 01, 2012 9:54 pm
Forum: Support and Development
Topic: Libraries
Replies: 24
Views: 2782

Re: Libraries

The first thing I would suggest is to have a look at some existing libs and see how they do it. There are quite a few of them (including mine) and I'm sure they all have something to offer. Re ways to improve your code .. Some of this may be considered subjective, but the majority is at least accept...
by trubblegum
Sun Apr 01, 2012 7:56 pm
Forum: Support and Development
Topic: Libraries
Replies: 24
Views: 2782

Re: Libraries

Let me just clarify that I'm not stating any kind of law, or even accepted practice, although considering how a fellow developer may want to use your lib should always be among your primary considerations. OP asked for suggestions, so I put forward my preferences as something that might be worth con...
by trubblegum
Sun Apr 01, 2012 5:06 pm
Forum: Support and Development
Topic: Libraries
Replies: 24
Views: 2782

Re: Libraries

Please don't declare globals in my code. Instead, return a variable which I can assign as I see fit. Depending on what exactly your lib does, it may also be beneficial to return an instance. mylib.lua : local mylib = {} mylib.new = function(this, proto) return setmetatable(proto or {}, {__index = th...