changeset 47:115695e42307

gamestate incremental progress, but does not compile at the moment. sleep time.
author William Morgan <billjunk@mrgn.org>
date Sun, 27 Jul 2014 02:33:07 -0700
parents d631e68a45d5
children 8b6f6e2cbf38
files code/gameState.lm
diffstat 1 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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 {