Show last authors
1 **In this tutorial you will learn how to program a reaction game for 2 players!**
2
3
4 //Download the tutorial in [[PDF-format >>attach:Tutorial_Reactiongame.pdf]]here!//
5
6
7
8 (% class="row" %)
9 (((
10 (% class="col-xs-12 col-sm-6" %)
11 (((
12 {{box title="**Content**"}}
13 {{toc /}}
14 {{/box}}
15 )))
16
17 (% class="col-xs-12 col-sm-6" %)
18 (((
19 (% class="box" %)
20 (((
21 **The finished game to start playing right away:**
22
23 (% class="wikigeneratedid" %)
24 [[[[image:download.png]]>>https://share.catrob.at/pocketcode/project/59cf34a8-1700-11ec-af47-005056a36f47]]
25 )))
26 )))
27 )))
28
29
30 = Play-Button =
31
32 (% class="row" %)
33 (((
34 (% class="col-xs-12 col-sm-6" %)
35 (((
36 (% class="box" %)
37 (((
38 **1.** Create a new project. First you add a new object (a button or something similar) that starts the game and contains the logic.
39
40 (% style="text-align:center" %)
41 [[image:step_1.PNG||alt="" width="200" height="88"]]
42 )))
43 )))
44
45 (% class="col-xs-12 col-sm-6" %)
46 (((
47 (% class="box" %)
48 (((
49 (% id="HKollisionserkennung" class="wikigeneratedid" %)
50 **2. **Now add the bricks to your script of the play button step by step.Now add the bricks to your script of the play button step by step.
51
52 (% style="text-align:center" %)
53 [[image:image1_2.PNG||height="216" width="300"]]
54 )))
55 )))
56 )))
57
58 (% class="row" %)
59 (((
60 (% class="col-xs-12 col-sm-6" %)
61 (((
62 (% class="box" %)
63 (((
64 **3. **Now you need a loop. The content of this is executed as often, depending on how many rounds you want a game to have. After a random time, the characters should appear.
65
66 (% style="text-align:center" %)
67 [[image:image1_3.PNG||height="162" width="300"]]
68
69 (% style="text-align:center" %)
70 [[image:image1_3tip.PNG||height="103" width="250"]]
71 )))
72 )))
73
74 (% class="col-xs-12 col-sm-6" %)
75 (((
76 (% class="box" %)
77 (((
78 (% id="HKollisionserkennung" class="wikigeneratedid" %)
79 **4. **At the end you have to tell all characters again that the game is over and show the button again to be able to play again.
80
81 (% style="text-align:center" %)
82 [[image:image1_4.PNG||height="99" width="300"]]
83 )))
84 )))
85 )))
86
87 (% class="row" %)
88 (((
89 (% class="col-xs-12 col-sm-6" %)
90 (((
91 (% class="box" %)
92 (((
93 **5. **Now all you have to do is: tell the players who won.
94
95 (% style="text-align:center" %)
96 [[image:image1_5.PNG||height="207" width="300"]]
97 )))
98 )))
99 )))
100
101 = Characters =
102
103 (% class="row" %)
104 (((
105 (% class="col-xs-12 col-sm-6" %)
106 (((
107 (% class="box" %)
108 (((
109 **1.** Now only the characters that should be clicked on when they appear are missing. Don't forget that you need two pieces - one for each Player! Place them so that they appear right to the players when they are seated across from each other.
110
111 (% style="text-align:center" %)
112 [[image:image2_1.PNG||height="233" width="300"]]
113 )))
114 )))
115
116 (% class="col-xs-12 col-sm-6" %)
117 (((
118 (% class="box" %)
119 (((
120 (% class="wikigeneratedid" id="HKollisionserkennung" %)
121 **2.  **Now add the bricks to your script of the characters step by step. //Don't forget that the characters shouldn't be visible at the beginning!//
122
123 (% style="text-align:center" %)
124 [[image:image2_2.PNG||height="197" width="300"]]
125 )))
126 )))
127 )))
128
129 (% class="row" %)
130 (((
131 (% class="col-xs-12 col-sm-6" %)
132 (((
133 (% class="box" %)
134 (((
135 **3. **Now you only have to count the points when the character is clicked and then hide them, that the player is not to able to collect more points.
136
137 (% style="text-align:center" %)
138 [[image:image2_3.PNG||height="161" width="300"]]
139 )))
140 )))
141
142 (% class="col-xs-12 col-sm-6" %)
143 (((
144 (% class="box" %)
145 (((
146 (% class="wikigeneratedid" id="HKollisionserkennung" %)
147 **4. **That's it. Try your game right now!
148 )))
149
150 (% class="box infomessage" %)
151 **TIPP:**
152 If you want to improve your game even more, try the expansions right away.
153 )))
154 )))
155
156 = Extension 1 - Won! =
157
158 (% class="row" %)
159 (((
160 (% class="col-xs-12 col-sm-6" %)
161 (((
162 (% class="box" %)
163 (((
164 **1.** How about a nicer message for the player who won?
165
166 To do this, add two objects with your desired message. Again, pay attention to the alignment.
167
168 (% style="text-align:center" %)
169 [[image:image3_1.PNG||alt="erweiterung1_step_1.PNG" height="105" width="250"]]
170 )))
171 )))
172
173 (% class="col-xs-12 col-sm-6" %)
174 (((
175 (% class="box" %)
176 (((
177 (% class="wikigeneratedid" id="HKollisionserkennung" %)
178 **2.  **Now add the bricks to your script of the messages step by step. //Do not forget that the message should not be visible at the beginning!//
179
180 (% style="text-align:center" %)
181 [[image:image3_2.PNG||alt="erweiterung1_step_2.PNG" height="210" width="300"]]
182 )))
183 )))
184 )))
185
186 (% class="row" %)
187 (((
188 (% class="col-xs-12 col-sm-6" %)
189 (((
190 (% class="box" %)
191 (((
192 **3. **When the game starts (“When you receive: Game starts”) the messages should disappear again (“Hide”).
193 )))
194 )))
195 )))
196
197 = Extension 2 - Score =
198
199 (% class="row" %)
200 (((
201 (% class="col-xs-12 col-sm-6" %)
202 (((
203 (% class="box" %)
204 (((
205 **1.** Would you also like to keep track of the points during the game?
206
207 To do this, add two objects with your wish symbol again. Again, pay attention to the alignment.
208
209 (% style="text-align:center" %)
210 [[image:image4_1.PNG||alt="erweiterung2_step_1.PNG" height="108" width="250"]]
211 )))
212 )))
213
214 (% class="col-xs-12 col-sm-6" %)
215 (((
216 (% class="box" %)
217 (((
218 (% class="wikigeneratedid" id="HKollisionserkennung" %)
219 **2.  **Now add the bricks to your script of the score counters step by step.// Do not forget that the points should not be visible at the beginning!//
220
221 (% style="text-align:center" %)
222 [[image:image4_2.PNG||alt="erweiterung2_step_2.PNG" height="160" width="300"]]
223 )))
224 )))
225 )))
226
227 (% class="row" %)
228 (((
229 (% class="col-xs-12 col-sm-6" %)
230 (((
231 (% class="box" %)
232 (((
233 **3. **When the game ends, the points and the variable should disappear again.
234
235 (% style="text-align:center" %)
236 [[image:image4_3.PNG||alt="erweiterung2_step_3.PNG" height="122" width="300"]]
237 )))
238 )))
239 )))
240
241 = Extension 3 - Now it's getting difficult =
242
243 (% class="row" %)
244 (((
245 (% class="col-xs-12 col-sm-6" %)
246 (((
247 (% class="box" %)
248 (((
249 **1.**  How about to make the game a little more difficult? For example: charaters should not always appearing in the same position?
250
251 To do this, you have to change the script of the characters. First, take a look at where your figure is placed.
252
253 (% style="text-align:center" %)
254 [[image:image5_1.PNG||alt="erweiterung3_step_1.PNG" height="151" width="300"]]
255 )))
256 )))
257
258 (% class="col-xs-12 col-sm-6" %)
259 (((
260 (% class="box" %)
261 (((
262 (% class="wikigeneratedid" id="HKollisionserkennung" %)
263 **2. **Now think about the positions in which your character should appear. For example, if you only want it to jump between left and right, you always have to keep the y position the same.
264 )))
265 )))
266 )))
267
268 (% class="row" %)
269 (((
270 (% class="col-xs-12 col-sm-6" %)
271 (((
272 (% class="box" %)
273 (((
274 **3. **Every time the character now receives that it should show itself, a new position must be calculated.
275
276 (% style="text-align:center" %)
277 [[image:image5_3.PNG||alt="erweiterung3_step_3.PNG" height="163" width="300"]]
278
279 (% style="text-align:center" %)
280 [[image:image5_3tip.PNG||alt="erweiterung3_step_3_tipp.PNG" height="85" width="250"]]
281 )))
282 )))
283
284 (% class="col-xs-12 col-sm-6" %)
285 (((
286 (% class="box" %)
287 (((
288 (% class="wikigeneratedid" id="HKollisionserkennung" %)
289 **4. **If the figure should always be of different sizes, you now have to change the size every time the figure is displayed.
290
291 There is also the brick "Set size to":
292
293 (% style="text-align:center" %)
294 [[image:image5_4.PNG||alt="erweiterung3_step_4.PNG" height="94" width="300"]]
295 )))
296 )))
297 )))
298
299 (% class="row" %)
300 (((
301 (% class="col-xs-12 col-sm-6" %)
302 (((
303 (% class="box" %)
304 (((
305 **5. **Your finished script for displaying the characters could now look like this.
306
307 (% style="text-align:center" %)
308 [[image:image5_5.PNG||alt="erweiterung3_step_5.PNG" height="222" width="300"]]
309 )))
310 )))
311 )))
312
313 Now try to expand your game yourself.