fixed problem
This commit is contained in:
parent
733ffe3380
commit
3dcf69715a
|
@ -15,13 +15,13 @@ type Entity struct {
|
|||
}
|
||||
|
||||
// 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{
|
||||
x: x,
|
||||
y: y,
|
||||
rune: r,
|
||||
style: style,
|
||||
name: name,
|
||||
name: name,
|
||||
flags: flags,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,8 @@ type Entity interface {
|
|||
Style() goro.Style
|
||||
SetStyle(goro.Style)
|
||||
Move(int, int)
|
||||
Name() string
|
||||
SetName(string)
|
||||
Flags() uint
|
||||
SetFlags(uint)
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ type GameMap interface {
|
|||
IsOpaque(x, y int) bool
|
||||
Explored(x, y int) bool
|
||||
SetExplored(x, y int, explored bool)
|
||||
MakeMap(maxRooms, roomMinSize, roomMaxSize int, player Entity)
|
||||
MakeMap(maxRooms, roomMinSize, roomMaxSize int, entities *[]Entity, maxMonsters int)
|
||||
}
|
||||
|
|
19
main.go
19
main.go
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"steel/entity"
|
||||
"steel/interfaces"
|
||||
|
@ -76,17 +77,17 @@ func main() {
|
|||
if !gameMap.IsBlocked(x, y) {
|
||||
otherEntity := entity.FindEntityAtLocation(entities, x, y, entity.BlockMovement, entity.BlockMovement)
|
||||
if otherEntity != nil {
|
||||
fmt.Printf("You lick the %s in the shins, much to its enjoyment!\n", otherEntity.Name())
|
||||
} else {
|
||||
player.Move(action.X, action.Y)
|
||||
forRecompute = true
|
||||
fmt.Printf("You lick the %s in the shins, much to its enjoyment!\n", otherEntity.Name())
|
||||
} else {
|
||||
player.Move(action.X, action.Y)
|
||||
fovRecompute = true
|
||||
}
|
||||
}
|
||||
gameState = NPCTurnState
|
||||
}
|
||||
gameState = NPCTurnState
|
||||
case ActionQuit:
|
||||
goro.Quit()
|
||||
}
|
||||
case ActionQuit:
|
||||
goro.Quit()
|
||||
}
|
||||
case goro.EventQuit:
|
||||
return
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ func main() {
|
|||
if gameState == NPCTurnState {
|
||||
for i, e := range entities {
|
||||
if i > 0 {
|
||||
fmt.Printf("The &s punders.\n", e.Name())
|
||||
fmt.Printf("The %s punders.\n", e.Name())
|
||||
}
|
||||
}
|
||||
gameState = PlayerTurnState
|
||||
|
|
Loading…
Reference in New Issue
Block a user