Help with animation?
Author |
Message |
tokuroka
|
Posted: Thu May 24, 2007 8:20 am Post subject: Help with animation? |
|
|
Hi, I was just wondering if anyone could tell me what the problem is with my simple animation program? And how to fix it? This is for my Grade 10 ISU by the way. There is a black box following over my cars when I try to "takepic". I have tried changing the coordinates, and sometimes, the black box does not show up, but that is not the area desired that I wish to move. Thanks in advance.
setscreen ("offscreenonly")
% Vertical Car
procedure carcar
var carheight : int := 0
var y : int := 30
for x : 1 .. 3
drawfillbox (407, carheight + 317, 426, carheight + 375, y)
drawfillbox (404, carheight + 330, 406, carheight + 345, black)
drawfillbox (404, carheight + 355, 406, carheight + 370, black)
drawfillbox (427, carheight + 330, 429, carheight + 345, black)
drawfillbox (427, carheight + 355, 429, carheight + 370, black)
drawfillbox (409, carheight + 355, 424, carheight + 365, black)
drawfillbox (409, carheight + 330, 424, carheight + 340, black)
carheight -= 62
y += 30
end for
end carcar
% %Car
procedure car2
var y : int := 50
var carside : int := 0
for x : 1 .. 5
drawfillbox (carside + 30, 145, carside + 90, 165, y - 40)
drawfillbox (carside + 33, 142, carside + 50, 144, black)
drawfillbox (carside + 60, 142, carside + 77, 144, black)
drawfillbox (carside + 60, 166, carside + 77, 168, black)
drawfillbox (carside + 33, 166, carside + 50, 168, black)
drawfillbox (carside + 35, 147, carside + 42, 164, black)
drawfillbox (carside + 72, 147, carside + 80, 164, black)
carside += 67
y += 30
end for
end car2
var face2 : array 1 .. sizepic (403,208,430,380) of int
takepic (403,208,430,380, face2)
for decreasing x : 400..100
drawpic (402, x, face2, 1)
drawpic (402, x-1, face2, 0)
delay (10)
carcar
View.Update
end for
% loop
carcar |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rollerdude
|
Posted: Thu May 24, 2007 1:47 pm Post subject: Re: Help with animation? |
|
|
are you trying to move the cars, or the black box? becasue if its the box, then it seems ok, otherwise..um... i'll look at ur code a little more and see if i can help...
p.s. next time try to remember to put in code tags, im not a mod, but im sure one them will fix it soon... thnx |
|
|
|
|
|
rollerdude
|
Posted: Thu May 24, 2007 1:53 pm Post subject: Re: Help with animation? |
|
|
if you wanted to move ur cars, you need to give the procs a x/y parameter, then you wont need to take pics, one proc to draw cars, and another to delete them. then you could just ur for loop to give it an x coordinate (or y) then you would have to draw the road just before ur cars.... wait a tick,setscreen("offscreenonly"), just draw the road, then cars, View.Update it then cls... then do it all again cha cha cha!!
does this help? |
|
|
|
|
|
tokuroka
|
Posted: Fri May 25, 2007 8:25 am Post subject: Re: Help with animation? |
|
|
Haha. Yes, I have already done that in my last project assignment, but the problem is, my teacher is stubborn and will not let me use anything but these commands - the ones I have used above. Otherwise this project would be a cinch >< And yes, I am trying to move the cars. |
|
|
|
|
|
|
|