Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Mouse event freezes during "do together" actions nested in a "while" loop
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Angry Mouse event freezes during "do together" actions nested in a "while" loop - 11-22-2011, 04:09 PM

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:

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).

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.

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.

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
Attached Files
File Type: a2w torus catch game.a2w (2.80 MB, 6 views)
   
Reply With Quote
Revised version
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Default Revised version - 11-23-2011, 05:31 AM

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.

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. 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
Attached Files
File Type: a2w torus catch game.vers.2.a2w (2.84 MB, 9 views)
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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