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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
Whatthefuck
Party member
Posts: 106
Joined: Sat Jun 21, 2014 3:45 pm

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

Post by Whatthefuck »

But there is a huge difference in amount of memory used between a spritebatch that was first created and had nothing done to it and one that was filled and then cleared, why is that?
User avatar
slime
Solid Snayke
Posts: 3142
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

I lied a bit - some of the memory allocation is deferred (both in LÖVE's code and, in some circumstances, in the video driver's code.) The amount of memory allocated should remain fairly constant after that though.
Bya
Prole
Posts: 20
Joined: Sat Sep 06, 2014 4:24 am

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

Post by Bya »

I can't get animations to work either with AnAL or anim8, so I decided I would just manually swap out images, which is working fine, except I can't figure out how to "delay" the image change instead of it being what I assume is an instantaneous swap. How would I go about delaying it?
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

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

Post by Plu »

You can't, not really. You'll have to delay it manually:

Code: Select all

maxTime = 0.2
curTime = 0

function love.update( dt )
  curTime = curTime + dt
  if curTime > maxTime then
    -- go to the next step of your animation
    curTime = curTime - maxTime -- for smoothness, don't just go back to 0
  end
end
Incidentally, this is exactly what anal and anim8 also do.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

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

Post by murks »

I'm playing with hardoncollider. I did the tutorial once but I feel it hasn't quite prepared me, so I have a few questions.
1) Do you tie images to the shapes (coordinate-wise)? It sort of seems like the sensible thing to do, but I'm not sure.
2) Do you use move or moveTo? Is there a serious drawback to one or the other?
3) I have something like gravity (basically just velocity for the y axis) and collision with the ground. If the pc collides with the ground it gets reset to the position of the ground (using moveTo). The outline of the rectangle I'm drawing jitters up and down like crazy, that seems not a sensible thing to do. Not sure what's wrong.
Snackrilege
Prole
Posts: 19
Joined: Sat Sep 06, 2014 8:50 pm

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

Post by Snackrilege »

Can I get someone to clear up some wording on the wiki for me? I can't sort this out... it's from the [wiki]Fixture:setFilterData[/wiki] page on the wiki -

If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each others categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
The first part makes sense. Always collide or never collide if the group number matches as positive numbers or negative numbers respectively. Got it. The next part though, is a bit more confusing.

Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks.
Okay... so, the filters 'select a cetegory with their mask'... I think this means, "check to see if object_a.mask contains object_b.category or vice versa"

okay.. I can get behind that, but heres the real tricky bit next..
The fixtures do not collide if that's not the case. If they do have each others categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
Okay, so if A.mask contains B.category, no collision. got it. but wait, the next sentence is "if they do have each others categories selected, the return value of the custom contact filter will be used."

huh? I thought they didnt collide? How are they getting a return value from a collision if it isn't occurring? What is the return value being used for? Which custom collision function are we talking about here? Are they colliding or are they not colliding? WHAT'S GOING ON

:)
User avatar
Dr.Tyler O.
Citizen
Posts: 58
Joined: Tue Jul 29, 2014 9:17 am
Location: United States

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

Post by Dr.Tyler O. »

I'm sure that almost everyone here is aware that when something like love.graphics.rectangle is executed it draws a rectangle that expands from the center point that it was created on. My question to you is, is there a way to make a rectangle only expand in a single direction on a given axis instead of it expanding in both directions?
Any topic I have ever posted that I felt did not require a .love file, although they were requested, never required one so I would appreciate if you did not ask me to supply one unless you think that I am ignorant for not doing so.
Snackrilege
Prole
Posts: 19
Joined: Sat Sep 06, 2014 8:50 pm

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

Post by Snackrilege »

Dr.Tyler O. wrote:Is there a way to make a rectangle only expand in a single direction on a given axis instead of it expanding in both directions?
The same difficulty happens when you are drawing rectangle shaped bodies in love.physics. I solved the problem by only using the polygon function and manually creating a rectangle --that is to say, I used love.physics.newPolygonShape(vertices of a rectangle) rather than love.physics.newRectangleShape(height and width). Using that, the rectangle s origin was the top right, as I had intended.

I'm not certain if that will work for the drawing tools as well, but perhaps it's worth investigating?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

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

Post by Robin »

love.graphics.rectangle(centerx - width/2, centery - height/2, width, height) should do the trick.
Help us help you: attach a .love.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

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

Post by Plu »

Snackrilege, that's not an easy subject at all unfortunately :(

I found this tutorial which explains it pretty well, however the code samples are in some form of C (because it's explaining box2d, the system behind love.physics)

I think it'll help you understand what's going on. If you have more questions on the subject, you should probably make your own thread as it's a complicated subject that'll probably take a lot of posts to grasp.

http://www.iforce2d.net/b2dtut/collision-filtering
Locked

Who is online

Users browsing this forum: Bing [Bot], sapphy and 4 guests