Created
October 9, 2016 20:26
-
-
Save imbradmiller/ca1f038d292643fc17940bff9451b28b to your computer and use it in GitHub Desktop.
Portal On and Off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gemCon = 0 | |
var swCon = 0 | |
func portalCheck() { | |
if gemCon == 0 { | |
purplePortal.isActive = false | |
} else if gemCon == 4 { | |
purplePortal.isActive = true | |
} | |
if swCon == 1 { | |
purplePortal.isActive = false | |
} | |
} | |
while gemCon < 7 || swCon < 1 { | |
moveForward() | |
portalCheck() | |
if isOnGem { | |
collectGem() | |
gemCon = gemCon + 1 | |
} else if isOnClosedSwitch { | |
toggleSwitch() | |
swCon = swCon + 1 | |
} | |
if isBlocked { | |
turnLeft() | |
turnLeft() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment