package game
import (
"image/color"
"math"
)
type BarGame struct {
Bar_x, Bar_y, BarSpd_x, BarSpd_y float64
Visible bool
C color.Color
}
func (b *BarGame) Update() {
if b.Bar_x != 0 || b.Bar_y != 0 || b.BarSpd_x != 0 || b.BarSpd_y != 0 {
a := -(math.Pow(b.BarSpd_x, 2) + math.Pow(b.BarSpd_y, 2)) / math.Sqrt(math.Pow(b.Bar_x, 2)+math.Pow(b.Bar_y, 2))
theta := math.Atan2(b.Bar_y, b.Bar_x)
b.BarSpd_x += a * math.Cos(theta)
b.BarSpd_y += a * math.Sin(theta)
}
b.Bar_x += b.BarSpd_x
b.Bar_y += b.BarSpd_y
}
해당 코드는 아래의 연립 2계 미분방정식을 반영합니다.

(x와 y는 각각 x축 방향의 변위, y축 방향의 변위를 의미합니다.)
각각 구심 가속도의 x성분, y성분을 가속도로써 반영한 것입니다.
type Game struct {
ScreenHeight int
ScreenWidth int // Layout에 사용 (Window size와 동일)
Unit int // default rendering 해상도 단위 (픽셀 단위, 30)
Current_Ply int // 도둑이 현재 플레이하고 있는 캐릭터 번호
Num_Thief int // 도둑 캐릭터 갯수
Num_Sp int // 스위치 갯수
Sprites []*sprite.Sprites // Sprites = {벽, Police, Thieves, Switches}
GameOver bool
Bar *BarGame
SpaceCooldown time.Time // bargame 쿨타임
MaxCooldown float64 // bargame 쿨타임 limit
PanJung int // bargame 파란색 영역 크기
}