code doesn't execute in logical sequence

Dan,

no offence taken, I should also have been more clear in what I ment. Sometimes I tend to leave out things in what I write and expect the people to understand it anyway. Sorry about that.

Anyway, if Ansca can’t help you properly, you can send me the code if you like to

mike (at) fantomgl (dot) com

Cheers
Michael Hartlef

http://www.whiteskygames.com
http://www.twitter.com/mhartlef [import]uid: 5712 topic_id: 1499 reply_id: 4245[/import]

> I’d have to move most of my code to the sound event completion listener than that wold be designing the whole game AROUND the sound. I don’t want to do that. And it wouldn’t seem right to do it that way.

I haven’t looked at your code, but you really ought to consider breaking your “main” code into subroutines. It shouldn’t be hard, just add a function statement at the beginning and an end at the end (and indent appropriately so you can read it). Do this in blocks that make sense, and then your “main” code is just a sequence of calling those functions in the right order. And, if some of them are initiated using events, it’s easy to do that.

Programming using Event Listeners is a completely different style than standard procedural programming. And, IMHO, it’s arguably the “right” way, especially on mobile. Adding a timer or a loop is really a hack, and depends on the CPU speed – imagine if the CPU were 3x faster! Event Listeners don’t do anything until fired, and they will always fire at (or slightly after) the right time.
[import]uid: 54 topic_id: 1499 reply_id: 4247[/import]

A quick note for everyone about support response time. Sometimes it takes a couple days for us to catch up with the large volume, or to route an inquiry to the right person. It’s worse on days where we have a lot of meetings (mondays!). The fastest response is generally emailing us, although those on the forums appreciate your post since they get the benefit of the conversation as well. We will be improving this with the imminent launch of a public facing bug database, which can be used for inquiries as well. [import]uid: 54 topic_id: 1499 reply_id: 4248[/import]

I can see from your statement that you might think I’m a beginner at coding with one long spaghetti code routine. Well I have a bit more experience than that.
My main code does call LOTS of subroutines. And I only used the pause loop to try to see if that would “cure” the original problem". I was trying to figure how how /why Corona was doing (what seem on the surface) illogical processing of the order of function calls in my code.

Also it’s be nice if there were more detailed documentation about the timing and execution order of the sound routines. e.f. the thing you have to do to get desired results and the things one shouldn’t do. Maybe there already is some explanation somewhere but I couldn’t finde is from reading the docs nor frem searching the forum.

Regards [import]uid: 295 topic_id: 1499 reply_id: 4256[/import]

I can see from your statement that you might think I’m a beginner at coding with one long spaghetti code routine. Well I have a bit more experience than that.
My main code does call LOTS of subroutines. And I only used the pause loop to try to see if that would “cure” the original problem". I was trying to figure how how /why Corona was doing (what seem on the surface) illogical processing of the order of function calls in my code.

Also it’s be nice if there were more detailed documentation about the timing and execution order of the sound routines. e.f. the thing you have to do to get desired results and the things one shouldn’t do. Maybe there already is some explanation somewhere but I couldn’t finde is from reading the docs nor frem searching the forum.

Regards [import]uid: 295 topic_id: 1499 reply_id: 4257[/import]

I sent a reply by email since I was able to look at your code in detail. playEventSound() is not synchronous, it returns immediately and the sound continues playing. In order to “wait” until the sound has finished before proceeding, you need to use a sound completion listener. Fortunately in your code this looks straightforward, I think. [import]uid: 54 topic_id: 1499 reply_id: 4277[/import]