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,
|
||||
4, 4, 2, 1, 6, 4, 1,
|
||||
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,
|
||||
6, 5, 5, 1, 2, 1, 4,
|
||||
6, 1, 5, 1, 2, 1, 4,
|
||||
}
|
||||
var pos int
|
||||
for index := Width - 1; index >= 0; index-- {
|
||||
for j := 0; j < Height; j++ {
|
||||
this.Plat[index+j*Height].Color = sz2[pos]
|
||||
this.Plat[index+j*Height].Cid = sz2[pos]
|
||||
pos++
|
||||
}
|
||||
}
|
||||
@ -456,16 +457,25 @@ func (this *MapData) AiSwapGirde() bool {
|
||||
y := pos % Height
|
||||
if y < Height-1 {
|
||||
if b, _ := this.SwapGirde(int32(pos), int32(pos+1), 2); b {
|
||||
if s, _, _ := this.CheckMap(2); s == 0 {
|
||||
this.SwapGirde(int32(pos+1), int32(pos), 2)
|
||||
} else {
|
||||
bSwap = true
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if pos/Width+1 < Width {
|
||||
if b, _ := this.SwapGirde(int32(pos), int32(pos+Width), 2); b {
|
||||
if s, _, _ := this.CheckMap(2); s == 0 {
|
||||
this.SwapGirde(int32(pos+Width), int32(pos), 2)
|
||||
} else {
|
||||
bSwap = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bSwap
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user