# HG changeset patch # User William Morgan # Date 1406453587 25200 # Node ID 115695e42307c9fbafc32142de3acfb495034f43 # Parent d631e68a45d58715f08c7819778fa1b61d5a0858 gamestate incremental progress, but does not compile at the moment. sleep time. diff -r d631e68a45d5 -r 115695e42307 code/gameState.lm --- a/code/gameState.lm Sun Jul 27 01:36:39 2014 -0700 +++ b/code/gameState.lm Sun Jul 27 02:33:07 2014 -0700 @@ -36,6 +36,7 @@ makeTicker <- :mapWidth mapHeight { lives <- 3 + lambdamanPos <- #[5 5] win <- 0 pillCount <- 50 @@ -55,23 +56,37 @@ #[addEvents gameState] } - /* - fruitStateEvent - fruit1Appears <- makeEventType: (127 * 200) 0 :gameState { - // set fruit state to on - } - fruit2Appears <- (127 * 400) - fruit1Expires <- (127 * 280) - fruit2Expires <- (127 * 280) + isFood <- :tile {(2 <= tile) and (tile <= 4)} + getLambdaManChoice <- :{0} + moveLambdaMan <- makeEventType: 127 1 :tick gameState { + move <- getLambdaManChoice: + newPos <- (calcPos: move lambdamanPos) + impending <- grid: grid get: newPos + if: (not: (impending = 0)) { + lambdamanPos <- impending + } else { } - getLambdaManChoice <- :{0} - moveLambdaMan <- makeEventType: 127 0 : tick { - move <- getLambdaManChoice: - if: move + if: (impending isFood) { + #[(moveLambdaMan: (tick + 10)) gameState] + } else { + #[(moveLambdaMan: tick) gameState] + } } - (eating, lamdamanId) - moveGhost <- (ghostType, ghostId) - frightModeDeactivate <- (127 * 20) + + /* + fruit <- 0 + fruit1Appears <- makeEventType: (127 * 200) 0 :gameState { + fruit <- 80 + #[fruit1Expires gameState] + } + fruit2Appears <- (127 * 400) 0 + fruit1Expires <- (127 * 280) 0 + fruit2Expires <- (127 * 480) 0 + moveGhost0 <- 1 //(ghostType, ghostId)!? + moveGhost1 <- 1 //(ghostType, ghostId)!? + moveGhost2 <- 1 //(ghostType, ghostId)!? + moveGhost3 <- 1 //(ghostType, ghostId)!? + frightModeDeactivate <- (127 * 20) 0 */ executeEvents <- :tick isMove events gameState {