Posted: Wed Dec 18, 2013 10:25 am Post subject: Issues with background music and looping
What is it you are trying to achieve?
make a math quiz/test that has music playing in background and eventually add graphics
What is the problem you are having?
music wont play in background and issues with the loops when you get a question wrong and if you finish the test the loop has problems with not stopping
Describe what you have tried to solve this problem
tried looking on the forums and tried to change the format of the loops used in the code
Turing:
%MATH QUIZ PROGRAM %Make music play in background instead of just as you start running program Music.Play("2<e>gb>e<bg<e>gb>e<bg<e>gb>e<bg<e>gb>e<b>b1b2b4be1e2b>2c<8b>4c<b2ab4ag2e1e")
put"If you fail a question you need to redo the last answer. " put"What is 5x11? " var num:real const numans:=55 loop get num
if num=55 thenput"Good job " loop put"What is the Square root of 64? "..
var sqrt64:real get sqrt64
if sqrt64=8 thenput"WOW great work! " loop put"What is 2x43 to the power of 2? " var ques1:real get ques1
if ques1=3698 thenput"Awesxome work, the final question is next " loop put"This is the final question. 2(35x2)**2/4 ? " var ques2:real get ques2
if ques2=2450 thenput"CONGRATULATIONS you beat the test :D " loop put"You have beat the test good job :) " endloop else put"What matters is that you tried " exit endif endloop else put"You came pretty close " exit endif endloop else put"Nice try ;) " exit endif endloop else put"FAILURE" exit endif endloop
Please specify what version of Turing you are using
4.1.1
Sponsor Sponsor
Raknarg
Posted: Wed Dec 18, 2013 1:48 pm Post subject: RE:Issues with background music and looping
That's because music.play doesn't run in the background, it only runs when you call it. You could use actual music, that would play in the background
Dreadnought
Posted: Wed Dec 18, 2013 4:17 pm Post subject: Re: Issues with background music and looping
To play music in the background (either music that you create or a music file) you need to fork a separate process that plays the music while your game runs. You can think of each process as a separate program while it runs.
This is exactly what Music.PlayFileReturn and other similar functions do to play music in the background.
Raknarg
Posted: Wed Dec 18, 2013 4:34 pm Post subject: RE:Issues with background music and looping
Not true, actually. You can play music without it being in a process. I used to do it when I used Turing.
Dreadnought
Posted: Wed Dec 18, 2013 5:03 pm Post subject: Re: Issues with background music and looping
Raknarg wrote:
Not true, actually. You can play music without it being in a process. I used to do it when I used Turing.
There is a process either in your code or in the Turing source code (found under "Turing 4.X -> predefs").
Raknarg
Posted: Wed Dec 18, 2013 5:54 pm Post subject: RE:Issues with background music and looping