Coder Social home page Coder Social logo

simple-game-framework's Introduction

简单的游戏框架

一个模块化的GDScript游戏逻辑框架。

现在支持的模块:

  • 游戏存档/读档
  • 游戏点数(可用于体力、游戏中的金币)
  • Buff
  • 成就
  • 每日任务(可用于登陆奖励)
  • 定时器

今后还会支持的功能

  • 道具模块
  • 背包模块
  • 任务模块
  • 带分支剧情

所有提供的内置模块功能都可以扩展和替换。

如何搭建框架

  1. 拷贝 simple-game-framework 目录到 res://addons
  2. 创建一个继承自 SimpleGameFramework 的脚本类,并将其添加为 autoload 单例。
  3. 添加所需的内置模块
  4. 实现你自己的Module并添加到框架中

如下为一个game.gd示例,可将其添加为全局单例 game

extends SimpleGameFramework
func _init():
	add_module('daily', DailyTask.new())
	add_module('timer', TimerModule.new())
	add_module('energe', GamePoint.new())
	add_module('buff', BuffModule.new())
	add_module('achievement', AchievementModule.new())

func _process(dt):
	logic_update(dt)

这样你就可以在任何地方使用框架和各个模块

# 每60秒存档一次
game.modules.timer.loop(60, game, "save")

simple-game-framework's People

Contributors

geequlim avatar

Watchers

James Cloos 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.