AI移动元素
This commit is contained in:
parent
1c23a60bf2
commit
6d86f3a05b
@ -85,14 +85,15 @@ func (this *MapData) SetMap() {
|
|||||||
3, 1, 5, 4, 2, 4, 4,
|
3, 1, 5, 4, 2, 4, 4,
|
||||||
4, 4, 2, 1, 6, 4, 1,
|
4, 4, 2, 1, 6, 4, 1,
|
||||||
6, 3, 1, 4, 3, 6, 3,
|
6, 3, 1, 4, 3, 6, 3,
|
||||||
6, 3, 3, 1, 1, 6, 1,
|
6, 1, 3, 5, 1, 6, 1,
|
||||||
5, 6, 5, 5, 1, 3, 1,
|
5, 6, 5, 5, 1, 3, 1,
|
||||||
6, 5, 5, 1, 2, 1, 4,
|
6, 1, 5, 1, 2, 1, 4,
|
||||||
}
|
}
|
||||||
var pos int
|
var pos int
|
||||||
for index := Width - 1; index >= 0; index-- {
|
for index := Width - 1; index >= 0; index-- {
|
||||||
for j := 0; j < Height; j++ {
|
for j := 0; j < Height; j++ {
|
||||||
this.Plat[index+j*Height].Color = sz2[pos]
|
this.Plat[index+j*Height].Color = sz2[pos]
|
||||||
|
this.Plat[index+j*Height].Cid = sz2[pos]
|
||||||
pos++
|
pos++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,14 +457,23 @@ func (this *MapData) AiSwapGirde() bool {
|
|||||||
y := pos % Height
|
y := pos % Height
|
||||||
if y < Height-1 {
|
if y < Height-1 {
|
||||||
if b, _ := this.SwapGirde(int32(pos), int32(pos+1), 2); b {
|
if b, _ := this.SwapGirde(int32(pos), int32(pos+1), 2); b {
|
||||||
bSwap = true
|
if s, _, _ := this.CheckMap(2); s == 0 {
|
||||||
break
|
this.SwapGirde(int32(pos+1), int32(pos), 2)
|
||||||
|
} else {
|
||||||
|
bSwap = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pos/Width+1 < Width {
|
if pos/Width+1 < Width {
|
||||||
if b, _ := this.SwapGirde(int32(pos), int32(pos+Width), 2); b {
|
if b, _ := this.SwapGirde(int32(pos), int32(pos+Width), 2); b {
|
||||||
bSwap = true
|
if s, _, _ := this.CheckMap(2); s == 0 {
|
||||||
break
|
this.SwapGirde(int32(pos+Width), int32(pos), 2)
|
||||||
|
} else {
|
||||||
|
bSwap = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user