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

Username:   Password: 
 RegisterRegister   
 Animating with a static background
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
krazykipa




PostPosted: Tue Dec 16, 2008 5:12 pm   Post subject: Animating with a static background

Hi there everyone,

Just wondering, for this game I'm making there's an animation of a helicopter which must move against a still background.
The way I have it so far is that the background must be drawn each time through the loop due to the Draw.Cls
It works fine at home, but since my school's computers are crap, the ~1Mb background picture lags them up like... well, you get the point...

Anyways, I was just wondering if I could set the background to be static and unperturbed by the Draw.Cls so as to reduce lag and allow me to pass CompSci Very Happy
Thanks!

Oh, here's some code:
code:

loop
    Draw.Cls
    Pic.Draw (background, 1, 1, picMerge)
    Pic.Draw (copter, x, y, picMerge)
    Pic.Draw (wall, wallX, wallY, picMerge)
    %A procedure to update coordinates of chopper+wall
    updatePos
    View.Update
    %Crash Detection
    if y >= 490 or y <= 50 then
        exit
    elsif x2 > wallX and x < wallX2 and y2 > wallY and y < wallY2 then             
        exit
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
andrew.




PostPosted: Wed Dec 17, 2008 6:04 pm   Post subject: RE:Animating with a static background

Look up using sprites. Basically, you make your helicopter a sprite and when you change the x and y values, the picture is automatically redrawn without using cls.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: