The lack of movement ability of the object in one direction but the ability to move in the opposite direction in abacus

Hi.I want to make an abacus.The beads should stop when they collide but not be able to drag in that direction but be able to drag in the opposite direction.i use canvas and image sprit.Please help.Thanks

Just one (the one on the left) or both (dragging the one on the right, to the left) ?

Can you share your aia project?

Hello, in fact, there are 4 beads in each row, if there is an empty space on the left or right side, then the bead can be dragged, and if there is no empty space, it cannot be dragged.thanks
abicus.aia (33.1 KB)

Try this:

abacusTopLineOnly.aia (35.1 KB)

Hello and thanks. It seems that it is not working properly!

I wasn't expecting you to keep dragging a bead once it had bounced against another!

Maybe there is another solution....

Like this

I do something similar in this obsolete project, using two balls in a thin canvas to adjust the heights of stacked Arrangements:

(The View Management Facilities)

In your case, for lots of beads on multiple wires, you would need to pair up each bead with its upper and lower neighbor components in two lookup tables (upper and lower).

You might need multiple thin Canvases, one per wire, to take advantage of edges to stop drags.

Try this, not like your video though

abacusTopLineOnlyRevised.aia (105.3 KB)

Hello and thanks. Balls shape cannot be changed in the canvas, that's why I didn't use it and used the imagespirits.

Hello and thanks. It seems that the beads do not move ! In the project below, move the red bead.
abacus.aia (79.4 KB)

The main question is how to limit the drag of an object to a certain range?

Since the direction will be up or down, so you can use touched event, no need dragged event.

Hi,thanks.please more explain.The main question is how to limit the move an object to a certain range(between two other object)?


Hello and thank you, very clicking and having the x and y coordinates of four beads in different modes, you can limit the movement between two objects, but we want to do this by this:

With dragging(my question)

With clicking(you made):

Suggest applying drag method to each ball, but avoid collisions by using X locations as targets for each sprite. Issue may be that the balls are too close together anyway for fat fingers to accurately select them?

1 Like


barkhord.aia (75.8 KB)

This seems to work reasonably well

abacusVert.aia (104.1 KB)

1 Like

I drew on my experience riding the NYC subways at rush hour to develop this:

Sample run
subwayPush.aia (106.5 KB)

The idea is to add lists of sprite components to act as tracks, with disabled tiny sprites at each end of each track, to act as stoppers.

Before each sprite responds to a drag, it must check the gap between it and its neighbor in that drag direction, and shove that neighbor a minimal distance to allow room for the current sprite's drag.

The procedures are recursive, like the chain of pushing needed to crowd into a subway car.

(Thanks to @TimAI2 for the Sprites)
(Thanks to @mah_bagh for a fun problem)

Detailed explanation:

The Tokyo subway image is a little misleading. AI2 sprites are inelastic, compared to subway passengers, so they don't transfer force according to Hooke's Law.

What is being transferred from passenger to passenger (sprite to sprite) is a polite request:

Could you please move dY pixels in this direction, if you don't mind, and if you have the space to do so?

(dY is short for delta Y, math speak for a difference between two Y values. It's Y values because the sprites move up and down in this example.)

The Sprites are lined up along a line on a Canvas:

(See further posts in this thread, to give the board a chance to catch up.)