Computer Science Canada Car animtaion help |
Author: | mafia101 [ Sat Jan 16, 2010 9:54 am ] | ||
Post subject: | Car animtaion help | ||
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> What is the problem you are having? <Answer Here> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> |
Author: | ProgrammingFun [ Sat Jan 16, 2010 9:57 am ] |
Post subject: | RE:Car animtaion help |
It would be nice if you specified what your problem is, your version of turing, and what you have tried to solve this problem |
Author: | TerranceN [ Sat Jan 16, 2010 10:50 am ] | ||||||||
Post subject: | Re: Car animtaion help | ||||||||
In order for there to be animation, you need change where the car is drawn every frame. Here is part of a tutorial I did for another forum, it teaches basic animation. Animation Animation is simply the illusion that something is moving. It is created by showing many frames with small differences very fast. It can be done by using a loop, variables for the changes every frame, and redrawing the frame every loop. For example we can make a simple animation by using a loop and a variable for the x position of a oval:
There are a few problems with this. First, it is going too fast. We can fix this by using the Time.Delay(millisecs : int) function. This delays however many milliseconds you enter into it. Our Code becomes:
But there is one last problem that you may have noticed. When the oval moves, it randomly flashes. This is because of the split second after we clear the screen, the oval is not there. We can fix this by using a backbuffer. This is the idea that instead of drawing to the screen, we draw to a 'fake' screen represented by memory in RAM, and just switch the two screens, to avoid seeing a blank screen. In Turing we have to use the function View.Set(flags : string) putting in text to specify the drawing options(one of them being to use a backbuffer). There are a few options but the most common are:
All of these are separated by commas, so using all four would look like this:
In order to use a backbuffer there is one more command, View.Update(), that flips the two screens, that should be called at the end of drawing each frame, giving us this:
I hope that helps. |
Author: | mafia101 [ Sat Jan 16, 2010 8:49 pm ] | ||
Post subject: | Re: Car animtaion help | ||
mafia101 @ Sat Jan 16, 2010 9:54 am wrote: What is it you are trying to achieve?
I need help making the car look like it is driving on the road, the car is the box. What is the problem you are having? I don't know how to make it look animated Describe what you have tried to solve this problem I tried making multiple boxes but it didn't work Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> |