Page 23 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 16, 2014 11:20 pm
by slime
Dr.Tyler O. wrote:Is it possible to use Fixture:setFilterData() while still letting those fixtures produce collision callbacks? I'm aware that it sounds silly but the collision callbacks are what I'm using to detect whether the players in my video game touch items. I just don't want the items to slow the player down with collisions.
Turning the Fixture into a sensor might be what you want, rather than using collision filtering.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 17, 2014 3:23 am
by Dr.Tyler O.
slime wrote:Turning the Fixture into a sensor might be what you want, rather than using collision filtering.
But, from my understanding, sensors don't collide with anything. I need to make it so that the body only collides with static bodies.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 17, 2014 7:26 am
by bartbes
Then have a look at [wiki]Fixture:setCategory[/wiki], [wiki]Fixture:setMask[/wiki] and [wiki]Fixture:setFilterData[/wiki].

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 17, 2014 8:42 am
by Zilarrezko
Ah thanks slime, didn't know you didn't have to use all the indices. My knowledge of C++ is very limited. It's very sad, I know assembly more than C++.

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Sep 18, 2014 6:10 am
by Whatthefuck
In XNA you can add any texture to a single spritebatch, in Love2D you need a separate spritebatch for every separate texture. What's up with that?

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Sep 18, 2014 6:25 am
by slime
The concept behind a LÖVE SpriteBatch is a little different from the concept behind an XNA SpriteBatch, even though they have the same name. LÖVE's can get drastically better performance in many situations as a result, but they're slightly less flexible.

Switching between different textures within a single begin-end pair an XNA SpriteBatch comes at a performance cost, and that cost would be there in LÖVE as well if that feature was implemented. You'll get the best performance in both frameworks by using Quads (or their equivalent) with a texture atlas and a SpriteBatch.

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Sep 18, 2014 7:48 am
by Whatthefuck
slime wrote:The concept behind a LÖVE SpriteBatch is a little different from the concept behind an XNA SpriteBatch, even though they have the same name. LÖVE's can get drastically better performance in many situations as a result, but they're slightly less flexible.

Switching between different textures within a single begin-end pair an XNA SpriteBatch comes at a performance cost, and that cost would be there in LÖVE as well if that feature was implemented. You'll get the best performance in both frameworks by using Quads (or their equivalent) with a texture atlas and a SpriteBatch.
Is there a possibility you guys could add another spritebatch class that'd behave like it does in XNA? I am using an atlas texture + quads + spritebatch to draw the world, but for misc objects I'm in a need of said flexibility that the XNA spritebatch provides.

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Sep 18, 2014 5:29 pm
by rmcode
How would I add multiple shaders to the same image? This obviously wouldn't work since the second shader would overrule the first one.

Code: Select all

        love.graphics.setShader(foo);
        love.graphics.setShader(bar);
        buttons:draw();
        love.graphics.setShader();
So I guess I need to draw the image to a canvas, apply the first shader, update the canvas and then apply the second shader to the canvas? If so, should the canvas be updated in the update() callback?

Re: "Questions that don't deserve their own thread" thread

Posted: Sun Oct 19, 2014 7:38 am
by Bya
How would one delete an entity? Like, completely wipe it from the current game. I.e, once an enemy is defeated, to delete it completely so it doesn't show up, follow the player, do anything that it would normally do.

Re: "Questions that don't deserve their own thread" thread

Posted: Sun Oct 19, 2014 8:24 am
by Plu
Usually entities are stored in a table, so to get rid of it you find its key in that table and then set that value to NIL.

Of course, the harder part is to make sure that any other references to it are also dropped, but that depends a bit on how your game is designed, I think.