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?
Destroying a joint causes an error
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 18
- Joined: Wed Sep 29, 2010 3:02 am
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Destroying a joint causes an error
It would help if you specified what kind of error you receive. You could also upload the .love file so we could test it.
When I write def I mean function.
-
- Prole
- Posts: 18
- Joined: Wed Sep 29, 2010 3:02 am
Re: Destroying a joint causes an error
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.
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.
- Attachments
-
- project.zip
- (1.79 KiB) Downloaded 127 times
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests