
-----------------------------------
rawrawraw
Wed Apr 22, 2009 8:04 pm

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

-----------------------------------
DemonWasp
Wed Apr 22, 2009 10:13 pm

RE:Need Some Help With Animation
-----------------------------------
You need to turn to the standard game basis:


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:


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
Thu Apr 23, 2009 7:16 am

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 :D


[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

[/code]

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]
