@@ -37,6 +37,7 @@ namespace microdata {
3737 private nextSceneEnum : CursorSceneEnum
3838 private jacdacSensorSelected : boolean
3939 private tutorialHintIndex : number ;
40+ private userHasPressedABtn : boolean ;
4041
4142 constructor ( app : AppInterface , nextSceneEnum : CursorSceneEnum ) {
4243 super ( app , function ( ) {
@@ -49,6 +50,7 @@ namespace microdata {
4950 this . nextSceneEnum = nextSceneEnum ;
5051 this . jacdacSensorSelected = false ;
5152 this . tutorialHintIndex = 0 ;
53+ this . userHasPressedABtn = false ;
5254 }
5355
5456 /* override */ startup ( ) {
@@ -190,13 +192,25 @@ namespace microdata {
190192 this . navigator . setBtns ( this . btns )
191193 }
192194
193-
194195 private overrideControllerButtonBindings ( ) {
196+ const tutorialTextCountDownTimer = ( ) => {
197+ control . inBackground ( ( ) => {
198+ basic . pause ( 4000 )
199+ this . tutorialHintIndex = 3
200+ basic . pause ( 4000 )
201+ this . tutorialHintIndex = NUMBER_OF_TUTORIAL_HINTS
202+ } )
203+ }
204+
195205 control . onEvent (
196206 ControllerButtonEvent . Pressed ,
197207 controller . right . id ,
198208 ( ) => {
199- if ( this . tutorialHintIndex == 0 )
209+ if ( this . userHasPressedABtn && this . tutorialHintIndex <= 1 ) {
210+ this . tutorialHintIndex = 2
211+ tutorialTextCountDownTimer ( )
212+ }
213+ else if ( this . tutorialHintIndex == 0 )
200214 this . tutorialHintIndex = 1
201215 this . moveCursor ( CursorDir . Right )
202216 }
@@ -205,7 +219,11 @@ namespace microdata {
205219 ControllerButtonEvent . Pressed ,
206220 controller . up . id ,
207221 ( ) => {
208- if ( this . tutorialHintIndex == 0 )
222+ if ( this . userHasPressedABtn && this . tutorialHintIndex <= 1 ) {
223+ this . tutorialHintIndex = 2
224+ tutorialTextCountDownTimer ( )
225+ }
226+ else if ( this . tutorialHintIndex == 0 )
209227 this . tutorialHintIndex = 1
210228 this . moveCursor ( CursorDir . Up )
211229 }
@@ -214,7 +232,11 @@ namespace microdata {
214232 ControllerButtonEvent . Pressed ,
215233 controller . down . id ,
216234 ( ) => {
217- if ( this . tutorialHintIndex == 0 )
235+ if ( this . userHasPressedABtn && this . tutorialHintIndex <= 1 ) {
236+ this . tutorialHintIndex = 2
237+ tutorialTextCountDownTimer ( )
238+ }
239+ else if ( this . tutorialHintIndex == 0 )
218240 this . tutorialHintIndex = 1
219241 this . moveCursor ( CursorDir . Down )
220242 }
@@ -223,31 +245,26 @@ namespace microdata {
223245 ControllerButtonEvent . Pressed ,
224246 controller . left . id ,
225247 ( ) => {
226- if ( this . tutorialHintIndex == 0 )
248+ if ( this . userHasPressedABtn && this . tutorialHintIndex <= 1 ) {
249+ this . tutorialHintIndex = 2
250+ tutorialTextCountDownTimer ( )
251+ }
252+ else if ( this . tutorialHintIndex == 0 )
227253 this . tutorialHintIndex = 1
228254 this . moveCursor ( CursorDir . Left )
229255 }
230256 )
231257
232- const click = ( ) => this . cursor . click ( )
233- const tutorialTextCountDownTimer = ( ) => {
234- control . inBackground ( ( ) => {
235- basic . pause ( 4000 )
236- this . tutorialHintIndex = 3
237- basic . pause ( 4000 )
238- this . tutorialHintIndex = 4
239- } )
240- }
241-
242258 control . onEvent (
243259 ControllerButtonEvent . Pressed ,
244260 controller . A . id ,
245261 ( ) => {
262+ this . userHasPressedABtn = true ;
246263 if ( this . tutorialHintIndex == 1 ) {
247264 this . tutorialHintIndex = 2
248265 tutorialTextCountDownTimer ( )
249266 }
250- click
267+ this . cursor . click ( )
251268 }
252269 )
253270 }
@@ -287,6 +304,7 @@ namespace microdata {
287304 super . draw ( )
288305
289306 if ( TUTORIAL_MODE ) {
307+ basic . showNumber ( this . cursor . navigator . )
290308 const drawTutorialTextBox = ( ) => {
291309 Screen . fillRect (
292310 Screen . LEFT_EDGE ,
0 commit comments