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

Username:   Password: 
 RegisterRegister   
 lagging program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bvbjules13




PostPosted: Tue Jan 08, 2013 10:16 am   Post subject: lagging program

What is it you are trying to achieve?
i am trying to do an animation

What is the problem you are having?
for some reason when i run the animation, the program delays after i finish the animation and i do not have a delay being used


Turing:


fork TruckSound %playing sound

%truck moving
for i : -450 .. 50 by 2    %to go across the whole screen
    cls
    Hills ()     %drawing background
    Bamboo (625, 200)     %drawing bamboo
    Bamboo (775, 225)     %drawing second bamboo
    Tree (400, 5)     %drawing the tree (standing
    PandaAn (650, 150)     %drawing the panda animation
    Truck (i, 0)     %drawing the truck
    Font.Draw ("UNTIL THE HUMANS CAME...", 225, 50, font1, white)
    View.Update     %updating the screen
end for

EndMusic () %ending the music



i seem to have a lag after the end of music, when i start the next animation the program seems to wait then do the next animation, the procedure EndMusic consists of:

Turing:


procedure EndMusic ()
    finished := true %stoping the muic loop
    Music.PlayFileStop %stopping the music
    finished := false %resetting the variable so that the next ound can play
end EndMusic



Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Tue Jan 08, 2013 3:20 pm   Post subject: RE:lagging program

What do you mean, it delays? There's nothing in your code to cause this. The issue is likely somewhere else in your code (immediately following this for loop, I suspect).

Also,
code:
procedure EndMusic ()
    finished := true %stoping the muic loop
    Music.PlayFileStop %stopping the music
    finished := false %resetting the variable so that the next ound can play
end EndMusic


Unless you're doing something really funky in your sound processes, this is equivalent to calling Music.PlayFileStop on its own. You're setting finished to true, and then false again before anything else can look at it.
Tony




PostPosted: Tue Jan 08, 2013 3:26 pm   Post subject: RE:lagging program

Delays could also be caused by long loops and not refreshing the screen with View.Update (that is, stuff is still happening in the background, just nothing gets drawn to screen).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: