Page 1 of 1

Destroying a joint causes an error

Posted: Sun Oct 17, 2010 5:53 am
by Lord Uber Dowzen
OK, so now that I have a few days of spare time I'm trying to get my prototype build for my game finished. At the moment I've got some code that creates a circle shape and matching body which then attaches to the mouse so that you can drag it around. Clicking the left mouse button creates the object and holding the same mouse button drags it around. Finally, you'd release the mouse button to detach the circle from the mouse and have it become "free" as it were.

To do this I've written some code that destroys the joint when you release the mouse button but when I do this Love crashes. I did notice this excerpt from the wiki regarding destroying joints: "When you don't have time to wait for garbage collection, this function may be used to free the object immediately, but note that an error will occur if you attempt to use the object after calling this function." I assume that's what's happening here? If so, anyway around it?

Re: Destroying a joint causes an error

Posted: Sun Oct 17, 2010 8:34 am
by kikito
It would help if you specified what kind of error you receive. You could also upload the .love file so we could test it.

Re: Destroying a joint causes an error

Posted: Sun Oct 17, 2010 7:11 pm
by Lord Uber Dowzen
OK, will do. The error is just a straight up crash. e.g. Love doesn't display any error information.

I know the code it a bit of a mess but my plan is to restart from scratch when I've got the basics worked out.

Instructions: Click and hold on big circle and drag away to create smaller circle. Release mouse to drop smaller circle.