C++ WinAPI를 이용하여 두개의 슈팅 게임을 개발하였습니다. 대학교 2학년 2학기에 작업을 하였으며, 각각 대학교 과제와 스스로 공부를 하면서 제작 한 게임으로, Unity의 게임 프레임워크 구조를 이해하고 따라하여 만든 게임입니다.
📜 게임 소개
게임 이름 | 플랫폼 | 개발 기간 | 개발 도구 |
슈팅 게임 | ![]() |
2021.10 ~ 2021.11 | C++ (WinAPI) |
📺 미리 보기


📒 기타 정보
· Github
GitHub - Bonnate/WinAPI_Galaga_Project
Contribute to Bonnate/WinAPI_Galaga_Project development by creating an account on GitHub.
github.com
- github 페이지에 프로젝트 리포지트리가 업로드 되어있습니다.
· 구현
- 게임 개발에 대한 이해도가 높아져 Unity 엔진의 게임 프레임워크 구조를 모방하여 제작한 게임입니다.
#include "framework.h"
GameObject::GameObject(string tag, string name, bool active, float px, float py)
{
this->tag = tag;
this->name = name;
this->active = active;
this->px = px;
this->py = py;
this->dead = false; //생성자에서..게임오브젝트가 dead가 아님
this->parent = nullptr; //생성자에서..부모게임오브젝트가 없음으로..초기화(addChildObject에서 부모포인터 지정)
}
...
void GameObject::start()
{}
void GameObject::update()
{}
void GameObject::draw()
{}
void GameObject::translate(float x, float y)
{
//게임오브젝트..이동시키기//
px = px + x;
py = py + y;
//충돌체..이동시키기//
for(int i=0 ; i < boxCollider.size() ; i++)
{
boxCollider[i]->translate(x, y);
}
//자식객체..이동시키기//
for (int i = 0; i < childObject.size(); i++)
{
childObject[i]->translate(x, y);
}
}
GameObject * GameObject::instantiate(GameObject* o, int layer)
{
ObjectManager::instantiate(o, layer);
return o; //인스턴스로..목록에 추가한 객체 반환하기
}
void GameObject::destroy(GameObject* o)
{
if (o->parent == nullptr)
{
ObjectManager::destroy(o);
}
else {
o->parent->delChildObject(o);
}
}
- Unity에서 볼 수 있는 GameObject에서 제공하는 기본적인 함수를 구현하여 Unity와 동일한 구조를 가지도록 의도하여 제작하였습니다.
#include "framework.h"
Player::Player(float px, float py) : GameObject("플레이어","플레이어", true, px, py)
{
this->speed = 200; //플레이어 이동 속력
this->fireTimer = 0; //발사타이머
this->fireDelay = 0.2; //발사대기시간
this->index = 3;
this->imageTimer = 0;
this->imageDelay = 0.1;
this->state = State::moveUp;
this->shieldTimer = 3;
this->laserCount = 0;
}
...
- 게임에서 사용하는 플레이어 객체 등 오브젝트는 Unity의 MonoBehavior을 상속받듯이 GameObject를 상속받아 사용합니다.
#include "framework.h"
vector<GameObject*> ObjectManager::gameObject[MAX_LAYER];
void ObjectManager::instantiate(GameObject* o, int layer)
{
gameObject[layer].push_back(o);
o->start();
}
void ObjectManager::destroy(GameObject* o)
{
//충돌검사쌍의 사용이 끝난후..삭제할 수 있도록...삭제...정보 표시를함//
o->setDead(true);
}
void ObjectManager::update()
{
//객체들 업데이트(이동, 발사)//
for (int layer = 0; layer < MAX_LAYER; layer++)
{
for (int i = 0; i < gameObject[layer].size(); i++)
{
if (gameObject[layer][i]->getActive() == true)
{
gameObject[layer][i]->update();
}
}
}
}
...
- 모든 게임 오브젝트를 상속받는 객체는 ObjectManager에서 관리되어 프레임(Update)별로 각 행동을 검사하여 충돌처리나 움직임, 상태확인 등을 수행합니다.
...
case State::moveUp :
{
//위로..이동하기//
float dist = speed * Time::deltaTime;
translate(0, -dist);
//위로 이동 후...플레이 위치가 되면..
float py = getPy();
if (py <= 650)
{
state = State::control;
}
}
break;
...
- Time.DeltaTime 개념을 적용하여 더 이상 Sleep()를 사용하지 않아 자연스러운 움직임 등 프레임 관리가 가능합니다.
'my portfolio' 카테고리의 다른 글
[유니티] Space Flight (0) | 2024.02.07 |
---|---|
[C++ WinAPI] 테트리스 (0) | 2023.09.24 |
[C++ Console] 오목 게임 (0) | 2023.09.24 |
[C++ Console] 슈팅 게임 (0) | 2023.09.24 |
개인 프로젝트 Mate, 무료로 Steam에 출시! (0) | 2022.07.08 |
C++ WinAPI를 이용하여 두개의 슈팅 게임을 개발하였습니다. 대학교 2학년 2학기에 작업을 하였으며, 각각 대학교 과제와 스스로 공부를 하면서 제작 한 게임으로, Unity의 게임 프레임워크 구조를 이해하고 따라하여 만든 게임입니다.
📜 게임 소개
게임 이름 | 플랫폼 | 개발 기간 | 개발 도구 |
슈팅 게임 | ![]() |
2021.10 ~ 2021.11 | C++ (WinAPI) |
📺 미리 보기


