Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Mouse event freezes during "do together" actions nested in a "while" loop (http://www.alice.org/community/showthread.php?t=7639)

todd0312 11-22-2011 04:09 PM

Mouse event freezes during "do together" actions nested in a "while" loop
 
1 Attachment(s)
Hello:

Actually, I am having a number of issues.

I am making a game - using arrays - in which toruses fall from the sky - in increasing numbers as the game progresses. I have figured out a somewhat simple-minded way to do it, but... the mouse event freezes when I have the rings fall at the same time. A number of things happen when each ring falls, when the rings fall together, each ring is already in its own do together block, and if I have 3 rings falling at the same time, each of those "do together blocks" is nested in - another "do together block". I am guessing (I am new to this), but I am not sure how else to get the game to work, even half-ass as it is.

I have to use arrays for this (yes, it is a school project... and I don't want anyone to do it for me), but I cannot wrap my head around this. I have an "index", but I don't use it directly in the game. I was given this advice, but I still couldn't figure out how to use it:

[COLOR="DarkRed"]Use a nested loop (a loop inside of a loop). In the inner loop set the rings to fall using an array with an index. Keep looping while the index is less than another variable called ceiling. In the outer loop increment the ceiling variable so with each pass through the outer loop will cause the inner loop to add another object (ring).[/COLOR]

If anyone could look at this (first to test if it even opens); it does on both of my computers, I would really appreciate it.

Should I have my array in a parameter? I just don't get it. I'm not sure what the advice above means as far as setting a ceiling, or where that variable should be set. I am just at a loss.:mad:

I don't really care if I don't take advantage of array properties too much (and just use the array in the same way as a list instead). I just want it to work properly at all. If anyone knows that the advice given above as far as using "index" to get the number of toruses to increase as the game progresses, that would be greatly appreciated. It's Greek to me. :confused:

I do have sounds attached to the action in the program, but removing them didn't make any difference. I had the same problems with or without them.

Thanks in advance. The world is attached.

Take care,

Todd

todd0312 11-23-2011 05:31 AM

Revised version
 
1 Attachment(s)
Up early trying to figure this thing out so I can move on to my final project.

I have attached a revised version of the game whose code is a bit easier to read. I have given each torus a separate method (one for each torus in the array), rather than having the code for all in one method.

Rather than having the method statements in nested "do together" blocks for each loop, I have their methods grouped together in one "do together" block, with new rings falling according to conditions set by the score of the game (the higher the score, the more rings are passed from the array).

So - it doesn't look like the nested "do together" blocks was the issue. I am still having issues losing the ability to use the mouse to move the cone. It seems intermittent. Sometimes I can move it with the mouse when the toruses are falling, others not. Sometimes I can move it at the opening of the game, etc. etc.

Hopefully, this version will be less tortuous (maybe torture) to read than the first version.

This thing is driving me bananas.:eek:

I have tried to get the same effect using the index to iterate through the array, as was described in the previous post, but I can't seem to figure that out. :mad: The only way I've been able to do it is by creating methods for particular items from the array (item 0, 1, 2, 3, 4).

Any advice greatly appreciated. My coding abilities, as of now - are - null. It should be easy enough to follow, though.

Thanks,

Todd


All times are GMT -5. The time now is 08:00 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.