Search found 16 matches

by emanevitaerc
Tue Jun 21, 2016 11:32 am
Forum: Support and Development
Topic: "Gravity well" in Box2D
Replies: 14
Views: 2582

Re: "Gravity well" in Box2D

Maybe it can be optimized by excluding inconsequentially small bodies and just keeping a table for bigger objects. Of course you'll still need to pull small bodies towards big ones, so you might need two tables. Also b1:getWorldCenter() should have been done outside of that inner loop. Righty o, th...
by emanevitaerc
Tue Jun 21, 2016 2:44 am
Forum: Support and Development
Topic: "Gravity well" in Box2D
Replies: 14
Views: 2582

Re: "Gravity well" in Box2D

Here's something that looks fairly decent. snippy snip I'm not sure how realistic it is (maybe someone more experienced can comment on that), but something along these lines in love.update should be alright for a game where all bodies are attracted to all other bodies. This looks to be exactly what...
by emanevitaerc
Mon Jun 20, 2016 1:12 pm
Forum: Support and Development
Topic: "Gravity well" in Box2D
Replies: 14
Views: 2582

"Gravity well" in Box2D

In a very crude space simulation using Love's physics, is there a way to roughly implement the attraction of bodies to each other based on their mass and density? I know using the world's gravity wouldn't make any sense since it's a single direction imposed on every body within it; all I'm really lo...
by emanevitaerc
Sun Mar 13, 2016 9:06 pm
Forum: Support and Development
Topic: Field of Vision in tile based game
Replies: 5
Views: 796

Re: Field of Vision in tile based game

So it was making everything invisible and now it's making too little invisible, right? Well that hopefully means that the bug is something to do with that if block then -- if there even was an obstructing block in this line for k = block, #ln do -- from that block to the end of the screen local lin...
by emanevitaerc
Sun Mar 13, 2016 8:47 pm
Forum: Support and Development
Topic: Field of Vision in tile based game
Replies: 5
Views: 796

Re: Field of Vision in tile based game

snip Oh, of course, that was silly of me. I put a break after the block = j . But now for some reason it only makes the opaque blocks in the line invisible, and everything beyond the intersection is still visible. snip Sorry, let me try to make it more legible. ... for j = 1, #ln do -- for every bl...
by emanevitaerc
Sun Mar 13, 2016 9:08 am
Forum: Support and Development
Topic: Field of Vision in tile based game
Replies: 5
Views: 796

Field of Vision in tile based game

I'm implementing a field of vision function in my tile based game, but it's just plain not working. All it does is make everything invisible. Basically, it just sends out bresenham lines to every tile on the edge of the screen, and if it intersects an opaque block, sets everything beyond that tile t...