Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Problem returning to GUI
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
landfarm




PostPosted: Sat Dec 05, 2009 11:03 pm   Post subject: Problem returning to GUI

What is it you are trying to achieve?
I want the program to return back to the GUI after the animation is finished. My Turing version is the latest version, 4.1.1 or something.


What is the problem you are having?
The program will replay one of the two songs after the animation is done, and nothing else moves. The animation exited, but one of the songs would be replayed.


Describe what you have tried to solve this problem
I have absolutely no idea what is wrong, or how to fix it.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:



process Play1     %Allows it to become background music
    loop
        Music.PlayFile ("Halo1OpeningSuite.mp3")
    end loop
end Play1
process Play2     %Second music part
    loop
        Music.PlayFile ("Halo- Rock Anthem for Saving the World.mp3")
    end loop
end Play2
procedure Animation
    setscreen ("offscreenonly")
    c := 1
    fork Play1     %Starts music
    loop         %Begins animation, redbox standing in middle, followed by other boxes coming in
        current := Time.Elapsed
        if c = 1 then
            ay3 := 800
            drum := 15
            inc := 1
        end if
        if (current - timepassed) < 18890 then
            if drum > 20 then
                inc *= -1
            elsif drum < 15 then
                inc *= -1
            end if
            drum += inc
        end if
        colourback (red)
        drawfillbox (0, 140, 100, 340, 8)      %Speakers in background and outline. This is speaker #1
        Draw.ThickLine (0, 140, 0, 340, 5, black)        %2D Outline part
        Draw.ThickLine (0, 340, 100, 340, 5, black)
        Draw.ThickLine (100, 140, 100, 340, 5, black)
        Draw.ThickLine (0, 140, 100, 140, 5, black)
end animation
procedure Play
    Instructions
    Game
end Play
procedure Replay
    Intro
    Animation
end Replay
var button1:int:=GUI.CreateButton(20, 100, 0, "Play Game", Play)
var button2:int:=GUI.CreateButton(20, 70, 0, "Play Animation", Replay)
loop
    Font.Draw ("ISU : Animation with Special 'FX'", 20, 350, fontdefault, black)
    exit when GUI.ProcessEvent
    View.Update
end loop

Sponsor
Sponsor
Sponsor
sponsor
landfarm




PostPosted: Mon Dec 07, 2009 8:47 pm   Post subject: RE:Problem returning to GUI

Nobody? Dammit.
Tony




PostPosted: Mon Dec 07, 2009 8:56 pm   Post subject: RE:Problem returning to GUI

you didn't post the complete Animation code.

Chances are, you are not resetting the variables to their initial states for the reply.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
landfarm




PostPosted: Fri Dec 11, 2009 9:56 pm   Post subject: Re: Problem returning to GUI

I thought that part would have been enough. Well, here is the whole file. I just started Turing this year, and my comments may be a bit off, as in not descriptive enough. Hopefully, you guys can solve the problem because my teacher couldn't.


ISU.t
 Description:

Download
 Filename:  ISU.t
 Filesize:  43.9 KB
 Downloaded:  46 Time(s)

TheGuardian001




PostPosted: Sat Dec 12, 2009 3:08 pm   Post subject: Re: Problem returning to GUI

For future reference, In most cases if you haven't given us enough code for the program to actually run, it's probably not enough code, since we can't run the program to duplicate the problem.

I'm assuming the problem is in the animation part, as the rest seems to runs fine.
Turing:

process Play1     %Allows it to become background music
loop
        Music.PlayFile ("Halo1OpeningSuite.mp3")
end loop
end Play1


The music playing lines (such as the one above) appear to be one of the problems. Instead of looping Music.PlayFile, you should be using Music.PlayFileLoop. Changing those should fix the problem.
landfarm




PostPosted: Sat Dec 12, 2009 3:40 pm   Post subject: RE:Problem returning to GUI

Lemme try that. I am wondering though, why does the other song not reloop though? Is it because the song had completely finished playing?
Yea, thanks. It works now. Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: