Search found 11 matches
- Fri Jun 22, 2012 7:32 pm
- Forum: Support and Development
- Topic: Object destruction
- Replies: 7
- Views: 3327
Re: Object destruction
Even calling collectgarbage("collect") in update function doesn't help. I guess there are some references I've forgotten about. Gonna check it tomorrow. Thanks
- Fri Jun 22, 2012 6:31 pm
- Forum: Support and Development
- Topic: Object destruction
- Replies: 7
- Views: 3327
Re: Object destruction
Of course, pl = nil solves all the problems :) But, for example, for bullets I have such code: if love.mouse.isDown("l") then bullet:new(hostPlayer) --hostPlayer is a parent object end So bullet:new does return a table, but it is ignored. Instead, bullet is added to objList: table.insert(o...
- Fri Jun 22, 2012 5:44 pm
- Forum: Support and Development
- Topic: Object destruction
- Replies: 7
- Views: 3327
Re: Object destruction
You remove all references. Somewhy I dont. When, for example, I create an object "player" pl = player:new("EaJet", 250, 250, 180) and then destroy it with self = nil I can still access data in "pl" table, for eample, by drawing love.graphics.print(pl.module[1].x1, 25, ...
- Fri Jun 22, 2012 4:37 pm
- Forum: Support and Development
- Topic: Object destruction
- Replies: 7
- Views: 3327
Object destruction
I've faced a weird problem: I cant destroy an object O_o The thing is that I create almost every object as an instance of a class. So I cant set an object to nil directly, thats why I use such method: function physical:deinit() self = nil end But it doesnt work. I aslo tried: function physical:deini...
- Mon Jun 18, 2012 4:26 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
Thanks a lot, it works now
- Mon Jun 18, 2012 4:13 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
Thanks!
But for some reason an error occures:
"Box2D error: m_l > 0.0f"
And it doesn't matter whether I put "setMassData" before fixture or after it.
But for some reason an error occures:
"Box2D error: m_l > 0.0f"
And it doesn't matter whether I put "setMassData" before fixture or after it.
- Mon Jun 18, 2012 3:51 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
I apply the force using controls: function math.lengthdir(len, dir) return len * math.cos(dir), len * math.sin(dir) end function hostPlayer:checkControls(dt) if love.keyboard.isDown('w') then self.body:applyForce(math.lengthdir(1000, self.body:getAngle())) elseif love.keyboard.isDown('s') then self....
- Mon Jun 18, 2012 3:30 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
I've solved the problem by moving the chunk of code that determines mass, inertia and position of the body. Now my code looks like this: self.body = love.physics.newBody(world, x, y, "dynamic") self.body:setMass(25) self.body:setInertia(25) self.body:setPosition(x, y) self.shape = love.phy...
- Mon Jun 18, 2012 3:05 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
Somehow, polygon shapes do work when I create another project... Fine, I'll try to experiment with my code.
- Mon Jun 18, 2012 12:32 pm
- Forum: Support and Development
- Topic: Polygon shape - runtime error
- Replies: 10
- Views: 5566
Re: Polygon shape - runtime error
I havent tested all the bodies, but circle and rectangle works pretty good. Thats strange since a rectangle, according to wiki, is just a type of polygon. And the problem is certainly not in the code: when I replace a polygon with a circle or a rectangle, it does work. I think it's something with my...