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

Username:   Password: 
 RegisterRegister   
 animating objects without smearing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
msimard8




PostPosted: Fri Nov 26, 2004 5:53 pm   Post subject: animating objects without smearing

this question is probably easy to answer

how do you animate an object without it smearking away a multi colour background

if the background is solid, i draw the object, put a delay, and cover it up using a counting loop

but if it is different colours in the back when i cover it up, i can only cover up with one colour

help
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Fri Nov 26, 2004 6:08 pm   Post subject: (No subject)

i don't really understand wat u r asking. please post the code u have so far and i will help u
Tony




PostPosted: Fri Nov 26, 2004 10:18 pm   Post subject: (No subject)

simplest way - just use an image for the background and redraw that
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DanShadow




PostPosted: Fri Nov 26, 2004 11:28 pm   Post subject: (No subject)

Smearing the image?? I think I understand...
Basically, what I'd say is make your colored background, and make a ball. You want the ball to be (for example) red. So...lets just say we want the ball to move to the right (x:=x+1 or x+=1). Ok, first, draw the background, (drawfillbox(0,0,maxx,maxy, -bg color- )), then draw the redball as its x,y co-ordinates (drawfilloval(x,y,5,5,red))...ok, now make it move (x+=1). I'd suggest putting in a delay, like mebe (delay(5)), then the loop will restart, drawing the background over the previous ball, and redrawing the new ball in its new position! That will make the ball move without leaving a colored "smear" across your background.
code:

var x,y:int:=5
y:=200
loop
drawfillbox(0,0,maxx,maxy,black)
drawfilloval(x,y,5,5,red)
x+=1
delay(5)
exit when x>maxx
end loop
con.focus




PostPosted: Sun Nov 28, 2004 7:45 pm   Post subject: (No subject)

lol this is simple there is to ways to do it either make a delay n tell it to redraw the same image in the same spot the same color as the back ground n then draw the image in the next spot example
code:
    drawline (12,12,45,45,4)
 delay (1000)
 drawline (12,12,45,45,0)
 drawline (24,24,57,57,4)

or draw the image n background then delay and then clear the screen and re draw the line in a different location
code:

drawline (10,10,100,100,4)
delay (1000)
cls
drawline (30,30,130,130,4)


the secound way generates more code if the is alot lot on the screen can be choppy depends on how u go about doing it
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  [ 5 Posts ]
Jump to:   


Style:  
Search: