Motokeiro

unread,
Jun 20, 2016, 10:21:22 PM6/20/16
to MIT App Inventor Forum
Hello everybody, How are you?
I'm trying to make a move that looks a lot like the game of the three conchas.


  Some objects (the circles) move in a random way on the x axis but can not help that they do not overlap one over the other
can you help me?

initial.jpg
right final postion.jpg
WRONG.jpg

Tim at Loddon

unread,
Jun 21, 2016, 8:00:18 AM6/21/16
to MIT App Inventor Forum
Could watch that video for hours, I never want to know how it is done though ;)

We are going to need some blocks Motokiero and for you to confirm that you want all the shells in a straight line and not overlapping, please.

ScottFerguson

unread,
Jun 21, 2016, 10:40:52 AM6/21/16
to MIT App Inventor Forum

Motokeiro

unread,
Jun 26, 2016, 3:31:44 PM6/26/16
to MIT App Inventor Forum
hi scott, 
thanks for your help but my problem is this

ScottFerguson

unread,
Jun 26, 2016, 4:10:04 PM6/26/16
to MIT App Inventor Forum
You just need to make sure the x position of the sprites/buttons are the starting x value + a random multiple of the offset between them.

Abraham Getzler

unread,
Jun 26, 2016, 4:15:04 PM6/26/16
to MIT App Inventor Forum
What if you set small target posts at the five starting and ending positions,
behind (< z) the sprites),
keep the posts in a list, generate a random copy list for target destinations,
and set your moving sprites a speed and point each towards its target post.

Have a collision detection event for each sprite, but respond only to collision with that sprite's designated target post,
by comparing (x,y) values or by comparing OTHER against the post component (haven't tried that.)
When collision with designated target is detected, set speed to 0 to stop there.

ABG

Abraham Getzler

unread,
Jun 26, 2016, 11:03:21 PM6/26/16
to MIT App Inventor Forum
I got it working in 2 dimensions.

See attached.

ABG

2016-06-26 23_00_25-5554__build_.png
shuffle.png
shuffle_balls.aia
2016-06-26 23_00_55-5554__build_.png
Balln_CollidedWith.png
blocks.png
btnShuffle.png
checkTarget.png
Designer.png
globals.png
Screen1_Initialize.png

Motokeiro

unread,
Jun 28, 2016, 11:11:43 PM6/28/16
to MIT App Inventor Forum
HI Abraham! Thanks for your help
but your file aia is not working

error.jpg
Screenshot_2016-06-29-00-11-00[1].png

Motokeiro

unread,
Jun 28, 2016, 11:38:33 PM6/28/16
to MIT App Inventor Forum
I'm almost there. 
so far I can adjust objects and make random movements.
but as you guys can see, the objects are still overlapping and consequently disappearing.
to you understand the sprites:
ponto = red point
quadro =square
tela = canvas


RANDOM.aia
random.jpg

Abraham Getzler

unread,
Jun 29, 2016, 8:49:13 AM6/29/16
to MIT App Inventor Forum
I got that error message too, until I did a Cold Restart on my emulator.

That was caused by a recent AI2 update, that did not signal to the emulator's Companion that it needed to update.

Do a Cold restart on the emulator connection, then try to connect, and follow the usual emulator Companion update procedure.

ABG

Abraham Getzler

unread,
Jun 29, 2016, 8:51:55 AM6/29/16
to MIT App Inventor Forum
Also, I added a docking procedure and a write up.

Look for the app shuffle_balls in the Gallery for everything.

Additional apps are under agetzler.

ABG

Motokeiro

unread,
Jul 5, 2016, 10:01:02 PM7/5/16
to MIT App Inventor Forum
Hello friends!
I'm almost getting hit the positions of sprites.
But I try some difficulty getting and error message.
You Can my help?
I'm sending the file if you guys want to take a look
RANDOM2.aia
MIT App Inventor.png
MIT App Inventor2.png
MIT App Inventor3.png

Motokeiro

unread,
Jul 5, 2016, 10:05:04 PM7/5/16
to MIT App Inventor Forum
the labels 1,2, 3 are to show the X position
the labels 4,5 are to show the Yposition
and the label 6 is to show tthe length of list GLOBAL POS_QUADRO.
I speak portuguese, so if you are some doubts about sprites names or variables names, ask me.

Abraham Getzler

unread,
Jul 6, 2016, 11:30:52 AM7/6/16
to MIT App Inventor Forum
The problem root is that you are picking a random number too close to the end of the list.
After you pick the random number, you deplete the list three times at that location.
So the limit for picking a random index should be length(list)-2, to allow for removing length(list)-2, ...-1, ...-0.

Also, you replenish the list when it is empty, but that is not enough.
If your list has length < 3, it won't have enough items to satisfy your triple depletion.
So change that IF test at the top from IF LIST IS EMPTY to IF LENGTH(LIST) < 3
ABG

Reply all
Reply to author
Forward
0 new messages