Script API - GameEgg/STARPOO-II GitHub Wiki
<์ฃผ์ : ์๋ฐ์คํฌ๋ฆฝํธ์ Math.random ๋์ ์ ๊ณตํด์ฃผ๋ random์ ์ฌ์ฉํด์ฃผ์ธ์. ๊ทธ๋์ผ ์ผ์ ํ ๊ฒฐ๊ณผ๊ฐ ๋ณด์ฅ๋ฉ๋๋ค.>
<์ฃผ์ : ์์์ ์์น๋ ์ฐธ๊ณ ์ฉ์ผ๋ก๋ง ์ฌ์ฉํ๊ณ , ํ๋ ์ฝ๋ฉํ์ง ๋ง์ธ์! ๊ฒ์ ๋ฒ์ ์ด ์ฌ๋ผ๊ฐ์ ๋ฐ๋ผ ์ค์ ์ธ๊ฒ์ ์์น๊ฐ ๋ฌธ์์ ์ ํ ๊ฐ๊ณผ ๋ฌ๋ผ์ง ์ ์์ต๋๋ค! ์์๋ช ์ ์ฌ์ฉํด์ฃผ์ธ์.>
dt : ์ด์ update์ ์ง๊ธ update ์ฌ์ด์ ์๊ฐ ๊ฐ๊ฒฉ.
ํธ์์ dt๋ผ๋ ์ด๋ฆ์ ๊ฐ์ง๋, ์ค์ ๋ก๋ ์๊ฐ๊ณผ ๋ฌด๊ดํ๊ฒ ๊ณ ์ ๋ ์์์
๋๋ค.
(์๋ฎฌ๋ ์ด์
์ด ์ปดํจํฐ ์ฑ๋ฅ๊ณผ ๋ฌด๊ดํ๊ฒ ์ผ์ ํ๊ฒ ๋ ์ ์๋๋ก ํ๊ธฐ ์ํด)
shipMaxHp : ํ ํจ์ ์ด ๊ฐ์ง๋ HP (5)
shipMaxSpeed : ํจ์ ์ ์ต๋ ์๋ (300m/s)
shipMaxRotSpeed : ํจ์ ์ ์ต๋ ํ์ ์๋ (360 degree/s)
chargingSpeed : ์ฐจ์ง ์คํผ๋ (1.5/s)
shootingDelay : ๋ฐ์ฌ ๋๊ธฐ์๊ฐ (0.8/s)
maxChargingPower : ์ต๋ ์ฐจ์ง ์๋์ง (5)
groundRadius : ๊ฒฝ๊ธฐ์ฅ ๋ฐ์ง๋ฆ (1200m)
myShip
id : ํจ์ id (์ ํจ์ ๊ณผ ๋ดํจ์ ์๊ด์์ด ๊ณ ์ ์๋ณ ๋ฒํธ)
hp : ํจ์ ํ์ฌ hp
x : ํจ์ ์ ํ์ฌ ์์น x ์ขํ๊ฐ
y : ํจ์ ์ ํ์ฌ ์์น y ์ขํ๊ฐ
spd : ํ์ฌ ํจ์ ์ ์๋
rotSpd : ํ์ฌ ํจ์ ์ ํ์ ์๋ (degree/s)
rot : ํจ์ ์ด ํ์ฌ ํฅํ๊ณ ์๋ ๊ฐ๋ (-180 ~ 180)
rad : ํจ์ ์ด ํ์ฌ ํฅํ๊ณ ์๋ ๊ฐ๋ radian ๋ฒ์ (-pi ~ pi)
delay : ํจ์ ์ ๋จ์ ๋๋ ์ด ์๊ฐ (์ด)
isCharging : ํ์ฌ ํจ์ ์ด ์ฐจ์ง์ค์ธ ์ํ์ธ์ง (true, false)
chargedPower : ํ์ฌ๊น์ง ํจ์ ์ด ์ฐจ์งํ ์๋์ง
shootingRot : ํจ์ ์ ๋ฐ์ฌ ๊ฐ๋
shootingRad : ํจ์ ์ ๋ฐ์ฌ ๊ฐ๋(๋ผ๋์)
shootingPower : ์ง๊ธ ์ฐจ์ง์ค์ธ ๋ ์ด์ ์ ํ์
isDetected : ์ ์๊ฒ ๋ฐ๊ฐ๋จ(boolean)
ship
id : ํจ์ id (์ ํจ์ ๊ณผ ๋ดํจ์ ์๊ด์์ด ๊ณ ์ ์๋ณ ๋ฒํธ)
hp : ํจ์ ํ์ฌ hp
x : ํจ์ ์ ํ์ฌ ์์น x ์ขํ๊ฐ
y : ํจ์ ์ ํ์ฌ ์์น y ์ขํ๊ฐ
rot : ํจ์ ์ด ํ์ฌ ํฅํ๊ณ ์๋ ๊ฐ๋ (-180 ~ 180)
rad : ํจ์ ์ด ํ์ฌ ํฅํ๊ณ ์๋ ๊ฐ๋ radian ๋ฒ์ (-pi ~ pi)
delay : ํจ์ ์ ๋จ์ ๋๋ ์ด ์๊ฐ (์ด)
isCharging : ํ์ฌ ํจ์ ์ด ์ฐจ์ง์ค์ธ ์ํ์ธ์ง (true, false)
chargedPower : ํ์ฌ๊น์ง ํจ์ ์ด ์ฐจ์งํ ์๋์ง
shootingRot : ํจ์ ์ ๋ฐ์ฌ ๊ฐ๋
shootingRad : ํจ์ ์ ๋ฐ์ฌ ๊ฐ๋(๋ผ๋์)
shootingPower : ๋ฐ์ฌ ํ์(์๋์ง)
-
shoot(number)
: ์ธ์๋ก ์ถฉ์ ๋์ ์ ๋ ฅํ๋ฉฐ, ์ถฉ์ ๋/chargingSpeed ๋งํผ์ ์๊ฐ ์ดํ์, shoot ํจ์๋ฅผ ์คํํ ๋น์ ํจ์ ์ด ๋ณด๊ณ ์๋ ๋ฐฉํฅ์ผ๋ก ๋ ์ด์ ๋ฅผ ๋ฐ์ฌํ๋ค. ๋ ์ด์ ๋ ์๊ตฐ/์ ๊ตฐ์ ๊ตฌ๋ถํ์ง ์๊ณ ๋ฐฐ์ ๋ถ๋ชํ๋ฉด ์ถฉ์ ๋๋งํผ์ ๋ฐ๋ฏธ์ง๋ฅผ ์ฃผ๊ณ ์๋ฉธํ๋ค. ๋ ์ด์ ๋ฅผ ์ถฉ์ ์ค์ด๊ฑฐ๋, ๋ ์ด์ ๋ฅผ ๋ฐ์ฌํ ์ดํ shootingDelay ๋งํผ์ ์๊ฐ(์ด) ๋์์ shoot ํจ์๋ฅผ ํธ์ถํด๋ ์๋ฌด ์ผ๋ ์ผ์ด๋์ง ์๋๋ค. -
setSpeed(number)
: ๋ฐฐ์ ์ ์ง์๋ ฅ(0 ~ shipMaxSpeed) -
setRotSpeed(number)
: ๋ฐฐ์ ํ์ ์๋(-shipMaxRotSpeed ~ shipMaxRotSpeed)๋ฅผ ์ค์ ํ๋ค. ํ์ ์๋๊ฐ ์์๋ฉด ๋ฐ์๊ณ ๋ฐฉํฅ์ผ๋ก ๋๊ณ , ์์๋ฉด ์๊ณ๋ฐฉํฅ์ผ๋ก ๋๋ค. (example) ๋ง์ฝ setRotSpeed(90)์ ํธ์ถํ์๋ค๋ฉด, 1์ด ํ์ ํจ์ ์ ๋ฐ์๊ณ๋ฐฉํฅ์ผ๋ก 90๋ ํ์ ํ ์ํ๊ฐ ๋๋ค.
-
cos(number)
: ์ธ์๋ก degree๋ฅผ ์ธ ์ ์๋ cos ํจ์์ด๋ค. -
sin(number)
: ์ธ์๋ก degree๋ฅผ ์ธ ์ ์๋ sin ํจ์์ด๋ค. -
d2r(number)
: degree to radian conversion -
r2d(number)
: radian to degree conversion -
dist({x,y}, {x,y})
: ๋ ์ ์ฌ์ด์ ๊ฑฐ๋ฆฌ๋ฅผ ๊ตฌํ๋ ํจ์์ด๋ค. -
log(string)
: log ๋ฌธ์์ด console์ print -
polarFrom({x,y,rot},{x,y}) -> rot, r
: ์ฒซ ๋ฒ์งธ ์ธ์๋ฅผ ๊ธฐ์ค์ ์ผ๋ก ๋ ๋ฒ์งธ ์ธ์์ ๊ทน์ขํ๋ฅผ ๋ฐํํ๋ค. ๋จ, rot์ radian์ด ์๋ degree์ด๋ค. -
polar({x,y}) -> rot, r
: ๊ฒฝ๊ธฐ์ฅ์ ์ค์ฌ(0,0)์ ๊ธฐ์ค์ ์ผ๋ก ๋ฐ์นด๋ฅดํธ ์ขํ๋ฅผ ๊ทน์ขํ๋ก ๋ณํํ๋ค. -
cartesian({r,rot}) -> x, y
: ๊ฒฝ๊ธฐ์ฅ์ ์ค์ฌ(0,0)์ ๊ธฐ์ค์ ์ผ๋ก ํ ๊ทน์ขํ๋ฅผ ๋ฐ์นด๋ฅดํธ ์ขํ๊ณ๋ก ๋ณํํ๋ค. -
random()
: 0~1 ์ฌ์ด์ ์์์ 5์๋ฆฌ์ ์๋ฅผ ๋ฐํํ๋ค.