Login

Fancade Wiki

Updated How to make a car.md (markdown)

... ...
@@ -138,15 +138,15 @@ Let's reconfigure the script:
138 138
[[/uploads/tutorial-car-22.jpg]]
139 139
[[/uploads/tutorial-car-23.gif]]
140 140
141
We can now speed up and slow down at will. However, we cannot turn yet.
141
We can now speed up and slow down at will! However, we cannot turn yet.
142 142
143 143
Going back to the script, we can use the Angular Limit block to set the turning angle of our wheels. As a test, I set the turning angle to a constant 45 degrees.
144 144
145
[image of turning logic]
145
[[/uploads/tutorial-car-24.jpg]]
146 146
147 147
Hurray for turning wheels!
148 148
149
[image of all turning wheels]
149
[[/uploads/tutorial-car-25.jpg]]
150 150
151 151
All the wheels are turning at once, but we only want the front wheels to turn. How do we fix this?
152 152
... ...
@@ -154,11 +154,11 @@ Looking at our list of wheels, we set both of the front wheels to be at index 0
154 154
155 155
So, a simple fix would be to check if the current wheel number is less than 2!
156 156
157
[image of turning logic fix]
157
[[/uploads/tutorial-car-26.jpg]]
158 158
159 159
Yes! Not only are the front wheels turning, but the car is turning as well!
160 160
161
[car-turning-controlled.gif]
161
[[/uploads/tutorial-car-27.gif]]
162 162
163 163
The car is so excited that it cannot stop turning. Fun, but also dangerous! So, in the following section, I will show you how to set up button controls for the car.
164 164
... ...
@@ -168,36 +168,38 @@ For our car controls, we will be using the Virtual Gamepad script by Martin Magn
168 168
169 169
You can find it in the Blocks section on the Edit tab.
170 170
171
[image]
171
[[/uploads/tutorial-car-28.jpg]]
172 172
173 173
Tap the game cover, and tap edit. This will create a local copy of the game and put it in your projects.
174 174
175
[image]
175
[[/uploads/tutorial-car-29.jpg]]
176 176
177 177
Back in edit mode, open the inventory and scroll all the way down to the bottom. The virtual gamepad folder should appear at the very bottom.
178 178
179
[image]
179
[[/uploads/tutorial-car-30.jpg]]
180 180
181 181
As you can see, there are several different gamepad scripts. We will be using the 4-button gamepad script for our car.
182 182
183
[image]
184
[image]
183
[[/uploads/tutorial-car-31.jpg]]
184
[[/uploads/tutorial-car-32.jpg]]
185 185
186 186
We will put the gamepad script near the top of our car script. Then, we will assign red variables to each of the 4 outputs. These outputs correspond to the 4 buttons that will appear on your screen when in play mode. The output will be true when the corresponding button is pressed.
187 187
188
[[/uploads/tutorial-car-33.jpg]]
189
188 190
Now, you can use these 4 variables to configure the car controls!
189 191
190 192
If up is being pressed, we want to go forwards, and backwards when down is pressed.
191 193
If left is pressed we want to turn left, and if right is pressed we want to turn right.
192 194
193
[image]
195
[[/uploads/tutorial-car-34.jpg]]
194 196
195 197
And you are done! You can now drive your car around the level with button controls!
196 198
197
[car.gif]
199
[[/uploads/car-final.gif]]
198 200
199 201
Here is an image of the whole script:
200 202
201
[image]
203
[[/uploads/Screenshot_20210422-104017_6c69499164362a0dbe2f1dfe7c62199a.jpg]]
202 204
203 205
Have fun, and good luck with setting up your car! :)
... ...
\ No newline at end of file
Fancade Wiki