
-----------------------------------
legends31
Tue Dec 24, 2002 12:14 am

Diagonal animation
-----------------------------------
I need Help making an animation move diagonaly.  I can easily make it work back and forth, up and down but how to i make to move across the x axis and the y axis at the same time?
this is what i have



process ball
for y : 0 .. 400 by 10
    drawfilloval (50, y + 50, 6, 6, 7)
    delay (50)
    drawfilloval (50, y + 50, 6, 6, 0)
end for
end ball


thanks
Andrew

-----------------------------------
cutecotton
Tue Dec 24, 2002 3:53 pm


-----------------------------------
wouldn't it be like this:

procedure ball 
for y : 0 .. 400 by 10 
    drawfilloval (50+y, y + 50, 6, 6, 7) 
    delay (50) 
    drawfilloval (50+y, y + 50, 6, 6, 0) 
end for 
end ball 
ball

i just changed the process ot a procedure cuz i dont know how to use processes lol. but eitherway it moves upwards diagonally. I just made the x and y increase at teh same time.

-----------------------------------
Tony
Tue Dec 24, 2002 3:57 pm


-----------------------------------
well basically you add the counter of the loop to both X and Y of the object. If you want to move it at a diagnal other then 45degree, then you just multiply one of the axis by a decimal, such as

drawfilloval(i, round(i*0.5),5,5,blue)


this will move the ball at 22.5degrees  :wink: 


here's the actual code for moving the ball:


process ball

for i:1..200
     drawfilloval(i,i,5,5,red)
end for

end ball


Edit: well it seems like cutecotton got to post before me... oh well, I showed how to move at angles other then 45  :twisted:

-----------------------------------
cutecotton
Tue Dec 24, 2002 4:43 pm


-----------------------------------
hmm, i know this is kinda off the topic, but it's just q uick question and i didn't watn to make a whoel new thread for it. But can someone explaint o me the difference between procedures and prcoesses and when u'd use one or the other? :oops: lol ^^;;

-----------------------------------
Tony
Tue Dec 24, 2002 6:16 pm


-----------------------------------
procedure is a sub program that can be executed at call
process is a procedure that can be executed parallel to other procedures. So you can have more then 1 thing running at same time. Useful for background music and animation of multiple things separatly
function is a procedure that returns a value

-----------------------------------
cutecotton
Tue Dec 24, 2002 6:20 pm


-----------------------------------
oo i c (tks to tony) so i'd use a process when i have to use a fork, so i can say have bg music and have my program run at teh same time. But processes can't be called at any time? they jsut run in that spot and tha'ts it?

-----------------------------------
Tony
Tue Dec 24, 2002 6:24 pm


-----------------------------------
processes usually run in an endless loop and are called at the beginning of the program just once. Though that depends on the structure of the program. Such as for the background music you'll have


process bMusic
loop
play music here
end loop
end bMusic

fork bMusic %