
-----------------------------------
Fonzie
Tue Jan 11, 2005 1:39 pm

trouble with smooth animation
-----------------------------------
I just can't get something to animate smoothly across a background. I tried that tutorial with jupiter but all the stuff with the background moving (which I don't need) confused me. I just need a program to move something nicely across a screen without erasing the background. Any help will be greatly appreciated.

-----------------------------------
cool dude
Tue Jan 11, 2005 1:53 pm


-----------------------------------
it looks like your new to compsci because this is posted in the wrong section. also post the code u have and we will take a look at why u can't animate it smoothly across the screen. my guess is u don't have offscreenonly in your setscreen or a View.Update

-----------------------------------
Amailer
Tue Jan 11, 2005 3:08 pm


-----------------------------------
Well, for a program to create animations I suggest you look into [url=http://www.macromedia.com/software/flash/]Macromedia Flash MX, alot of people uese it for animations... But if you want to animate images (for ads and etc) try useing Image Ready (i got it with my Photoshop) or Fireworks.

-----------------------------------
Fonzie
Tue Jan 11, 2005 4:33 pm


-----------------------------------
bah, I meant to put this in the other forum. should I repost it there?

-----------------------------------
Martin
Tue Jan 11, 2005 4:40 pm


-----------------------------------
Nah. What forum? I'll move it for you.

-----------------------------------
Fonzie
Tue Jan 11, 2005 4:46 pm


-----------------------------------
turing help. thanks a lot. Such friendly mods.

edit: can anyone move this?

-----------------------------------
Martin
Wed Jan 12, 2005 2:12 pm


-----------------------------------
Here ya go.

Of course the mods are friendly. We are the hosts, you are our guests. It would make for a pretty boring website without visitors, no?

-----------------------------------
Fonzie
Wed Jan 12, 2005 7:25 pm


-----------------------------------
alright now, I've tried lost of things but everytime I animate either the background gets deleted or the animation is choppy as hell. If anyone has some simple code that can just basically move something across a background that'd be nice. Otherwise I'll post my actual problematic code in about an hour or two.

edit: alright, seems I deleted any code I've made where I animate, but I still have an old program in which I used animation and it's the same way I animate today. it has a few other errors. For one you have to push an arrow key before anything will happen, and from there you just control using the arrow keys.



% Car animation
% file: ICE2
% Jesse Forcht
% October 1 2004

var row, col : int
row := 10
col := 3

cls
colorback (1)

var chars : array char of boolean
loop
    loop
        Input.KeyDown (chars)
        locate (1, 1)
        if chars (KEY_UP_ARROW) then
            exit when row < 8 and col > 43
            if row < 2 then
            else
                row := row - 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_RIGHT_ARROW) then
            exit when row < 9 and col > 43
            if col > 59 then
                locate (1, 1)
                color (10)
                put "The light is red! I'm not breaking the law!"
                delay (3000)
            else
                col := col + 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_LEFT_ARROW) then
            exit when row < 9 and col > 43

            if col < 2 then
            else
                col := col - 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "     xxxxxxxxx" ..
                locate (row + 1, col)
                put "     x       x" ..
                locate (row + 2, col)
                put "xxxxxx       x" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_DOWN_ARROW) then
            exit when row < 9 and col > 43
            if row > 9 then
            else
                row := row + 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
    end loop
    cls
    colorback (22)
    color (3)
loop
        Input.KeyDown (chars)
        locate (1, 1)
        if chars (KEY_UP_ARROW) then
            exit when row < 1 and col > 1
            if row < 2 then
            else
                row := row - 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_RIGHT_ARROW) then
            exit when row < 1 and col > 1
            if col > 59 then
                locate (1, 1)
                color (10)
                put "The light is red! I'm not breaking the law!"
                delay (3000)
            else
                col := col + 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_LEFT_ARROW) then
            exit when row < 1 and col > 1

            if col < 2 then
            else
                col := col - 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "     xxxxxxxxx" ..
                locate (row + 1, col)
                put "     x       x" ..
                locate (row + 2, col)
                put "xxxxxx       x" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
        if chars (KEY_DOWN_ARROW) then
            exit when row < 1 and col > 1
            if row > 9 then
            else
                row := row + 1
                cls
                colorback (1)
                color (3)
                drawfillbox (0, 110, 640, 60, 7)
                drawfillbox (0, 60, 640, 0, 2)
                drawfilloval (501, 336, 40, 40, 23)
                drawfillbox (600, 110, 620, 220, 26)
                drawfillbox (590, 220, 630, 330, 14)
                drawfilloval (610, 240, 13, 13, 7)
                drawfilloval (610, 275, 13, 13, 7)
                drawfilloval (610, 310, 13, 13, 12)
                locate (row, col)
                put "xxxxxxxxx" ..
                locate (row + 1, col)
                put "x       x" ..
                locate (row + 2, col)
                put "x       xxxxxx" ..
                locate (row + 3, col)
                put "x            x" ..
                locate (row + 4, col)
                put "x            x" ..
                locate (row + 5, col)
                put "x            x" ..
                locate (row + 6, col)
                put "xxxxxxxxxxxxxx" ..
                locate (row + 7, col)
                put " x   x  x   x " ..
                locate (row + 8, col)
                put "  xxx    xxx " ..
                delay (100)
            end if
        end if
    end loop
    end loop
