Computer Science Canada

Animation

Author:  cycro1234 [ Mon Oct 25, 2004 3:20 pm ]
Post subject:  Animation

I'm starting a major project in Turing and i need some help. Is it possible draw something, like something made up of various colours, lines, shapes, and animations, group it all together and then move it as a whole thing rather than individualy? I've tried messing around with drawpic, but it doesn't seem to be working. Any ideas? Thx in advance.

Author:  AsianSensation [ Mon Oct 25, 2004 3:44 pm ]
Post subject: 

sure, you could, use procedures, it's pretty easy to understand.

Example:

draw a stick man, and instead of the standard

code:
drawoval (50, 50, 10, 10, red)

for it's head, do something like this:
code:
drawoval (x, y, 10, 10, clr)

where x, y are integers.

Stick bunch of these draw commands into one procedure, ( I suggest you read up on procedures first, there is an excellent tutorial in the tutorial section) and have x, y as the parameters of the procedure. Then in a loop, just change the parameters.

Author:  Mazer [ Mon Oct 25, 2004 3:45 pm ]
Post subject: 

Yes.
A good idea is to give every object a set of x,y coordinates and then draw everything on the object with respect to that point.

ie
code:

%instead of
drawfillbox (5, 5, 20, 20, 12) % this stays in the same spot until you change those numbers

%try this
drawfillbox (x - 10, y - 10, x + 10, y + 10, 12) % this draws a box with side length of 20 which happens to be centered on (x, y)


Imagine a scene with a rocket flying around a smiley face. It would be easier to specify a the draw coordinates with respect to some point on the rocket (the middle, for example) and then go through a loop changing the value of the x and y.

I'm almost certain that there is a tutorial on animation though.

EDIT: Hmm... Asian posted less than a minute before me precious time wasted that he could have been using to build my DDR pad. tsk.

Author:  cycro1234 [ Mon Oct 25, 2004 3:46 pm ]
Post subject: 

Aight, thx!

Author:  cycro1234 [ Mon Oct 25, 2004 4:15 pm ]
Post subject: 

Wait, one more quick question. Let's say I procedured a stick guy walking on one spot, basically his feet are moving. How would i call upon that procedure but in a different location, that I set to outside the walking guy loop??


: