Search found 8 matches

by jpott
Sat Sep 09, 2017 7:20 pm
Forum: Support and Development
Topic: How would I go about drawing the same object multiple times?
Replies: 10
Views: 8873

Re: How would I go about drawing the same object multiple times?

tried to make as simple as possible: testCube = {} function testCube:create(x,y) local m = setmetatable({},{__index = testCube}) m.locationX = x m.locationY = y m.width = 55 m.height = 55 return m end function testCube:draw() love.graphics.rectangle("fill",self.locationX,self.locationY,sel...
by jpott
Sat Sep 09, 2017 6:59 pm
Forum: Support and Development
Topic: custom events
Replies: 1
Views: 1928

custom events

so on the love.event page https://love2d.org/wiki/love.event it says It is possible to define new events by appending the table love.handlers. Such functions can be invoked as usual, via love.event.push using the table index as an argument. i thought maybe this was a table i could access using table...
by jpott
Fri Sep 01, 2017 10:26 pm
Forum: Support and Development
Topic: cosine and sine values
Replies: 3
Views: 4022

cosine and sine values

ok I'm missing something obvious, obviously. But I'm sure someone can quickly tell me what the issue is. this code: angle = 0 print("angle: "..angle.." cos: "..math.cos(angle).." sin: "..math.sin(angle)) angle = 90 print("angle: "..angle.." cos: "..m...
by jpott
Sat May 06, 2017 2:35 pm
Forum: General
Topic: Help with constructor
Replies: 7
Views: 5053

Re: Help with constructor

i like this place
by jpott
Sat May 06, 2017 4:36 am
Forum: General
Topic: Help with constructor
Replies: 7
Views: 5053

Re: Help with constructor

this is the simplest way I've found to implement what I'm looking for. I've been playing around with it and it seems to do what i need. the 'parent' can have default values, and functions, and the 'child' or new objects inherit the values and functions, but can also independently change the values w...
by jpott
Sat May 06, 2017 3:29 am
Forum: General
Topic: Help with constructor
Replies: 7
Views: 5053

Re: Help with constructor

personally i find it easy to define them, as you would in a class or struct, since i can then look up to the top and easily see how/what i've defined, and don't forget to assign any variables, but I get what you're saying that it isn't necessary. you're solution is pretty much what I've ended up doi...
by jpott
Fri May 05, 2017 10:20 pm
Forum: General
Topic: Help with constructor
Replies: 7
Views: 5053

Re: Help with constructor

ok so here's a solution i've found while waiting for a response. maybe i just need to change the way i approach lua mentally, but this feels less... clean. Here's another simplified example: myCube = { cubeData = {}, width = 100, height = 25 } function myCube:draw() for k,v in ipairs(self.cubeData) ...
by jpott
Fri May 05, 2017 7:53 pm
Forum: General
Topic: Help with constructor
Replies: 7
Views: 5053

Help with constructor

Fairly new to lua & love2d. Here's a simplified example of what i'm trying to do... this should draw five 100x25 cubes 5 pixels apart from each other across the top of the screen (unless i'm screwing something else up as well) objectlist = {} myCube = { x = nil, y = nil, width = nil, height = ni...