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

Username:   Password: 
 RegisterRegister   
 Need Help Fixing Animation Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic
Author Message
cool1143




PostPosted: Sun Dec 06, 2009 8:36 pm   Post subject: Need Help Fixing Animation Problem

ok, ive only got one really simple question... How do you Pic.Draw and have image move upwards, but not leaving behind a few hundred images... like iaf you see on bottom, i have to use n blank image to erase previous drawn arrows...

Turing:


var blank, upArrow, downArrow, leftArrow, rightArrow : int
var x1, y1 , x2, y2, x3, y3, x4, y4: int

x1 := 0
y1 := 100
x2 := 100
y2 := 100
x3 := 200
y3 := 100
x4 := 300
y4 := 100

blank := Pic.FileNew ("blank.BMP")
upArrow := Pic.FileNew ("upArrow.BMP")
leftArrow := Pic.FileNew ("leftArrow.BMP")
downArrow := Pic.FileNew ("downArrow.BMP")
rightArrow := Pic.FileNew ("rightArrow.BMP")
for i : 0 .. 600
    Pic.Draw (upArrow, x1, y1, picXor)
    Pic.Draw (leftArrow, x2, y2, picXor)
    Pic.Draw (downArrow, x3, y3, picXor)
    Pic.Draw (rightArrow, x4, y4, picXor)
    delay (50)
    Pic.Draw (blank, x1, y1, picCopy)
    Pic.Draw (blank, x2, y2, picCopy)
    Pic.Draw (blank, x3, y3, picCopy)
    Pic.Draw (blank, x4, y4, picCopy)
    y1 += 15
    y2 += 15
    y3 += 15
    y4 += 15
end for



Please specify what version of Turing you are using
4.1.1


PS: this is kinda urgent...



DDR GAME.zip
 Description:

Download
 Filename:  DDR GAME.zip
 Filesize:  13.93 KB
 Downloaded:  38 Time(s)

 
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Dec 06, 2009 8:44 pm   Post subject: RE:Need Help Fixing Animation Problem

I see that you are using pixXor as a draw option. Do you know what does does, as oppose to default picCopy?

You can also just clear the whole screen with cls
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
 
cool1143




PostPosted: Sun Dec 06, 2009 9:02 pm   Post subject: Re: Need Help Fixing Animation Problem

but if i use cls, then all the other arrows would be cleared, and the images would look choppy...
 
TheGuardian001




PostPosted: Sun Dec 06, 2009 9:11 pm   Post subject: Re: Need Help Fixing Animation Problem

This is where the magic of View.Set("offscreenonly") and View.Update come in.

using View.Set("offscreenonly") will cause everything you draw to be drawn offscreen. This offscreen image will be drawn on the screen only when you call View.Update.

Basically, It causes everything to be drawn at the same time, instead of one by one, removing flickering and choppiness. You use it like this:

Turing:

View.Set("offscreenonly")
var pic1 : int := Pic.FileNew("one.bmp")
var pic2 : int := Pic.FileNew("two.bmp")
var pic3 : int := Pic.FileNew("three.bmp")
loop
    %draw pic 1 offscreen
    Pic.Draw(pic1,20,20,picMerge)
    %draw pic 2 offscreen
    Pic.Draw(pic2,20,40,picMerge)
    %draw pic3 offscreen
    Pic.Draw(pic3,20,60,picMerge)
    %Draw everything we just drew offscreen onscreen.
    View.Update
    %clear everything from the offscreen image.
    cls
end loop
 
cool1143




PostPosted: Sun Dec 06, 2009 9:32 pm   Post subject: Re: Need Help Fixing Animation Problem

hurray thanks! im gonna expect alot more posts from me in the help section during this week :/ making a game with limited knowledge in turing is hard
 
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: