mirror of
https://github.com/HigherOrderCO/Kind1.git
synced 2024-09-11 08:45:32 +03:00
added next id in grid
This commit is contained in:
parent
06a372bfa1
commit
655dfa160a
@ -168,12 +168,21 @@ App.GG.Creature.delete(coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
let new_tile = tile@creature <- none
|
||||
App.GG.Grid.set(coord, new_tile, grid)
|
||||
|
||||
// App.GG.Creature.create_from_monster(monster: App.GG.Monster, team: App.GG.Team,)
|
||||
// case monster {
|
||||
// slime:
|
||||
// App.GG.Creature.create_slime(slime: App.GG.Slime, grid: App.GG.Grid): App.GG.Creature
|
||||
// let tema = App.GG.Team.blue
|
||||
// let animation = {App.GG.Animation.idle, 0}
|
||||
// let actions = App.GG.Actions.new(none, none, false)
|
||||
// let status = [] :: List<App.GG.Creature.Status>
|
||||
// let id = App.GG.Grid.next_id(grid)
|
||||
// let dna
|
||||
// open slime
|
||||
// open slime.dna
|
||||
// let hand = []
|
||||
// let folder = ?s
|
||||
|
||||
|
||||
// PROJECTILE HAS ACETED
|
||||
|
||||
// minion:
|
||||
// }
|
||||
|
||||
// // type App.GG.Creature {
|
||||
// new(
|
||||
@ -185,4 +194,11 @@ App.GG.Creature.delete(coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
// hp: I32
|
||||
// id: Nat
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
// slime(
|
||||
// data: App.GG.Slime
|
||||
// hand: App.GG.Chips
|
||||
// folder: App.GG.Chips
|
||||
// energy: I32
|
||||
// )
|
@ -55,3 +55,20 @@ App.GG.Grid.move_creature(origin: App.GG.Coord, destination: App.GG.Coord, grid:
|
||||
//log("origin.x = "| U32.show(origin@fst) |", origin.y = " | U32.show(origin@snd) | ", destination.x = "| U32.show(destination@fst) |", destination.y = " | U32.show(destination@snd))
|
||||
return new_grid
|
||||
} <> grid
|
||||
|
||||
App.GG.Grid.id_list(grid: App.GG.Grid): List<Nat>
|
||||
let ids = []
|
||||
for coord:tile in grid with ids:
|
||||
let creature = tile@creature
|
||||
without creature: ids
|
||||
creature@id & ids
|
||||
ids
|
||||
|
||||
App.GG.Grid.next_id(grid: App.GG.Grid): Nat
|
||||
let ids = App.GG.Grid.id_list(grid)
|
||||
App.GG.Grid.next_id.go(0, ids)
|
||||
|
||||
App.GG.Grid.next_id.go(count: Nat, ids: List<Nat>): Nat
|
||||
let id = List.find<Nat>(Nat.eql(count), ids)
|
||||
without id: count
|
||||
App.GG.Grid.next_id.go(count + 1, ids)
|
Loading…
Reference in New Issue
Block a user