Hi, I’m new here and very new to programming in general. I bought Corona on the Halloween promotion and I’ve been doing a lot of reading. Right now I’m trying to learn as much as I can and test different things. So I encountered the following problem:
I have 3 identical objects positioned like so:
X1 X2 X3
I want 2 of the objects, chosen at random, to swap place. The swap can’t be instantaneous, then need to actually move and be seen moving. Now this part is no problem, the problem comes when I want to swap them a second time (and a third and so on), then my noob code starts to get out of hand. If it wasn’t random it wouldn’t be a problem either, bu having to figure out where each object is in order to see if it has to move left or right and the distance (X1 can go to X2 or X3) is kinda getting to me.
How would you guys do it? Conceptually speaking, what would be the best way to design something like this? It should be super easy I know, but like I said, Lua is my first programming language and I’ve been doing this for 2 days, so be patient with me. Thanks.
[import]uid: 10835 topic_id: 3318 reply_id: 303318[/import]