fixed problem

This commit is contained in:
Joel M. Southall 2019-07-24 21:04:21 -07:00
parent 733ffe3380
commit 3dcf69715a
4 changed files with 17 additions and 12 deletions

View File

@ -15,7 +15,7 @@ type Entity struct {
} }
// NewEntity returns an interface to a new populated Entity. // NewEntity returns an interface to a new populated Entity.
func NewEntity(x int, y int, r rune, style goro.Style, name string, flags Flags) interfaces.Entity { func NewEntity(x int, y int, r rune, style goro.Style, name string, flags uint) interfaces.Entity {
return &Entity{ return &Entity{
x: x, x: x,
y: y, y: y,

View File

@ -14,4 +14,8 @@ type Entity interface {
Style() goro.Style Style() goro.Style
SetStyle(goro.Style) SetStyle(goro.Style)
Move(int, int) Move(int, int)
Name() string
SetName(string)
Flags() uint
SetFlags(uint)
} }

View File

@ -8,5 +8,5 @@ type GameMap interface {
IsOpaque(x, y int) bool IsOpaque(x, y int) bool
Explored(x, y int) bool Explored(x, y int) bool
SetExplored(x, y int, explored bool) SetExplored(x, y int, explored bool)
MakeMap(maxRooms, roomMinSize, roomMaxSize int, player Entity) MakeMap(maxRooms, roomMinSize, roomMaxSize int, entities *[]Entity, maxMonsters int)
} }

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"log" "log"
"steel/entity" "steel/entity"
"steel/interfaces" "steel/interfaces"
@ -79,7 +80,7 @@ func main() {
fmt.Printf("You lick the %s in the shins, much to its enjoyment!\n", otherEntity.Name()) fmt.Printf("You lick the %s in the shins, much to its enjoyment!\n", otherEntity.Name())
} else { } else {
player.Move(action.X, action.Y) player.Move(action.X, action.Y)
forRecompute = true fovRecompute = true
} }
} }
gameState = NPCTurnState gameState = NPCTurnState
@ -95,7 +96,7 @@ func main() {
if gameState == NPCTurnState { if gameState == NPCTurnState {
for i, e := range entities { for i, e := range entities {
if i > 0 { if i > 0 {
fmt.Printf("The &s punders.\n", e.Name()) fmt.Printf("The %s punders.\n", e.Name())
} }
} }
gameState = PlayerTurnState gameState = PlayerTurnState