Alice Community  

Go Back   Alice Community > Alice 2 > Share Worlds

Thread Tools Display Modes
Problem with mouse move event in array game
todd0312's Avatar
Status: Offline
Posts: 35
Join Date: Sep 2011
Angry Problem with mouse move event in array game - 11-16-2011, 09:07 AM


I am having a lot of problems with a game where I use a mouse event to move a cone to catch toruses falling from the sky. I am using arrays, and I know there must be a simpler way to do this.

I have tried creating a number of different arrays, but I ran into problems with my mouse event and my indexes (indices?) when I did that. There must be a MUCH simpler way to code this.

I removed an mp3 file from the beginning of the program and the end - and that "seemed" to help a little bit. It's "possible" there is just too much going on? Oddly, this did not reduce the file size.

I have attached the file.

Here are my issues:
1. Using my laptop, If I am don't keep touching the cone the entire game, sometimes I lose the ability to move it at all (if I let go).
2. The toruses fall in "all together" blocks, but you are not given credit for a catch (the cone changes color and a sound is played when this happens) until all of the toruses (falling at different speeds) have landed. If you catch the first one to land, you have to wait around until they all land before the "catch method" is initiated. There is only one sound when a ring is missed, but I can't get it to initialize "as" a torus lands. It has to wait for the rest. Everything is completely linear.
3. Because of the conditions I have set, not all toruses are capable of incrementing the count. For example, I have a "while count = 5 or count = 6" loop in which three rings fall. Because of the conditions, only 2 can garner points (You may have to look at it to see what I mean). There must be a better way to set up the conditions. I couldn't figure out a better way...
4. When I imported sounds, some worked fine (all mp3); others stopped the loops in their tracks.
5. If you release the mouse from the cone, and then try to grab it while a song is playing, the mouse event often fails to work (pounded this new version of the project out as quickly as possible, so didn't test it a lot).

Thanks in advance.

Attached Files
File Type: a2w catch the torus.a2w (2.84 MB, 13 views)
Reply With Quote
Status: Offline
Posts: 32
Join Date: Jan 2010
Location: Toledo, OH
Default 11-16-2011, 06:43 PM

Wow. May I make a few general statements that may help you.
1. Sound
a. One sound is enough to demonstrate that you can play sounds. Until you have the game working, don't add sounds. They just clutter logic, play, debugging, etc.
b. (When you specify full length) Whether you play a sound in a doTogether or a doInOrder, it will continue to play no matter what the duration of the other statements. DoTogether execute in the time of the longest element within the doTogether command.
c. When you import the sound file (whether you play it or not), the file size of your Alice world increases.
2. Variables
a. You have numerous variables that represent the same thing. I cleaned up some of this, but there are others.

Take a look at the file attached; especially the fall method. I made some major changes and suggestions of how to finish the method--not yet complete. Hope this helps.
Attached Files
File Type: a2w catch the torus.a2w (2.78 MB, 18 views)
Reply With Quote

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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.