Search found 107 matches

by MrFariator
Sat Jun 15, 2019 5:56 pm
Forum: Support and Development
Topic: What are the names of RT/LT/RB/LB buttons for Love 2D ?
Replies: 4
Views: 1246

Re: What are the names of RT/LT/RB/LB buttons for Love 2D ?

triggerright - right trigger, axis value triggerleft - left trigger, axis value rightshoulder - right shoulder, button value leftshoulder - left shoulder, button value Axis values you get with using getGamepadAxis and button values you get with isGamepadDown . When querying the axis state, I recomm...
by MrFariator
Sat Jun 08, 2019 6:24 pm
Forum: Support and Development
Topic: [SOLVED] Dynamically create methods for a class.
Replies: 3
Views: 585

Re: [SOLVED] Dynamically create methods for a class.

Just quick two cents, I think you are creating unnecessary garbage by wrapping the varargs into a table, only to unpack it a few lines later. This kind of code, unpack() in particular, can be rather costly if those callbacks are going to be called often. for _, v in ipairs(callbacks) do Container[v]...
by MrFariator
Wed Jun 05, 2019 4:48 pm
Forum: Support and Development
Topic: starting to development a game [solved]
Replies: 6
Views: 1338

Re: starting to development a game

Sheepolution's tutorial covers animated sprites and then some.
by MrFariator
Fri May 03, 2019 12:53 pm
Forum: Support and Development
Topic: bump.lua - push passiv object
Replies: 2
Views: 439

Re: bump.lua - push passiv object

If we can assume that the pusher is going to move a specified amount of units multiplied by dt, and the pusher comes along the player object, we can do the following: - check the location at which the collision begins to occur - get the difference between the pusher's final location and where the co...
by MrFariator
Sat Apr 27, 2019 11:14 pm
Forum: Support and Development
Topic: [bump.lua] detect a collision only between 2 items
Replies: 6
Views: 556

Re: [bump.lua] detect a collision only between 2 items

That's not quite how the filter is supposed to be used. Here's the fixed up code: function camera.update(dt) player.x, player.y, cols, len = world:move(player,player.x,player.y, camera.filter) -- note we're passing the function, not its return value for i = 1, len do if cols[i].other.is3 then print(...
by MrFariator
Sat Apr 27, 2019 10:54 pm
Forum: Support and Development
Topic: [bump.lua] detect a collision only between 2 items
Replies: 6
Views: 556

Re: [bump.lua] detect a collision only between 2 items

Can you post the code for the filter function, as well as how you're passing it to bump?
by MrFariator
Sat Apr 27, 2019 10:08 pm
Forum: Support and Development
Topic: [bump.lua] detect a collision only between 2 items
Replies: 6
Views: 556

Re: [bump.lua] detect a collision only between 2 items

You can write a custom filter for those specific circumstances. Lets say that item2 is a table, and has a "isItem2" field in it, then you could just detect it like so: local filterForItem1 = function(item, other) if other.isItem2 then -- return whatever the intended collision response is else -- han...
by MrFariator
Fri Apr 26, 2019 11:47 pm
Forum: Support and Development
Topic: Tables for Dummies
Replies: 9
Views: 2009

Re: Tables for Dummies

The difference between a period and a colon is purely syntactical sugar. Consider the following: local myTable = {val = 0} -- these two function declarations are functionally the same function myTable.setVal ( self, val ) -- note that "self" here could be any other name as you wish self.val = val en...
by MrFariator
Thu Apr 25, 2019 1:06 am
Forum: Support and Development
Topic: Trying to reference specific value from {} object throws 'nil value' error
Replies: 2
Views: 1227

Re: Trying to reference specific value from {} object throws 'nil value' error

The problem is with your love.load. You're effectively replacing the link table with an image, and as such the values you assigned at the top of your code do not exist anymore, causing the error. What you probably meant to do is: function love.load() link.image = love.graphics.newImage("sprites/link...
by MrFariator
Mon Apr 15, 2019 4:01 pm
Forum: Support and Development
Topic: Click to Move Question [SOLVED]
Replies: 5
Views: 6396

Re: Click to Move Question

Untested code from the top of my head, but something roughly like this should do it. The two math functions I took from the wiki's math page . -- Returns the distance between two points. function math.dist(x1,y1, x2,y2) return ((x2-x1)^2+(y2-y1)^2)^0.5 end -- Returns the angle between two points. Ra...