@@ -415,6 +415,15 @@ function wipe_save () {
415415 }
416416 set_default_save ( )
417417}
418+ function overlapped_sprites ( sprite : Sprite , kind : number ) {
419+ local_overlapping_sprites = [ ]
420+ for ( let value of sprites . allOfKind ( kind ) ) {
421+ if ( sprite . overlapsWith ( value ) ) {
422+ local_overlapping_sprites . push ( value )
423+ }
424+ }
425+ return local_overlapping_sprites
426+ }
418427function computer_click ( ) {
419428 hash_count_per_sec += 1
420429 sprites . setDataNumber ( sprite_computer , "next_number" , randint ( 0 , max_height ) )
@@ -528,6 +537,7 @@ let local_upgrade_got: blockObject.BlockObject = null
528537let local_upgrades_shown = 0
529538let local_available_upgrades : blockObject . BlockObject [ ] = [ ]
530539let local_previous_magic_number = 0
540+ let local_overlapping_sprites : Sprite [ ] = [ ]
531541let selected = false
532542let all_upgrades : blockObject . BlockObject [ ] = [ ]
533543let local_requirements_obj : blockObject . BlockObject = null
@@ -584,13 +594,24 @@ game.onUpdate(function () {
584594 if ( controller . A . isPressed ( ) ) {
585595 sprite_cursor . image . replace ( 1 , 8 )
586596 sprite_cursor . image . replace ( 9 , 8 )
597+ for ( let value of overlapped_sprites ( sprite_cursor_pointer , SpriteKind . Shop ) ) {
598+ value . image . replace ( 9 , 8 )
599+ }
587600 } else if ( sprite_overlapping_kind ( sprite_cursor_pointer , SpriteKind . Thing ) || sprite_overlapping_kind ( sprite_cursor_pointer , SpriteKind . Shop ) ) {
588601 sprite_cursor . image . replace ( 1 , 9 )
589602 sprite_cursor . image . replace ( 8 , 9 )
590603 } else {
591604 sprite_cursor . image . replace ( 9 , 1 )
592605 sprite_cursor . image . replace ( 8 , 1 )
593606 }
607+ for ( let value of sprites . allOfKind ( SpriteKind . Shop ) ) {
608+ if ( sprite_cursor_pointer . overlapsWith ( value ) ) {
609+ value . image . replace ( 1 , 9 )
610+ } else {
611+ value . image . replace ( 8 , 9 )
612+ value . image . replace ( 9 , 1 )
613+ }
614+ }
594615} )
595616game . onUpdateInterval ( 1000 , function ( ) {
596617 hash_per_sec = hash_count_per_sec
0 commit comments