---
HERE IS A MORE SIMPLE CODE FOR THIS SAME GAME:
http://gamemakersgarage.com/forum/index.php?topic=1802.0I will make edits and new posts as I Progress.
Here is What I have so far:
You will need to import your own sounds and name them the same name thats in the code.
OPEN GAME:
DIM world(90000)
LOOPSOUND "music"
FOR a = 1 to 9000
LET RND = RANDOM(5)
LET world(a) = RND
NEXT
LET world(56) = 1
LET world(75) = 1
LET screenPos = 0
LET screenPosYUp = 5
LET screenPosYDown = 0
LET screenPosXRight = 0
LET screenPosXLeft = 5
LET playerPos = 55
LET playerLifeMax = 70
LET playerLife = playerLifeMax
LET headEquiped$ = "Leather Cap"
LET headValue = 1
LET bodyEquiped$ = "Cloth Shirt"
LET bodyValue = 2
LET weaponEquiped$ = "Stone Knife"
LET playerAttack = 5
LET info$ = "press spacebar, type help, then press enter"
LET spawn = 0
OPEN CARD:
DIM tile$(9000)
DIM square(9000)
IF dead = 0 THEN
FOR a = 1 to 9000
LET view = screenPos + a
IF world(view) = 1 THEN
LET tile$(a) = "."
END IF
IF world(view) = 2 THEN
LET tile$(a) = "."
END IF
IF world(view) = 3 THEN
LET tile$(a) = "."
END IF
IF world(view) = 4 THEN
LET tile$(a) = "."
END IF
IF world(view) = 5 THEN
LET tile$(a) = "T"
END IF
NEXT
LET tile$(playerPos) = "P"
// MONSTER ENCOUNTER
IF monActive = 0 THEN
LET encounter = RANDOM(7)
IF encounter = 1 THEN
LET monActive = 1
LET spawn = 0
END IF
END IF
IF spawn = 0 THEN
LET monKill = 0
PLAYSOUND "spawn"
LET monName$ = "Goblin"
LET mLife = 10
LET mAttack = 5
LET screenPosM1YUp = 5
LET screenPosM1YDown = 0
LET screenPosM1YRight = 5
LET screenPosM1YLeft = 5
LET spawn = 1
LET monsterChar$ = "g"
LET tile$(15) = monsterChar$
LET monster1Pos = 15
END IF
// Mon Move
IF mLife > 0 THEN
LET RND = RANDOM(4)
IF RND = 1 THEN
IF screenPosM1YUp < 5 THEN
LET mWalkFromNorth = monster1Pos - 20
IF tile$(mWalkFromNorth) = "." THEN
LET screenPosM1YUp = screenPosM1YUp + 1
LET screenPosM1YDown = screenPosM1YDown - 1
LET monster1Pos = monster1Pos - 20
END IF
END IF
END IF
IF RND = 2 THEN
IF screenPosM1YDown < 5 THEN
LET mWalkFromSouth = monster1Pos + 20
IF tile$(mWalkFromSouth) = "." THEN
LET screenPosM1YUp = screenPosM1YUp - 1
LET screenPosM1YDown = screenPosM1YDown + 1
LET monster1Pos = monster1Pos + 20
END IF
END IF
END IF
IF RND = 3 THEN
IF screenPosM1YRight < 5 THEN
LET mWalkFromWest = monster1Pos + 1
IF tile$(mWalkFromWest) = "." THEN
LET screenPosM1YRight = screenPosM1YRight + 1
LET screenPosM1YLeft = screenPosM1YLeft - 1
LET monster1Pos = monster1Pos + 1
END IF
END IF
END IF
IF RND = 4 THEN
IF screenPosM1YLeft < 5 THEN
LET mWalkFromEast = monster1Pos - 1
IF tile$(mWalkFromEast) = "." THEN
LET screenPosM1YRight = screenPosM1YRight - 1
LET screenPosM1YLeft = screenPosM1YLeft + 1
LET monster1Pos = monster1Pos - 1
END IF
END IF
END IF
LET tile$(monster1Pos) = monsterChar$
// MONSTER ATTACK
LET mAttackFromNorth = monster1Pos + 20
IF mAttackFromNorth = playerPos THEN
LET monsterAttackedTrue = 1
END IF
LET mAttackFromSouth = monster1Pos - 20
IF mAttackFromSouth = playerPos THEN
LET monsterAttackedTrue = 1
END IF
LET mAttackFromWest= monster1Pos + 1
IF mAttackFromWest = playerPos THEN
LET monsterAttackedTrue = 1
END IF
LET mAttackFromEast= monster1Pos - 1
IF mAttackFromEast = playerPos THEN
LET monsterAttackedTrue = 1
END IF
IF monsterAttackedTrue = 1 THEN
LET monsterAttackedTrue = 0
LET mAttackModA = mAttack - headValue
LET mAttackModB = mAttackModA - bodyValue
LET playerLife = playerLife - mAttackModB
LET mLife = mLife - playerAttack
PLAYSOUND "damage"
LET message1$ = "The " + monName$ + " attacked you!"
LET message2$ = "You attacked the " + monName$ + "!"
END IF
END IF
IF monKill = 0 THEN
IF mLife < 1 THEN
LET monKill = 1
PLAYSOUND "kill"
LET message1$ = "You killed the " + monName$ + "!"
LET message2$ = " "
LET monActive = 0
END IF
END IF
// MAP
FOR numVar = 1 to 100
LET square(numVar) = numVar
NEXT
LET countNum = 0
LET row = 0
SETFIELDFONT "courier"
SETFIELDSIZE 12
FOR a = 1 to 5
LET row = row + 10
FOR b = 1 to 1
LET countNum = countNum + 1
LET t1 = countNum + row
LET countNum = countNum + 1
LET t2 = countNum + row
LET countNum = countNum + 1
LET t3 = countNum + row
LET countNum = countNum + 1
LET t4 = countNum + row
LET countNum = countNum + 1
LET t5 = countNum + row
LET countNum = countNum + 1
LET t6 = countNum + row
LET countNum = countNum + 1
LET t7 = countNum + row
LET countNum = countNum + 1
LET t8 = countNum + row
LET countNum = countNum + 1
LET t9 = countNum + row
LET countNum = countNum + 1
LET t10 = countNum + row
PRINT tile$(square(t1)) + tile$(square(t2)) + tile$(square(t3)) + tile$(square(t4)) + tile$(square(t5)) + tile$(square(t6)) + tile$(square(t7)) + tile$(square(t8)) + tile$(square(t9)) + tile$(square(t10))
NEXT
NEXT
// INFO
PRINT "Life " + STR$(playerLife) + " / " + STR$(playerLifeMax)
PRINT "Head / " + headEquiped$ + " " + STR$(headValue)
PRINT "Body / " + bodyEquiped$ + " " + STR$(bodyValue)
PRINT "Accessory / " + acessoryEquiped$ + " " + STR$(accessoryValue)
PRINT "Weapon / " + weaponEquiped$ + " " + STR$(playerAttack)
IF playerLife < 1 THEN
LET playerLife = 0
PRINT "Your soul was lost..."
PLAYSOUND "death"
LET dead = 1
END IF
END IF
KEYDOWN:
IF dead = 0 THEN
LET message1$ = " "
LET message2$ = " "
IF screenPosYUp < 5 THEN
LET checkWallUp = playerPos - 20
IF tile$(checkWallUp) = "." THEN
IF UPKEY = TRUE THEN
IF playerScrollPosUp = 1 THEN
LET screenPos = screenPos - 20
LET screenPosYUp = screenPosYUp + 1
LET screenPosYDown = screenPosYDown - 1
LET info$ = "Walked North"
PLAYSOUND "walk"
GOTOCARD 1
ELSE
LET playerScrollPosUp = playerScrollPosUp + 1
LET playerScrollPosDown = playerScrollPosDown - 1
LET playerPos = playerPos - 20
LET info$ = "Walked North"
PLAYSOUND "walk"
GOTOCARD 1
END IF
END IF
END IF
ELSE
LET info$ = "Reached Edge of Land"
END IF
IF screenPosYDown < 100 THEN
LET checkWallDown = playerPos + 20
IF tile$(checkWallDown) = "." THEN
IF DOWNKEY = TRUE THEN
IF playerScrollPosDown = 1 THEN
LET screenPos = screenPos + 20
LET screenPosYUp = screenPosYUp - 1
LET screenPosYDown = screenPosYDown + 1
LET info$ = "Walked South"
PLAYSOUND "walk"
GOTOCARD 1
ELSE
LET playerScrollPosUp = playerScrollPosUp - 1
LET playerScrollPosDown = playerScrollPosDown + 1
LET playerPos = playerPos + 20
LET info$ = "Walked South"
PLAYSOUND "walk"
GOTOCARD 1
END IF
END IF
END IF
ELSE
LET info$ = "Reached Edge of Land"
END IF
IF screenPosXRight < 100 THEN
LET checkWallRight = playerPos + 1
IF tile$(checkWallRight) = "." THEN
IF RIGHTKEY = TRUE THEN
IF playerScrollPosRight = 1 THEN
LET screenPos = screenPos + 1
LET screenPosXRight = screenPosXRight + 1
LET screenPosXLeft = screenPosXLeft - 1
LET info$ = "Walked East"
PLAYSOUND "walk"
GOTOCARD 1
ELSE
LET playerScrollPosRight = playerScrollPosRight + 1
LET playerScrollPosLeft = playerScrollPosLeft - 1
LET playerPos = playerPos + 1
LET info$ = "Walked East"
PLAYSOUND "walk"
GOTOCARD 1
END IF
END IF
END IF
ELSE
LET info$ = "Reached Edge of Land"
END IF
IF screenPosXLeft < 5 THEN
LET checkWallLeft = playerPos - 1
IF tile$(checkWallLeft) = "." THEN
IF LEFTKEY = TRUE THEN
IF playerScrollPosLeft = 1 THEN
LET screenPos = screenPos - 1
LET screenPosXRight = screenPosXRight - 1
LET screenPosXLeft = screenPosXLeft + 1
LET info$ = "Walked West"
PLAYSOUND "walk"
GOTOCARD 1
ELSE
LET playerScrollPosRight = playerScrollPosRight - 1
LET playerScrollPosLeft = playerScrollPosLeft + 1
LET playerPos = playerPos - 1
LET info$ = "Walked West"
PLAYSOUND "walk"
GOTOCARD 1
END IF
END IF
END IF
ELSE
LET info$ = "Reached Edge of Land"
END IF
IF SPACEBARKEY = TRUE THEN
INPUT
END IF
END IF
INPUT:
GOTOCARD 1
IF INPUT$ = "help" THEN
PRINT "view skills, use skills search, view items, use items, equip"
END IF
PAINT:
SETPENCOLOR 0, 0, 0
DRAWSTRING info$, 20, 20, "Courier", 10
SETPENCOLOR 0, 0, 0
DRAWSTRING message1$, 20, 40, "Courier", 10
SETPENCOLOR 0, 0, 0
DRAWSTRING message2$, 20, 60, "Courier", 10