📒 기타 정보
· Github
GitHub - Bonnate/WinAPI_Galaga_Project
Contribute to Bonnate/WinAPI_Galaga_Project development by creating an account on GitHub.
github.com
- github 페이지에 프로젝트 리포지트리가 업로드 되어있습니다.
· 구현
- 게임 개발에 대한 이해도가 높아져 Unity 엔진의 게임 프레임워크 구조를 모방하여 제작한 게임입니다.
#include "framework.h"
GameObject::GameObject(string tag, string name, bool active, float px, float py)
{
this->tag = tag;
this->name = name;
this->active = active;
this->px = px;
this->py = py;
this->dead = false; //생성자에서..게임오브젝트가 dead가 아님
this->parent = nullptr; //생성자에서..부모게임오브젝트가 없음으로..초기화(addChildObject에서 부모포인터 지정)
}
...
void GameObject::start()
{}
void GameObject::update()
{}
void GameObject::draw()
{}
void GameObject::translate(float x, float y)
{
//게임오브젝트..이동시키기//
px = px + x;
py = py + y;
//충돌체..이동시키기//
for(int i=0 ; i < boxCollider.size() ; i++)
{
boxCollider[i]->translate(x, y);
}
//자식객체..이동시키기//
for (int i = 0; i < childObject.size(); i++)
{
childObject[i]->translate(x, y);
}
}
GameObject * GameObject::instantiate(GameObject* o, int layer)
{
ObjectManager::instantiate(o, layer);
return o; //인스턴스로..목록에 추가한 객체 반환하기
}
void GameObject::destroy(GameObject* o)
{
if (o->parent == nullptr)
{
ObjectManager::destroy(o);
}
else {
o->parent->delChildObject(o);
}
}
- Unity에서 볼 수 있는 GameObject에서 제공하는 기본적인 함수를 구현하여 Unity와 동일한 구조를 가지도록 의도하여 제작하였습니다.
#include "framework.h"
Player::Player(float px, float py) : GameObject("플레이어","플레이어", true, px, py)
{
this->speed = 200; //플레이어 이동 속력
this->fireTimer = 0; //발사타이머
this->fireDelay = 0.2; //발사대기시간
this->index = 3;
this->imageTimer = 0;
this->imageDelay = 0.1;
this->state = State::moveUp;
this->shieldTimer = 3;
this->laserCount = 0;
}
...
- 게임에서 사용하는 플레이어 객체 등 오브젝트는 Unity의 MonoBehavior을 상속받듯이 GameObject를 상속받아 사용합니다.
#include "framework.h"
vector<GameObject*> ObjectManager::gameObject[MAX_LAYER];
void ObjectManager::instantiate(GameObject* o, int layer)
{
gameObject[layer].push_back(o);
o->start();
}
void ObjectManager::destroy(GameObject* o)
{
//충돌검사쌍의 사용이 끝난후..삭제할 수 있도록...삭제...정보 표시를함//
o->setDead(true);
}
void ObjectManager::update()
{
//객체들 업데이트(이동, 발사)//
for (int layer = 0; layer < MAX_LAYER; layer++)
{
for (int i = 0; i < gameObject[layer].size(); i++)
{
if (gameObject[layer][i]->getActive() == true)
{
gameObject[layer][i]->update();
}
}
}
}
...
- 모든 게임 오브젝트를 상속받는 객체는 ObjectManager에서 관리되어 프레임(Update)별로 각 행동을 검사하여 충돌처리나 움직임, 상태확인 등을 수행합니다.
...
case State::moveUp :
{
//위로..이동하기//
float dist = speed * Time::deltaTime;
translate(0, -dist);
//위로 이동 후...플레이 위치가 되면..
float py = getPy();
if (py <= 650)
{
state = State::control;
}
}
break;
...
- Time.DeltaTime 개념을 적용하여 더 이상 Sleep()를 사용하지 않아 자연스러운 움직임 등 프레임 관리가 가능합니다.
'my portfolio' 카테고리의 다른 글
[유니티] Space Flight (0) | 2024.02.07 |
---|---|
[C++ WinAPI] 테트리스 (0) | 2023.09.24 |
[C++ Console] 오목 게임 (0) | 2023.09.24 |
[C++ Console] 슈팅 게임 (0) | 2023.09.24 |
개인 프로젝트 Mate, 무료로 Steam에 출시! (0) | 2022.07.08 |