본문 바로가기
728x90
SMALL

[ChatGPT] Sample Code 샘플 코드47

[ChatGPT][SDL2][2D RPG 게임 개발] SDL2 라이브러리와 지도 데이터를 저장하는 배열을 사용하여 창을 만들고 2D 세계 지도를 렌더링하는 C 파일의 예제 샘플 SDL2 라이브러리와 지도 데이터를 저장하는 배열을 사용하여 창을 만들고 2D 세계 지도를 렌더링하는 C 파일의 예제 샘플 // Here is an example of a C file that creates a window and renders a 2D world map using the SDL2 library and an array to store the map data #include "rpg_map.h" const int MAP_WIDTH = 100; const int MAP_HEIGHT = 100; int rpg_map[MAP_WIDTH][MAP_HEIGHT]; int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); SDL_Window *win.. 2023. 1. 14.
[ChatGPT][SFML][2D 게임 개발] EnemyAI 클래스 및 관련 메서드를 정의하는 enemy_ai.hpp 파일의 예제 샘플 EnemyAI 클래스 및 관련 메서드를 정의하는 enemy_ai.hpp 파일의 예제 샘플 // Here is an example of an enemy_ai.hpp file that defines the EnemyAI class and its associated methods #ifndef ENEMY_AI_HPP #define ENEMY_AI_HPP #include "enemy.hpp" #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 class EnemyAI { public: EnemyAI(); void update(Enemy& enemy, float deltaTime); private: int direction; float speed; }; #endif /* T.. 2023. 1. 14.
[ChatGPT][SFML][2D 게임 개발] SFML(Simple and Fast Multimedia Library) 라이브러리를 사용하여 적 AI를 생성하고 적의 움직임을 제어하는 ​​enemy_ai.cpp 파일의 예제 샘플 SFML(Simple and Fast Multimedia Library) 라이브러리를 사용하여 적 AI를 생성하고 적의 움직임을 제어하는 ​​enemy_ai.cpp 파일의 예제 샘플 // Here is an example of an enemy_ai.cpp file that uses the Simple and Fast Multimedia Library (SFML) library to create an enemy AI and control the movement of the enemy #include "enemy_ai.hpp" EnemyAI::EnemyAI(){ direction = rand() % 4; speed = 2; } void EnemyAI::update(Enemy& enemy,float delta.. 2023. 1. 14.
[ChatGPT][SFML][2D 게임 개발] Player 클래스 및 관련 메서드를 정의하는 player.hpp 파일의 예제 샘플 Player 클래스 및 관련 메서드를 정의하는 player.hpp 파일의 예제 샘플 // Here is an example of a player.hpp file that defines the Player class and its associated methods #ifndef PLAYER_HPP #define PLAYER_HPP #include class Player { public: Player(); void update(float deltaTime); void render(sf::RenderWindow& window); private: float x; float y; float speed; sf::Texture texture; sf::Sprite sprite; }; #endif /* This is a.. 2023. 1. 14.
728x90
LIST