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

Username:   Password: 
 RegisterRegister   
 Need Some Help With Animation
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rawrawraw




PostPosted: Wed Apr 22, 2009 8:04 pm   Post subject: Need Some Help With Animation

What is it you are trying to achieve?
I want to make an imported picture move across another picture.


What is the problem you are having?
The problem is that when I cls the moving picture, it also erases the background picture as well.


Describe what you have tried to solve this problem
I tried without cls but it apparently can't work with out cls.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
File is attached please take a look.

Please specify what version of Turing you are using
I'm using Turing 4.1.1



AnimationProject.rar
 Description:

Download
 Filename:  AnimationProject.rar
 Filesize:  121.39 KB
 Downloaded:  53 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Wed Apr 22, 2009 10:13 pm   Post subject: RE:Need Some Help With Animation

You need to turn to the standard game basis:

Turing:

loop
    % update position of foreground pic here

    Draw.Cls()

    Pic.Draw ( background )

    Pic.Draw ( foregroundPic )

end loop


or, if you want to do it better, include the anti-flicker code:

Turing:

View.Set ( "offscreenonly" ) % Render to a buffer, then output to screen when we're done

loop

    % update position of foreground pic here

    Draw.Cls()

    Pic.Draw ( background )
    Pic.Draw ( foregroundPic )

    View.Update()

end loop
ecookman




PostPosted: Thu Apr 23, 2009 7:16 am   Post subject: Re: Need Some Help With Animation

sorry i don't have Winrar ...but i will teach you stuff that contrasts...from the post above it sounds like you have pictures...but the same principals apply.


To make things move...you need to use for loops and loops and the location function (if using text).


a for loop will loop X number of times
loop loops for ever
and the cls that you know
here is a little animation that i cooked up a while ago...if you need to move a picture use the above post for the function and use this layout Very Happy


code:

for a : 1 .. 20
cls
    locate (1, +a)

    put "      ______"
    locate (2, +a)

    put "     / TTYL \\#########  "
    locate (3, +a)
    put " ___/________\\___"
    locate (4, +a)
    put "/  ____________  \\"
    locate (5, +a)
    put "[-|  |O|  |O|  |-]"
    locate (6, +a)
    put "   "



    delay (100)

end for



your problem with cls clearing the background is just the location of the cls function.
as i have in my animation the functions is before the code ends so it isn't the last thing it does... if your background still disappears you can put in another loop for another part and then redraw the background


pardon any typos...i am doing this in class when we are watching a movie (i have the screen off lol)

cheers
any problems...pm me and i will make a tutorial of animations.[/code]
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: