GithubHelp home page GithubHelp logo

nezvers / godot-gametemplate Goto Github PK

View Code? Open in Web Editor NEW
1.1K 26.0 67.0 526 KB

Template with all necessary stuff taken care, just create your games main features.

License: MIT License

GDScript 100.00%
godot menu loading options async gdscript sfx manager pause

godot-gametemplate's Introduction

Godot-GameTemplate

Game Template some stuff taken care for Godot users not to worry about creating most boring and tedious work.
Main branch will be compatible with pixel art games, since those games require some more work to get everything right.
I'd be happy for any contribution to make this template as good as it can be and it is open for branching out Hi-Res game branch.

*Read this in other languages: Español

Features

  • Modular and clean code base.
  • Quick to setup (Plugin format - enabling plugin adds all singletons).
  • Easy to expand Save/Load system. (Comes with Resource saving as default but there's an option to switch to JSON).
  • Comes with custom ResourceAsyncLoader class (used in scene changing. Has fallbacks to regular loading for platforms that don't support async loading).
  • Localization system - community helped (EN, DE, ES, FR, IT, pt_BR, RU, sv_SE, TR. RU is not active due to font limitation).
  • Sound effects manager system - (manages SFX sample playing to not trigger multiple same samples together)
  • Controls rebinding system.
  • Resolution changing system.
  • Audio volume system.
  • Easy to change scene transition (comes with fade to black).
  • Menus can navigate without mouse.
  • Convinient singleton HtmlFocus, that asks to click on it if you have HTML5 game to gain game window focus (automatically free itself if not html5).
  • Comes with custom style (saved - planned to turn into theme).
  • HUD singleton (ready to be used in your way).
  • Music singleton for persistent music after restarting or changing scenes

How to use

  • Drop GameTemplate from addons folder in your projects addons folder;
  • Enable GameTemplate plugin in Project Settings. It will set up all necessary autoloads automatically;
  • Set projects audio bus layer - res://addons/GameTemplate/Assets/Audio_bus_layout.tres. Plugin can't do that automatically yet.
  • Add your main menu scene to addons/GameTemplate/Autoloads/PauseMenu.tscn script variable 'MainMenu'. It is used by PauseLayer to switch scene to main menu or similar;
  • Edit SettingsControls.gd (inside Autoload directory) Actions array of input map names. They are the ones uned in button remapping.
  • To change scenes trigger signal: Game.emit_signal('change_scene', scene_file_location_string)
  • To use SfxManager give Array of samples to load: SfxManager.load_samples( ["res://...."] ) and trigger samples with: SfxManager.play("file_name_without_extension")
  • To enable/disable HUD your levels set: Hud.visible = true
  • To enable/disable pause menu levels set: PauseMenu.can_show = true
  • Check convinient signals in Game singleton (New Game, Continue, Resume, Restart, ChangeScene, Exit)

Walkthrough

Singletone roles:

  • Game - convinient game signals, scene changing, scene restarting, game exit.
  • ScreenFade - scene transitioning layer. As a template it's just Fade-to-Black ColorRect but it's easy to add fading shader to it.
  • PauseMenu - Is a menu that appears while in game and pauses the game, allowing to (Resume, Options, Main Menu, Exit).
  • Options - GUI for changing resolution (Fullscreen, Borderless, scaling), Audio faders (Master, Music, SFX) and Controls section for Action bindings.
  • Settings - delegates order of other Settings singletons _ready.
  • SettingsSaveLoad - Manages save/load settings. Easily expandable for other parameters and comes with 2x versions Resource and JSON saving.
  • SettingsResolutions - handles the resolution changes.
  • SettingsControls - handles the information for controls.
  • SettingsLanguage - handles information for languages.
  • MenuEvent - handles events between options menu GUI.
  • Hud - reserved for game specific overlay (HP, Points, etc.).
  • Music - Persistent AudioStreamPlayer for music.
  • HTMLfocus - if game is HTML5 it will overlay a button on screen, requesting player to click on it and allowing the game to become in focus.

Options menu

Every settings option gets saved uppon exiting Options menu.

Languages menu

At the moment simplified interaction. Russian is translated but excluded in options because font doesn't support Cyrillic letters (If you know good pixel art font with Cyrillic supporl, please let me know).

Key action binding menu

Godot editor InputMap influenced rebinding with auto-detect function.
Buttons gets saved uppon exiting Options menu.

To-Do

  • Add pixel-art compliant slider in Action rebinding list

godot-gametemplate's People

Contributors

aaronfranke avatar havfo avatar ilyabrin avatar lyaaaaaaaaaaaaaaa avatar maujin111 avatar nezvers avatar overdev avatar paul-mcnamee avatar raymoef avatar rjack avatar robertsson avatar thedarkweasel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-gametemplate's Issues

Pause menu glitch

Hello,

First, thank you to all of the contributors for this great template!

I noticed that when you join the game, if you click the "Go Back" button and quickly hit escape for the pause menu (before the scene switch happens), you can end up in a weird state where you have the pause menu showing on the main menu:

image

I found a quick fix and will create a MR off of this issue. #27

SfxManager Details

Hey!
Thanks for the great starter template.

I am running into issues with the Sfx Manager though. Is there any more information on how it works and is supposed to be used?

If i use SfxManager.load_samples() twice it always crashes. Am I supposed to call this once with all available sounds?

Cheers

Control Menu doesn't accept InputEventMouseButton event

While I used this template I just noticed that the script doesn't handle mouse buttons event at all which makes it impossible to configure the mouse buttons for things like firing or other key bindings I had to place InputEventMouseButton on several places which is popup.gd, SettingsControl.gd and Controls.gd to get the menu to accept mouse buttons.

Scale button having strange behavior

Describe the bug
In the options menu, the scale button doesn't do scaling. It turns on full-screen and prevent me from turning it off.

To Reproduce
Steps to reproduce the behavior:

  1. Go in the option menu
  2. Click on the scaling button (+ or -)
  3. Try turning off full-screen

Expected behavior
I guess it should do scaling and not locking full-screen.

Godot's version

  • I'm on v3.2.1.stable.fedora

If you need more details feel free to ask :).

Thank you.

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.