Computer Science Canada animation question |
Author: | asianrandy [ Wed Jan 07, 2009 1:25 pm ] |
Post subject: | animation question |
how do you make objects go down or up? |
Author: | Laplace's Demon [ Wed Jan 07, 2009 1:37 pm ] |
Post subject: | Re: animation question |
Is your object a sprite? Or is it drawn with something like drawfillbox? |
Author: | asianrandy [ Wed Jan 07, 2009 1:42 pm ] |
Post subject: | RE:animation question |
drawfillbox |
Author: | Laplace's Demon [ Wed Jan 07, 2009 2:03 pm ] |
Post subject: | Re: animation question |
ok, if your using drawfillbox you should do it like this: You need to keep an X and a Y variable for your box, when you draw the box use the X and Y variables. ie: drawfillbox (x, y, x+50, y+50, black) So in your loop, you want to use something to alter the X and Y values, you can do this with a set script, or you can use input such as Input.KeyDown. After you change the X and Y variables you then want to use cls to clear the screen and therefore destroy the old box. After you cls you then want to draw the box again based on the new x and y values. in pseudocode: loop draw the box change x and y values delay cls end loop You can change up the order in which you do things...but that is the bare bones basic way to move an "object". |
Author: | asianrandy [ Wed Jan 07, 2009 7:12 pm ] | ||||
Post subject: | RE:animation question | ||||
There one more question? when the transformer stops moving, i want to move this arm down, then i have to use
|
Author: | Laplace's Demon [ Wed Jan 07, 2009 7:47 pm ] |
Post subject: | Re: animation question |
mm... So at the end of his movement you want him to move his arm? What I would do it move the cls to the bottom of the for loop (after the delay) and I would put it in an if statement so that when i = 50 it doesn't cls anymore, instead it goes into a special procedure which draws a white box over the old arm then draw the new arm. Try that. |
Author: | asianrandy [ Thu Jan 08, 2009 1:46 pm ] |
Post subject: | RE:animation question |
yo i cant make his arm go down |
Author: | asianrandy [ Thu Jan 08, 2009 7:33 pm ] |
Post subject: | RE:animation question |
the code didn't work for moving this arm down, can you put the code for me thanks. |
Author: | Tony [ Thu Jan 08, 2009 7:58 pm ] |
Post subject: | Re: RE:animation question |
asianrandy @ Thu Jan 08, 2009 7:33 pm wrote: can you put the code for me thanks.
No. Things don't work this way. |
Author: | Laplace's Demon [ Thu Jan 08, 2009 8:26 pm ] |
Post subject: | Re: animation question |
Be more specific. What isn't working with the arm moving? Post your code. |
Author: | asianrandy [ Thu Jan 08, 2009 9:13 pm ] | ||
Post subject: | RE:animation question | ||
when the xtransformer done moving, i want his right arm go down.
|
Author: | Laplace's Demon [ Thu Jan 08, 2009 10:11 pm ] |
Post subject: | Re: animation question |
Alright, I just got it working but I'm not gonna post the code. All you need to do it follow the steps I outlined earlier. Move the cls to the bottom of your transformer for loop and put it in an if statement so that it will only cls when i is less than fifty. In that same if statement, once i = 50 draw over the old arm with the background color (black) and then simply draw the new arm. 6 lines of code in my variation for the if statement, cls, box over the old arm, and then drawing of the new arm. Also, for future reference try to be more descriptive with your problems. "how do you make something move" or "I can't change the arm" makes it hard for us to help you. |