Used methods in Tutorial part 2 - ilovethisid/Educational-Ascii-Game-engine GitHub Wiki
Tutorial part 2 : Player movement์์ ์ฌ์ฉ๋ EAG engine component๋ค์ ์๊ฐํฉ๋๋ค.
updateLoop()๊ฐ ํธ์ถ๋๊ธฐ ์ง์ ์ ์คํ๋๋ฉฐ, KeyListener๋ฅผ ๊ตฌํํ๋ ๋ถ๋ถ์
๋๋ค.
Rigidbody์ ์ด๋์ ๊ด๋ จ๋ ๊ธฐ๋ฅ๋ค์ ๊ตฌํํ์ต๋๋ค.
bool keycheck(int key)key code๋ฅผ ๋๊ฒจ์ฃผ๋ฉด ํ์ฌ ํด๋น key๊ฐ ๋๋ ค์๋์ง ์ฌ๋ถ๋ฅผ ๋ฐํํฉ๋๋ค.
| Name | Value | Description |
|---|---|---|
| key | int | ํ์ธํ ํค์ ์ฝ๋๊ฐ |
void Rigidbody::setVelocity(int x, int y)Rigidbody์ ์๋๋ฅผ ์ค์ ํฉ๋๋ค. move()๋ฅผ ํตํด ์ค์ ๋ ์๋๋ก Rigidbody๋ฅผ ์์ง์ผ ์ ์์ต๋๋ค.
| Name | Value | Description |
|---|---|---|
| x | int | ์ค์ ํ x์ถ ๋ฐฉํฅ ์๋ |
| y | int | ์ค์ ํ y์ถ ๋ฐฉํฅ ์๋ |
void Object::move(vector<Object*>& objects)์ค์ ๋ ์๋๋ก Object๋ฅผ ์์ง์ ๋๋ค.
| Name | Value | Description |
|---|---|---|
| objects | vector<Object*> | ์ฒ๋ฆฌํ Object๊ฐ ๋ด๊ธด vector |