Game Development Reference
In-Depth Information
Friction
Friction is the exact opposite of acceleration: it causes the object to gradually slow down. Let's see
how it works with the cat:
1. Select the ?]p symbol in the Library and click the Properties button. Change the Class field to
Player_Friction and click the OK button.
2. Test the project.
3. Move the cat around the screen with the arrow keys. You can move it in delightfully smooth
swoops and arcs, as if it were floating.
The Lh]uan[Bne_pekj class is almost identical to Lh]uan[=__ahan]pekj except for a few small addi-
tions. Double-click it in the Project panel to open it and take a look.
First, is the new variable, [bne_pekj, which is initialized to ,*52:
[rt9,7
[ru9,7
[]__ahan]pekjT9,7
[]__ahan]pekjU9,7
[olaa`Heiep917
[bne_pekj9,*527
A value of - amounts to “no friction,” so anything less than 1 gradually slows the object down. Values
from ,*50 to ,*54 apply friction very gradually, for very fluid movement. Values such as ,*3 or ,*2
slow the object very quickly.
All you need to do now is add the [bne_pekj value to the [rt and [ru properties:
[rt&9[bne_pekj7
[ru&9[bne_pekj7
It multiplies the velocities by a number less than -, which gradually reduces them. It's very simple and
very effective. There's one technical detail you have to fix, however.
Here's the scenario. Imagine that the object's velocity is 1. Its friction is ,*2. The object needs a veloc-
ity of zero to stop completely. You apply some friction every frame, multiplying the velocity by ,*2,
hoping to finally reach zero. Here's what the first five frames might look like.
5 * 0.6 = 3
3 * 0.6 = 1.8
1.8 * 0.6 = 1.08
1.08 * 0.6 = 0.648
0.648 * 0.6 = 0.3888
But you're not at zero yet. How long do you think it will take before you get there? Well, you can keep
going all day—you never will!

Search Nedrilad ::

Custom Search
The passage describes the implementation of friction in a game development context, specifically how it affects the movement of an object (a cat) and the mathematical concept of gradually reducing velocity through multiplication by a friction value.
no_question

the text does not contain any explicit mathematical questions or provide answers to such questions. it explains a concept and provides an example of how friction affects velocity over time, but it does not ask the reader to solve a problem or provide a specific answer.
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
Game Development Reference
In-Depth Information
Friction
Friction is the exact opposite of acceleration: it causes the object to gradually slow down. Let's see
how it works with the cat:
1. Select the ?]p symbol in the Library and click the Properties button. Change the Class field to
Player_Friction and click the OK button.
2. Test the project.
3. Move the cat around the screen with the arrow keys. You can move it in delightfully smooth
swoops and arcs, as if it were floating.
The Lh]uan[Bne_pekj class is almost identical to Lh]uan[=__ahan]pekj except for a few small addi-
tions. Double-click it in the Project panel to open it and take a look.
First, is the new variable, [bne_pekj, which is initialized to ,*52:
[rt9,7
[ru9,7
[]__ahan]pekjT9,7
[]__ahan]pekjU9,7
[olaa`Heiep917
[bne_pekj9,*527
A value of - amounts to “no friction,” so anything less than 1 gradually slows the object down. Values
from ,*50 to ,*54 apply friction very gradually, for very fluid movement. Values such as ,*3 or ,*2
slow the object very quickly.
All you need to do now is add the [bne_pekj value to the [rt and [ru properties:
[rt&9[bne_pekj7
[ru&9[bne_pekj7
It multiplies the velocities by a number less than -, which gradually reduces them. It's very simple and
very effective. There's one technical detail you have to fix, however.
Here's the scenario. Imagine that the object's velocity is 1. Its friction is ,*2. The object needs a veloc-
ity of zero to stop completely. You apply some friction every frame, multiplying the velocity by ,*2,
hoping to finally reach zero. Here's what the first five frames might look like.
5 * 0.6 = 3
3 * 0.6 = 1.8
1.8 * 0.6 = 1.08
1.08 * 0.6 = 0.648
0.648 * 0.6 = 0.3888
But you're not at zero yet. How long do you think it will take before you get there? Well, you can keep
going all day—you never will!

Search Nedrilad ::

Custom Search
user
The passage describes the implementation of friction in a game development context, specifically how it affects the movement of an object (a cat) and the mathematical concept of gradually reducing velocity through multiplication by a friction value.

TYPE: NO_QUESTION

The text does not contain any explicit mathematical questions or provide answers to such questions. It explains a concept and provides an example of how friction affects velocity over time, but it does not ask the reader to solve a problem or provide a specific answer.