Last active
August 29, 2015 14:24
-
-
Save dgellow/c0d7a1a172ebe6ddbeff to your computer and use it in GitHub Desktop.
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
proc makeJumpPlayerCommand(player: var Player, | |
platform: Platform): Command = | |
var | |
moveActorCommand = makeMoveActorCommand(player, platform.x, | |
platform.y) | |
if not isStrongEnough(player.jumpStrength, platform.altitude): | |
echo("$1 is not strong enough to jump to the platform" % [player.name]) | |
return nil # <== Error: type mismatch: got (nil) but expected 'Command' | |
result.execute = proc = | |
moveActorCommand.execute() | |
result.undo = proc = | |
moveActorCommand.undo() | |
var | |
player = getPlayer() | |
player = getPlatform() | |
command = makeJumpPlayerCommand(player, platform) | |
if command: | |
command.execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment