Commit 560e9b35 authored by owlo's avatar owlo

you can walk into walls!

parent ed287270
No preview for this file type
......@@ -627,65 +627,96 @@ func main() {
case "east":
for i := range room {
if room[i].Label == "player" {
room[i+1].Label = "player"
room[i].Label = ""
break
if room[i+1].Label != "X" {
room[i+1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "west":
for i := range room {
if room[i].Label == "player" {
room[i-1].Label = "player"
room[i].Label = ""
break
if room[i-1].Label != "X" {
room[i-1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "north":
for i := range room {
if room[i].Label == "player" {
room[i-xvar].Label = "player"
room[i].Label = ""
break
if room[i-xvar].Label != "X" {
room[i-xvar].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "south":
for i := range room {
if room[i].Label == "player" {
room[i+xvar].Label = "player"
room[i].Label = ""
break
if room[i+xvar].Label != "X" {
room[i+xvar].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "northeast":
for i := range room {
if room[i].Label == "player" {
room[i-xvar+1].Label = "player"
room[i].Label = ""
break
if room[i-xvar+1].Label != "X" {
room[i-xvar+1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "northwest":
for i := range room {
if room[i].Label == "player" {
room[i-xvar-1].Label = "player"
room[i].Label = ""
break
if room[i-xvar-1].Label != "X" {
room[i-xvar-1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "southeast":
for i := range room {
if room[i].Label == "player" {
room[i+xvar+1].Label = "player"
room[i].Label = ""
break
if room[i+xvar+1].Label != "X" {
room[i+xvar+1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
case "southwest":
for i := range room {
if room[i].Label == "player" {
room[i+xvar-1].Label = "player"
room[i].Label = ""
break
if room[i+xvar-1].Label != "X" {
room[i+xvar-1].Label = "player"
room[i].Label = ""
break
}
fmt.Printf("You cannot go that way!")
}
}
}
......@@ -698,18 +729,22 @@ func main() {
}
if room[x].X > 3 && room[x].Y == 7 && room[x].X < 14 && done == false {
space += " "
room[x].Label = " "
done = true
}
if room[x].X > 3 && room[x].Y == 8 && room[x].X < 14 && done == false {
space += " "
room[x].Label = " "
done = true
}
if room[x].X > 3 && room[x].Y == 6 && room[x].X < 14 && done == false {
space += " "
done = true
room[x].Label = " "
}
if done == false {
space += "X"
room[x].Label = "X"
}
}
w.Write([]byte(space))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment