animating objects without smearing
Author |
Message |
msimard8
|
Posted: 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
|
|
|
cool dude
|
Posted: 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
|
Posted: Fri Nov 26, 2004 10:18 pm Post subject: (No subject) |
|
|
simplest way - just use an image for the background and redraw that |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
DanShadow
|
Posted: 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
|
Posted: 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 |
|
|
|
|
|
|
|