How do I keep my apples in the basket?

Get help using Construct 2

Post » Mon Sep 25, 2017 12:54 am

link to capx: https://1drv.ms/u/s!AobC4q3rBlr6jqZIaTMFeTmozpwXZA

I'm not sure if there's a way to set the physics, or what I want can't be done.

The "basket" moves left and right (you have to touch the bottom to drag).

Basically, I want to catch the apples, which works. But when the user quickly moves the "basket" back and forth, the apples come out of the sides.
Is there a way to keep them in? If not, I guess I'll have to destroy them, but it was cool to see them accumulate.
B
11
S
3
Posts: 62
Reputation: 813

Post » Mon Sep 25, 2017 6:24 am

Official tutorial says "Avoid crushing/trapping objects with Solids"
https://www.scirra.com/manual/104/solid

I don't have much experience with physics engine, so maybe there is a better solution, but I came up with this: Clone basket!
https://www.dropbox.com/s/4mdcvjw7rbcno ... .capx?dl=0

Basically when an apple collides with the inside of the basket, I create a clone apple in a clone basket which doesn't move. And then I adjust position of the original apple based on its clone's position on every tick.

There still may be issues when there are too many apples in the basket or if you move mouse vigorously enough. Maybe you should somehow limit the speed of your basket.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
69
Posts: 1,048
Reputation: 37,659


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests