class XORDirector : PlayDirector { @Attribute var wall = "" var mapsCollected = 0 /** When true, we are zoomed "normally" - things are SMALL. When false, we are zoomed in, so that we can't see much of the map. */ var isMapMode = false var toggleMap : Input override fun activated() { super.activated() toggleMap = Game.instance.resources.inputs.find( "toggleMap" ) if ( wall != "" ) { for ( item in mainStage.findRolesByClass( Wall ) ) { item.actor.event( wall ) } } } override fun glassScene() = "xor/glass" override fun layout() { super.layout() // In map mode, so use the "normal" scale, which makes everything tiny, because the poses are TINY. // But in non-map-mode, we zoom in by an addition x2, so that the tiny poses, are now a "reasonable" // size, and we can only see a small part of the scene. if (!isMapMode) { mainView.scaleXY *= 2 extraView.scaleXY *= 2 } } override fun onKey(event : KeyEvent ) { super.onKey( event ) // Change zoom by 2, which means you can see pretty much everything // I call this the "map" mode, and can only be done when 2 map pieces have been // collected. // However, XORPlayer doesn't let you move in map mode, until ALL FOUR map pieces // have been collected. // This is different to the original XOR, which revealed new pieces of the map when // the map objects are picked up. if ( toggleMap.matches( event ) && mapsCollected >= 2 ) { toggleMapMode() } } fun toggleMapMode() { if (isMapMode) { mainView.scaleXY *= 2 } else { mainView.scaleXY /= 2 } extraView.scaleXY = mainView.scaleXY isMapMode = ! isMapMode } }