Skip to content

Commit

Permalink
textbox, dobjects, more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aerth committed Jun 27, 2017
1 parent 86749fb commit b74c50b
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 96 deletions.
86 changes: 43 additions & 43 deletions assets/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified assets/sprites/loot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions character.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var DefaultStats = Stats{

// DefaultPhys character
var DefaultPhys = charPhys{
RunSpeed: 50.5,
RunSpeed: 60.5,
Rect: pixel.R(-8, -8, 8, 8),
Gravity: 50.00,
Rate: 2,
Expand Down Expand Up @@ -265,9 +265,9 @@ func (c *Character) MaxHealth() uint64 {
return uint64(c.Health * c.Level)
}

func (c *Character) PickUp(items []Item) {
func (c *Character) PickUp(items []Item) string {

c.Inventory = StackItems(c.Inventory, items)
log.Println("PICKED UP OBJECT")
return fmt.Sprint(items)

}
27 changes: 16 additions & 11 deletions cmd/mapgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var numbers = "0123456789"

func init() {
rand.Seed(time.Now().UnixNano())
// seed or random
if len(os.Args) == 2 {
hashb := md5.Sum([]byte(os.Args[1]))
hash := []byte(fmt.Sprintf("%x", hashb))
Expand All @@ -44,11 +45,16 @@ func init() {
log.Printf("Using world seed: %q -> %v", os.Args[1], worldseed)
log.Printf("Hash: %q", string(hash))
}

// create maps dir if not exist
os.Mkdir("maps", 0755)
}

func main() {
os.Mkdir("maps", 0755)
olist := GenerateMap()
SaveMap(olist)
}

func GenerateMap() []rpg.Object {
var olist []rpg.Object
t := rpg.O_TILE
for i := 0; i < 100; i++ {
Expand All @@ -73,17 +79,11 @@ func main() {
}

}
/*
// fill in with water blocks
waterworld := rpg.DrawPatternObject(53, rpg.O_BLOCK, pixel.R(-BOUNDS, -BOUNDS, BOUNDS, BOUNDS), 0)
for _, water := range waterworld {
if rpg.GetObjects(olist, water.Loc) == nil {
olist = append(olist, water)
}
}
*/

// make dummy world for path finding
world := new(rpg.World)
world.Tiles = rpg.GetTiles(olist)

// detect islands, make bridges
oldlist := olist
olist = nil
Expand All @@ -106,6 +106,11 @@ func main() {
}
}

return olist
}

func SaveMap(olist []rpg.Object) {

b, err := json.Marshal(olist)
if err != nil {
log.Println(err)
Expand Down
Loading

0 comments on commit b74c50b

Please sign in to comment.