blob: 26dd568783c9b9d4ef664ec04c7e9fa8f2592e82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package tris
func (p Placement) Floor(f Field) bool {
fp := p
fp.Y++
return fp.Collide(f)
}
func (p Placement) Move(f Field, rot Rotation, x, y int) (np Placement, floor, topout bool) {
np = p
np.Rot = rot
np.X = x
np.Y = y
if !np.Collide(f) { // free air
return np, np.Floor(f), false
}
np = p // last resort reset p
if np.Floor(f) && np.Y < 0 {
return np, true, true
}
return np, np.Floor(f), false
}
|