Git Product home page Git Product logo

liuhong2dgame-master's Introduction

LiuHong2DGame-master

Introduction

This project use SDL library and Lua embeded C++ code create 2D game Engine about 2D game. The project is built based on Mac OS system

Denpendency

Install sdl2:

$brew install sdl2

install sdl2 image:

$brew install sdl2_image

Install sdl2 font support:

$brew install sdl2_ttf

Install sdl2 mixer:

$brew install sdl2_mixer

install lua:

$brew install lua

Game Loop (main.cpp and Game.cpp)

  1. Game initialize: SDL, TTF, window, SDL renderer, Load all component;
  2. Fix time step for multicomputer(Game::Update());
  3. Double render buffer(Game::Render());

Entity and their Component

  1. Create Entity manager to load entity into entity vector.
  2. Create Asset manager to manager the assets from the file.
  3. Multi component class inherit from component main class :
  • TransformComponent.h : control the transform of entity
  • TileComponent.h : tileMap draw based on camera position
  • TextLabelComponent.h : font in the game
  • SpriteComponent.h : animation of entity
  • ProjectileEmitterComponent : shooting of enemy and player
  • KeyboardControlComponent.h: Process input from keyboard
  • ColliderComponent.h : collision with other entities.

Render order define with Layer_type

Embed Lua

Lua Load the Entity from Lua level file

Example video

You can check the demo video for single enemy game engine Here !

liuhong2dgame-master's People

Contributors

lipilian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.