Compare commits

...

137 Commits

Author SHA1 Message Date
Kazhnuz Klappsthul 7fd8db592d Merge pull request 'feat/rebrand' (#77) from feat/rebrand into master
Reviewed-on: birb/birb-engine#77
2022-08-13 16:37:22 +02:00
Kazhnuz Klappsthul a5f075d5d2 chore: rename modules/ to scenes/ 2022-08-13 12:43:49 +02:00
Kazhnuz Klappsthul c64b9a42b7 vscode: update globals 2022-08-12 10:59:14 +02:00
Kazhnuz Klappsthul 5ab63a145a chore: update readme and changelog 2022-08-12 10:59:03 +02:00
Kazhnuz Klappsthul 6d3c8de013 chore: rename the birb/ folder to framework/ 2022-08-12 10:50:42 +02:00
Kazhnuz Klappsthul d5f446f4ed improvement: use the framework namespace 2022-08-12 10:46:22 +02:00
Kazhnuz Klappsthul 69a567e4c2 Merge pull request 'Rebase on Radiance' (#71) from wip/radiance-rebase into master
Reviewed-on: birb/birb-engine#71
2022-08-12 10:37:34 +02:00
Kazhnuz Klappsthul f3d175266b wip: basic fix for plateform
The real fix will be done when exemples will be reworked from scratch
2022-08-12 10:36:24 +02:00
Kazhnuz Klappsthul f9b936a726 fix(world): fix hitbox type 2022-08-10 19:19:22 +02:00
Kazhnuz Klappsthul 3cb6c61cac fix(plateform): us right function for hitboxes 2022-08-10 19:18:04 +02:00
Kazhnuz Klappsthul eec43a522e fix(tiled): use the sti in the wrapper 2022-08-10 19:17:40 +02:00
Kazhnuz Klappsthul f892b1ce4e fix: add gamesystem as a top-level element 2022-08-10 19:17:24 +02:00
Kazhnuz Klappsthul de08fbd56b fix(textmenu): better scene loading 2022-08-10 19:16:22 +02:00
Kazhnuz Klappsthul 4722b734ed fix: do not load datapack if there isn't any 2022-08-10 19:15:38 +02:00
Kazhnuz Klappsthul a315fcebb5 fix: remove stuff removed from Radiance's birb 2022-07-28 17:31:33 +02:00
Kazhnuz Klappsthul 5178ee0020 wip: other radiance stuff 2022-07-27 21:57:34 +02:00
Kazhnuz Klappsthul c3179dcf9d fix: fix main menu 2021-12-05 12:26:58 +01:00
Kazhnuz Klappsthul 8c4bcc70d5 improvement: add a function to get current scene 2021-12-05 12:23:49 +01:00
Kazhnuz Klappsthul 2974d94df4 fix: load right menus from gui package 2021-12-04 14:12:17 +01:00
Kazhnuz Klappsthul fff87e8ebb fix: fix gametime 2021-12-04 14:12:01 +01:00
Kazhnuz Klappsthul b8ac8e7d51 fix: do not load databack if there isn't a list 2021-12-04 14:09:51 +01:00
Kazhnuz Klappsthul b670e456e4 fix: add data index 2021-12-04 13:52:59 +01:00
Kazhnuz Klappsthul 43f7277dab feat: re-add gamesystem 2021-12-04 13:46:28 +01:00
Kazhnuz Klappsthul a4045ba456 chore: use Radiance launchers 2021-12-04 13:46:20 +01:00
Kazhnuz Klappsthul c5c8897aa6 improvement: use Radiance's birb 2021-12-04 13:18:54 +01:00
Kazhnuz Klappsthul 8ade1a1f93 improvement: replace with Birb version of Radiance 2021-12-04 13:18:32 +01:00
Kazhnuz Klappsthul f347f47aab fix: port the option menu to the new menusystem 2021-01-30 09:19:37 +01:00
Kazhnuz Klappsthul e8b796f978 fix: port to the new menusystem the pause menu 2021-01-30 09:19:22 +01:00
Kazhnuz Klappsthul 150aad86f1 fix: port mainMenu to the new Scene:start() API 2021-01-30 09:18:59 +01:00
Kazhnuz Klappsthul baa5a24ce6 fix: initial ports of the basic scenes 2021-01-30 09:18:07 +01:00
Kazhnuz Klappsthul 8f1c326e6a fix: reset view on page change 2021-01-29 21:54:34 +01:00
Kazhnuz Klappsthul f8910aefa4 feat(textwidget): label replacement 2021-01-24 15:44:24 +01:00
Kazhnuz Klappsthul af6ceef38d improvement: add a way to start a scene after init 2021-01-24 15:44:07 +01:00
Kazhnuz Klappsthul d3350e3938 feat: add a way to apply volume 2021-01-24 15:43:46 +01:00
Kazhnuz Klappsthul 99952487a9 fix: port main menu to textmenu 2021-01-23 18:31:40 +01:00
Kazhnuz Klappsthul 870a4f7118 feat: add a basic text menu 2021-01-23 18:30:45 +01:00
Kazhnuz Klappsthul 772becc1a8 feat(textwidget): extend API 2021-01-23 18:30:30 +01:00
Kazhnuz Klappsthul 92c10440a1 fix: search global asset only if there is no local 2021-01-23 11:28:40 +01:00
Kazhnuz Klappsthul e5d8e699bc feat(asset): fail when an asset doesn't exist 2021-01-17 12:44:40 +01:00
Kazhnuz Klappsthul b22cc2159f feat: add a fail log function 2021-01-17 12:44:25 +01:00
Kazhnuz Klappsthul 0f4b6daf73 feat: add padding to text widgets 2020-12-05 21:20:20 +01:00
Kazhnuz Klappsthul 72829eb02a feat: add multi-label support in text widget 2020-12-05 09:27:40 +01:00
Kazhnuz Klappsthul 49509001ab feat: add asset access to widgets 2020-12-05 09:23:46 +01:00
Kazhnuz Klappsthul 93bbf56047 chore: port the main menu to the new system 2020-12-05 09:02:42 +01:00
Kazhnuz Klappsthul abfda56b14 feat: give the menu name to widgets 2020-12-05 09:02:22 +01:00
Kazhnuz Klappsthul 3ae96e4cfc feat: add a page system to menus 2020-12-05 09:01:41 +01:00
Kazhnuz Klappsthul e2d029ab0f feat: add a function to get a menu 2020-12-04 20:55:01 +01:00
Kazhnuz Klappsthul bb6cf14437 chore:move around menus sub-objects 2020-12-04 13:16:32 +01:00
Kazhnuz Klappsthul a72dfc0711 feat: refactor most menus 2020-12-04 12:57:24 +01:00
Kazhnuz Klappsthul 7e697c3628 feat: add drawWidget
Let the widget handle if its selected or not
2020-12-04 12:55:48 +01:00
Kazhnuz Klappsthul 37fc1fc9be feat: add a selected color for text widgets 2020-12-04 12:54:57 +01:00
Kazhnuz Klappsthul 4ff85e2cc1 feat: add views for 1D and 2D menus 2020-12-04 12:00:43 +01:00
Kazhnuz Klappsthul 89bbf5fff2 feat: add a getter for selected widget 2020-12-04 12:00:28 +01:00
Kazhnuz Klappsthul 876d30671d feat(math): add a basic wrap and limit function 2020-12-04 11:59:32 +01:00
Kazhnuz Klappsthul 12b4b3fbc1 feat(menumodel): add a widget limit 2020-11-29 12:50:07 +01:00
Kazhnuz Klappsthul a3e2da3972 fix(menumodel): fix for loop 2020-11-29 12:43:52 +01:00
Kazhnuz Klappsthul b1cd9a6683 chore: refactor widget list in a menumodel class 2020-11-28 18:32:49 +01:00
Kazhnuz Klappsthul d9b8b71672 chore: separate widgets into three files 2020-11-28 15:27:25 +01:00
Kazhnuz Klappsthul 7e7cfe3763 chore: create a generic guiElement 2020-11-28 14:17:48 +01:00
Kazhnuz Klappsthul dca462803f chore: make the code more readable in menumanager 2020-11-27 19:35:00 +01:00
Kazhnuz Klappsthul 74d8e904b2 chore: put all menus in their own subfolder 2020-11-27 17:00:39 +01:00
Kazhnuz Klappsthul 4b66d15014 chore: port actors to rect and box 2020-11-27 16:03:07 +01:00
Kazhnuz Klappsthul 82cf59588a chore: port menu to rect 2020-11-27 16:02:54 +01:00
Kazhnuz Klappsthul e58f197049 feat: initial version of physical entities for 3D 2020-11-27 16:02:39 +01:00
Kazhnuz Klappsthul cf1928444f fix: remove some problems in point and rects 2020-11-27 16:02:21 +01:00
Kazhnuz Klappsthul fb55c9e706 chore: extract shapes from actor3D 2020-11-27 11:15:57 +01:00
Kazhnuz Klappsthul c3ee812d1a chore: put automove in physics mixin
Fixes #54
2020-11-26 21:08:29 +01:00
Kazhnuz Klappsthul dcc2965431 chore: simplify hitbox applciation 2020-11-26 20:54:16 +01:00
Kazhnuz Klappsthul 9eb0d321c8 chore: improve semantics
- Use "apply" when you apply collision, and not check
- Use "AtPoint" when you check at a point
2020-11-26 20:41:02 +01:00
Kazhnuz Klappsthul b2623cdb6a chore: refactor hitbox adding 2020-11-26 20:29:59 +01:00
Kazhnuz Klappsthul f30fc6346d chore: initialize the hitbox with the physics 2020-11-26 20:18:26 +01:00
Kazhnuz Klappsthul 9993221e0d improvement: use directly a table for box attr 2020-11-26 20:16:19 +01:00
Kazhnuz Klappsthul b071547630 chore: let the hitbox handle the scaling 2020-11-26 20:12:05 +01:00
Kazhnuz Klappsthul 92c08e30ee chore: pack and unpack the coordinates
It'll allow us to unify the hitbox loading system
2020-11-26 19:41:13 +01:00
Kazhnuz Klappsthul 79902a097f chore: extract physics as a mixins
Fixes #52
2020-11-26 19:16:15 +01:00
Kazhnuz Klappsthul 5393d16007 chore: divide simple target into mixins 2020-11-26 18:40:25 +01:00
Kazhnuz Klappsthul b97d320dc7 chore: prepare for division in mixins 2020-11-25 13:30:10 +01:00
Kazhnuz Klappsthul 730d89a76c feat: add basic reusable 2D objects
Fixes #51
2020-11-25 13:29:27 +01:00
Kazhnuz Klappsthul 124a228d3b feat: add a 3D middle point function 2020-11-25 13:02:11 +01:00
Kazhnuz Klappsthul 5837fd8b51 feat: add a global asset system 2020-11-13 19:11:09 +01:00
Kazhnuz Klappsthul c5c9f040bc chore: add asset types to their own folders 2020-11-13 17:51:12 +01:00
Kazhnuz Klappsthul 3b1097c917 chore: make SFX a soundObject too 2020-11-13 17:43:28 +01:00
Kazhnuz Klappsthul fed8ab4662 fix: make unintented local variables globals 2020-11-09 16:01:08 +01:00
Kazhnuz Klappsthul 6a66cff503 fix: fix missing vars 2020-11-09 15:59:57 +01:00
Kazhnuz Klappsthul 77311a803b fix: fix function getActorsInRect 2020-11-09 15:59:05 +01:00
Kazhnuz Klappsthul 982be45f1a fix: add globals 2020-11-09 15:58:30 +01:00
Kazhnuz Klappsthul 6bac6704f5 fix: use the right dimensions for fading 2020-08-09 15:06:25 +02:00
Kazhnuz Klappsthul e8e75ac4db improvement: manage music via core.music
Fix #43
2020-08-09 14:51:52 +02:00
Kazhnuz c946e582bd improvement(options): have default options in conf.lua 2020-05-10 14:21:45 +02:00
Kazhnuz 9a0db953ba feat(debug): add basic loggin framework 2020-05-10 14:06:20 +02:00
Kazhnuz 92cbda69a1 fix(actors): replace deprecated functions after the sprite transition 2020-05-10 11:38:50 +02:00
Kazhnuz 8b3a5f1f0c chore: extract the sprite of the actor 2020-05-10 11:14:51 +02:00
Kazhnuz b12108a260 Merge branch 'birb-refactor' of game-projects/gamecore into master 2020-04-05 18:54:33 +02:00
Kazhnuz f843d4f550 fix: use right names on conf file 2020-04-05 18:49:40 +02:00
Kazhnuz 5575b90271 meta: adapt readme 2020-04-05 18:48:57 +02:00
Kazhnuz ccbff45f21 meta: add the big changes to new version 2020-04-05 18:43:20 +02:00
Kazhnuz 9f4c057a27 chore: place the birb core in a separate folder 2020-04-05 18:39:08 +02:00
Kazhnuz b98e8dd291 fix: use the right option music name in exemples 2020-04-05 18:21:36 +02:00
Kazhnuz 4cedf30bfd chore: separate the exemple project 2020-04-05 18:18:13 +02:00
Kazhnuz d59fe10927 meta: rename as birb 2020-04-05 15:46:56 +02:00
Kazhnuz a83dceee80 feat(utils): add drawBorder function to utils 2019-11-14 19:50:26 +01:00
Kazhnuz ad295bf9c9 feat(fonts): add filter info functions 2019-09-23 13:51:53 +02:00
Kazhnuz 84919719f8 feat(exemple): add a transition when a scene is selected 2019-09-08 16:23:42 +02:00
Kazhnuz 4b24579070 feat(scenes): handle scene transitions 2019-09-08 16:23:30 +02:00
Kazhnuz 8385a69636 feat(screen): add screen transitions 2019-09-08 16:23:12 +02:00
Kazhnuz a1afa0821c feat(timer): add variable interpolation support via tween.lua 2019-09-08 16:18:32 +02:00
Kazhnuz 02bc52a49b feat(timer): add a switch system 2019-09-08 14:21:21 +02:00
Kazhnuz 8290fbb8d2 improvement(actors): use the new timers modules 2019-09-08 12:57:13 +02:00
Kazhnuz ab3d9abf9f feat(modules): new Timers modules 2019-09-08 12:56:59 +02:00
Kazhnuz eccaf77687 feat(example): add a respawn timer 2019-09-08 12:34:16 +02:00
Kazhnuz e40ea3cfab feat(modules): make modules loadable directly from core object 2019-09-08 12:24:57 +02:00
Kazhnuz c339129566 feat(screen): add scissoring functions 2019-09-07 21:53:14 +02:00
Kazhnuz 8e000dbc44 fix(input): improve key flushing 2019-09-07 21:51:20 +02:00
Kazhnuz 47c6bab698 fix(world): link the player to the right input source 2019-09-07 21:34:52 +02:00
Kazhnuz 8d524fb4db fix(input): fix a missing mention of "source" 2019-09-07 21:06:08 +02:00
Kazhnuz 077b1151f1 feat(world/cam): add a way to lock the camera 2019-09-07 21:04:35 +02:00
Kazhnuz 0fecc3a431 chore(actors/gfx): rework the gfx system to use animationEnded callback 2019-09-07 21:00:35 +02:00
Kazhnuz 60390ed1a7 feat(assets/animator): send the callback when the animation end 2019-09-07 20:59:44 +02:00
Kazhnuz e6f0315a8c feat(actors): listen to animationEnded callback from sprite clones
Fixes #38
2019-09-07 20:53:22 +02:00
Kazhnuz 76fb15f862 feat(assets/animator): handle sending callbacks when animation end 2019-09-07 20:52:20 +02:00
Kazhnuz f61f529302 fix(assets/animator): make sure that pauseAtEnd works as intended
Fixes #37
2019-09-07 20:46:00 +02:00
Kazhnuz 3a696ee58c fix(boxes/textured): use the right texture name
Fixes #40
2019-09-07 20:40:03 +02:00
Kazhnuz 77670d8ec0 fix(boxes): make sure that invisible f3D boxes are really invisibles 2019-09-07 20:38:41 +02:00
Kazhnuz b5059e848a fix(world): propagate maptype variables to the parent
Fixes #39
2019-09-07 20:36:06 +02:00
Kazhnuz b167c45530 fix(world3D): use the right variable name for creationID
Fixes #36
2019-09-07 20:32:21 +02:00
Kazhnuz ca721ec8ac feat(camera+map): add a way to add padding to map limits 2019-07-26 11:53:10 +02:00
Kazhnuz 9ea2d2ca40 feat(world): add a wrapper for maps new "getBox()" function 2019-07-26 11:43:54 +02:00
Kazhnuz 2da2ffd538 fix(game): replace love.filesystem.exists by utils.filesystem.exists 2019-07-24 15:24:06 +02:00
Kazhnuz 3e907b69d7 feat(core/input): extract virtualpads from the input controller 2019-07-24 15:22:04 +02:00
Kazhnuz 2e3fd587c0 chore: port every print to new debug mode 2019-07-24 11:21:32 +02:00
Kazhnuz 70d5fdfd8c chore: activate debug mode by default 2019-07-24 11:21:22 +02:00
Kazhnuz 4e9923b2ea feat(core): add a way to activate easily debug mode directly 2019-07-24 11:21:12 +02:00
Kazhnuz 543247e721 feat(core/debug): add log functions 2019-07-24 11:19:10 +02:00
Kazhnuz 88526282ea feat: add default gamesystem uses inside mainmenu 2019-07-24 10:44:03 +02:00
Kazhnuz df274f9dd0 feat: add default gamesystem 2019-07-24 10:43:41 +02:00
Kazhnuz e068acbc7b feat: add a basic gamesystem modules 2019-07-24 10:43:22 +02:00
Kazhnuz d8c0e62190 chore(world): extract map module from the world module
Fix #35
2019-07-22 22:38:19 +02:00
251 changed files with 8733 additions and 3338 deletions

15
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
"Lua.diagnostics.globals": [
"love",
"loadstring",
"unpack",
"framework",
"utils",
"core",
"scenes",
"game"
],
"Lua.diagnostics.disable": [
"redundant-parameter"
]
}

View File

@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
- Project renamed to Epervier Framework and rebased entirely on Sonic Radiance codebase
- New loading system
### Added
- Add a gamesystem module
- **core/debug:** new logging framework
- **camera+maps:** add a way to add padding to map limits
### Changed
- **world:** extract map module from the world module
- **core/input:** extract virtualpads from the input controller
- **core:** The core is now separated from the rest of the framework
- **core+assets:** Music are now managed directly by the core
## [0.6.0] - 2019-07-20
- Meta: Add proper crediting

View File

@ -17,3 +17,5 @@
- [Tsort](https://github.com/bungle/lua-resty-tsort), under BSD-2 Clause
- [Simple Tiled Implementation](https://github.com/karai17/Simple-Tiled-Implementation), under MIT Licence
- [tween.lua](https://github.com/kikito/tween.lua), under MIT Licence

View File

@ -1,44 +1,40 @@
# gamecore
# Épervier Framework
Gamecore aim to be an integrated, simple core system for love2D. It aim to make work in a integrated way several managers to automatically handle inputs, screen, and several utilities to make game developpement easier and less repetitive.
The Épervier Framework is an RPG-oriented framework for Love2D. It aim to work as a set of managers to automatically handle inputs, screen, and several utilities to make game developpement easier and less repetitive. It's also specialized in game with RPG mechanics, with functions to serialize/deserialize easily datas.
Gamecore use [Classic](https://github.com/rxi/classic/) as its base Object
Épervier use [Classic](https://github.com/rxi/classic/) as its base Object.
## How to load GameCore
## Core features
To load gamecore, you basically need the following code.
Épervier provide a lot of feature that can be usefull to create an RPG. This is a non-exhaustive list of what the framework can do :
````
Core = require "gamecore"
- Scene system to be able to change your gameplay easily, with transitions
- Easy data loading and parsing via the core.data module
- A save system using data serialization
- Tweening and time support via tween.lua
- A world system with support for camera, multiple hitbox per actor, and two type of physics (bump2D and bump3D) and tiled map loading (via sti.lua)
- A GUI system to make your game more easily have HUD and menus
- Several utilities functions
function love.load()
core = Core()
## How to load Épervier
The framework must be located in the `framework/` folder to work. After that, all you have to do is to load a gamecore based engine and then.
Note : the `framework`, `core`, `game` and `utils` global namespaces will be used by the framework.
```lua
require "framework"
function love.load(args)
framework.start("game", args)
end
````
```
Then you have to create some scene object,
### Launch in debug mode
## Gamecore managers
To launch in debug mode, the love2D game must be launched with a DEBUGLEVEL bigger than 1, for instance :
- Debug
- Input
- Lang
- Options
- Screen
- Scene Manager
## GameCore modules
Modules are utilies that you can load everywhere in your code and that aren't loaded specifically inside the core.
- Scene Object
- Assets
- Menu System
```sh
love ./examples DEBUGLEVEL=4
```

View File

@ -1,41 +0,0 @@
function love.conf(t)
t.identity = "space.kazhnuz.GameCore" -- The name of the save directory (string)
t.version = "11.1" -- The LÖVE version this game was made for (string)
t.console = false -- Attach a console (boolean, Windows only)
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
t.window.title = "GameCore Example" -- The window title (string)
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
t.window.width = 424 -- The window width (number)
t.window.height = 240 -- The window height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)
t.window.resizable = false -- Let the window be user-resizable (boolean)
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)
t.window.minheight = 1 -- Minimum window height if the window is resizable (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.fullscreentype = "exclusive" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
t.window.vsync = true -- Enable vertical sync (boolean)
t.window.msaa = 0 -- The number of samples to use with multi-sampled antialiasing (number)
t.window.display = 1 -- Index of the monitor to show the window in (number)
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
t.modules.audio = true -- Enable the audio module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.joystick = true -- Enable the joystick module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.math = true -- Enable the math module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.physics = true -- Enable the physics module (boolean)
t.modules.sound = true -- Enable the sound module (boolean)
t.modules.system = true -- Enable the system module (boolean)
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
t.modules.touch = true -- Enable the touch module (boolean)
t.modules.video = true -- Enable the video module (boolean)
t.modules.window = true -- Enable the window module (boolean)
t.modules.thread = true -- Enable the thread module (boolean)
end

1
debug.sh Executable file
View File

@ -0,0 +1 @@
love ./examples DEBUGLEVEL=4

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 580 B

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

47
examples/conf.lua Normal file
View File

@ -0,0 +1,47 @@
function love.conf(t)
t.identity = "city.kobold.Birb" -- The name of the save directory (string)
t.version = "11.1" -- The LÖVE version this game was made for (string)
t.console = false -- Attach a console (boolean, Windows only)
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
t.gameversion = "0.7.0" -- The game version (different than love2D version)
t.window.title = "Birb Examples" -- The window title (string)
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
t.window.width = 424 -- The window internal width (number)
t.window.height = 240 -- The window internal height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)
t.window.resizable = false -- Let the window be user-resizable (boolean)
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)
t.window.minheight = 1 -- Minimum window height if the window is resizable (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.fullscreentype = "exclusive" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
t.window.vsync = true -- Enable vertical sync (boolean)
t.window.msaa = 0 -- The number of samples to use with multi-sampled antialiasing (number)
t.window.display = 1 -- Index of the monitor to show the window in (number)
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
t.window.resolution = 2 -- The default resolution
t.volume = {}
t.volume.music = 100 -- music audio volume
t.volume.sfx = 100 -- sfx audio volume
t.modules.audio = true -- Enable the audio module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.joystick = true -- Enable the joystick module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.math = true -- Enable the math module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.physics = true -- Enable the physics module (boolean)
t.modules.sound = true -- Enable the sound module (boolean)
t.modules.system = true -- Enable the system module (boolean)
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
t.modules.touch = true -- Enable the touch module (boolean)
t.modules.video = true -- Enable the video module (boolean)
t.modules.window = true -- Enable the window module (boolean)
t.modules.thread = true -- Enable the thread module (boolean)
end

View File

@ -0,0 +1 @@
return {}

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

1
examples/framework Symbolic link
View File

@ -0,0 +1 @@
../framework/

9
examples/game/init.lua Normal file
View File

@ -0,0 +1,9 @@
local GameSystem = require "framework.gamesystem"
local Game = GameSystem:extend()
function Game:new()
Game.super.new(self)
self.currentSlot = 1
end
return Game

View File

@ -1,13 +0,0 @@
return {
["idle"] = {
{
{"main", 0, 0, 0, 16, 16, 24, true}
}
},
["punch"] = {
{
{"main", 0, 0, 0, 16, 16, 24, true},
{"punch", 16, 2, 6, 12, 12, 12, false}
}
}
}

View File

@ -1,13 +0,0 @@
return {
["idle"] = {
{
{"main", 0, 0, 16, 24, true}
}
},
["punch"] = {
{
{"main", 0, 0, 16, 24, true},
{"punch", 16, 6, 12, 12, false}
}
}
}

View File

@ -1,12 +0,0 @@
return {
MainMenu = require "examples.mainmenu",
Test = require "examples.basic.test_scene",
Test2 = require "examples.basic.test_scene2",
TestMenu = require "examples.basic.test_menus",
Inventory = require "examples.menus.inventory",
Options = require "examples.menus.options",
MovePlayer = require "examples.gameplay.moveplayer",
MovePlayer3D = require "examples.gameplay.moveplayer3D",
Action3D = require "examples.gameplay.action3D",
Plateformer = require "examples.gameplay.plateform"
}

View File

@ -21,11 +21,12 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
Core = require "gamecore"
examples = require "examples"
require "framework"
function love.load()
core = Core()
scenes = require "scenes"
examples.MainMenu()
function love.load(args)
print(utils.table.toString(args))
framework.start("game", args)
scenes.MainMenu()
end

View File

@ -1,148 +0,0 @@
-- scenes/mainmenu :: the main menu of the different gamecore examples
--[[
Copyright © 2019 Kazhnuz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local MainMenu = Scene:extend()
local ListBox = require "gamecore.modules.menusystem.listbox"
local Widget = require "gamecore.modules.menusystem.widgets"
local SubMenuWidget = Widget.Text:extend()
local SceneWidget = Widget.Text:extend()
local ExitWidget = Widget.Text:extend()
function MainMenu:new()
MainMenu.super.new(self)
self.assets:batchImport("examples.mainmenu.assets")
self:addMenu("main", true)
for i=1, 4 do
local name = i .. "player"
self:addSubMenu(name, name)
if i == 1 then
self:addScene(name, examples.Plateformer, "plateform", i)
end
self:addScene(name, examples.MovePlayer, "topdown", i)
self:addScene(name, examples.MovePlayer3D, "topdown3D", i)
self:addScene(name, examples.Action3D, "bigmap3D", i)
if i > 1 then
self:addScene(name, examples.MovePlayer, "topdown (zoom)", i, "zoom")
self:addScene(name, examples.MovePlayer3D, "topdown3D (zoom)", i, "zoom")
end
end
self:addSubMenu("menus", "menu")
self:addScene("menus", examples.Inventory, "inventory")
self:addScene("menus", examples.Options, "options")
self.menusystem:setSoundFromSceneAssets("navigate")
ExitWidget(self, "main")
self.menusystem:switchMenu("main")
end
-- MENU FUNCTION
-- Functions that serve the handling of menus
function MainMenu:addMenu(name, nobackbutton)
local screenHeight, screenWidth = core.screen:getDimensions()
local w, h = 424/2, 240 - 48
local x, y = w / 2, 24
ListBox(self.menusystem, name, x, y, w, h, 8)
end
function MainMenu:addSubMenu(name, fullname)
self:addMenu(name)
SubMenuWidget(self, "main", name, fullname)
SubMenuWidget(self, name, "main", "back", 1)
end
function MainMenu:addScene(submenu, scene, fullname, arg1, arg2, arg3, arg4, arg5)
local args = {arg1, arg2, arg3, arg4, arg5}
SceneWidget(self, submenu, scene, fullname, args)
end
function MainMenu:draw()
love.graphics.setColor(.3, .1, .4, 1)
love.graphics.rectangle("fill", 0, 0, 424, 240)
end
-- WIDGETS
-- Widgets used by menus
-- Submenu widget :: go to a submenu
function SubMenuWidget:new(scene, menu, newmenu, fullname, order)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.newmenu = newmenu
local label = ""
if fullname == "back" then
label = core.lang:translate("commons", fullname)
self.sfx = "cancel"
else
label = core.lang:translate("mainmenu", fullname)
self.sfx = "confirm"
end
SubMenuWidget.super.new(self, widgetmenu, font, label)
self.order = order or 0
end
function SubMenuWidget:action()
self.scene.assets:playSFX(self.sfx)
self.scene.menusystem:switchMenu(self.newmenu)
end
-- Scene widget :: switch scene
function SceneWidget:new(scene, menu, newscene, fullname, args)
self.scene = scene
self.args = args
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.newscene = newscene
local label = core.lang:translate("mainmenu", fullname)
SceneWidget.super.new(self, widgetmenu, font, label)
end
function SceneWidget:action()
core.scenemanager:storeCurrentScene("mainmenu")
self.newscene(self.args[1], self.args[2], self.args[3], self.args[4], self.args[5])
end
-- Exit Widget : exit the examples
function ExitWidget:new(scene, menu)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:translate("commons", "exit")
SceneWidget.super.new(self, widgetmenu, font, label)
end
function ExitWidget:action()
love.event.quit()
end
return MainMenu

View File

@ -21,13 +21,13 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local TestScene = Scene:extend()
local MenuType = require "gamecore.modules.menusystem.listbox"
local MenuType2 = require "gamecore.modules.menusystem.flowbox"
local MenuType3 = require "gamecore.modules.menusystem.grid"
local Widget = require "gamecore.modules.menusystem.widgets"
local MenuType = require "framework.scenes.gui.menus.listbox"
local MenuType2 = require "framework.scenes.gui.menus.flowbox"
local MenuType3 = require "framework.scenes.gui.menus.grid"
local Widget = require "framework.scenes.gui.menus.widgets"
local MenuWidget = Widget.Text:extend()
@ -37,39 +37,39 @@ function TestScene:new()
MenuType(self.menusystem, "testMenu1", 32, 32, 100, 24*8, 4)
MenuWidget(self, "testMenu1", "text_menu1")
Widget.Base(self.menusystem.menus["testMenu1"])
Widget.Base(self.menusystem.menus["testMenu1"])
Widget.Base(self.menusystem.menus["testMenu1"])
Widget.Base(self.menusystem.menus["testMenu1"])
Widget.Base(self.menusystem.menus["testMenu1"])
Widget.Base("testMenu1")
Widget.Base("testMenu1")
Widget.Base("testMenu1")
Widget.Base("testMenu1")
Widget.Base("testMenu1")
MenuType2(self.menusystem, "testMenu2", 164, 32, 24*8, 24*2, 8, 2)
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base(self.menusystem.menus["testMenu2"])
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
Widget.Base("testMenu2")
MenuType3(self.menusystem, "testMenu3", 164, 32 + 72, 24*8, 24*5, 8, 5)
Widget.Base(self.menusystem.menus["testMenu3"])
Widget.Base(self.menusystem.menus["testMenu3"])
Widget.Base(self.menusystem.menus["testMenu3"])
Widget.Base(self.menusystem.menus["testMenu3"])
Widget.Base("testMenu3")
Widget.Base("testMenu3")
Widget.Base("testMenu3")
Widget.Base("testMenu3")
self.menusystem.menus["testMenu3"]:addSlot(1, 0, 0, 4, 3)
self.menusystem.menus["testMenu3"]:addSlot(2, 0, 3, 5, 2)
self.menusystem.menus["testMenu3"]:addSlot(3, 5, 0, 3, 1)
@ -120,7 +120,7 @@ end
function TestScene:addTextWidget(menu, number)
for i=1, number do
Widget.Text(self.menusystem.menus[menu], self.assets.fonts["medium"], "lorem ipsum " .. i)
Widget.Text(menu, "medium", "lorem ipsum " .. i)
end
end
@ -131,10 +131,8 @@ end
function MenuWidget:new(scene, menu, newmenu)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.newmenu = newmenu
MenuWidget.super.new(self, widgetmenu, font, newmenu)
MenuWidget.super.new(self, menu, "menu", newmenu)
end
function MenuWidget:action()

View File

@ -21,7 +21,7 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local TestScene = Scene:extend()
function TestScene:new()
@ -37,9 +37,9 @@ end
function TestScene:mousepressed(x, y)
if (x > 424/2) then
core.scenemanager:storeCurrentScene("pausedScene")
examples.Test2()
scenes.Test2()
else
examples.TestMenu()
scenes.TestMenu()
end
end

View File

@ -1,4 +1,4 @@
local Parent = require "examples.basic.test_scene2.actors.parent"
local Parent = require "scenes.basic.test_scene2.actors.parent"
local Explosion = Parent:extend()
function Explosion:new(world, x, y)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Parent = Base:extend()
function Parent:new(world, type, x, y, w, h)

View File

@ -1,4 +1,4 @@
local folder = "examples/basic/test_scene2/"
local folder = "scenes/basic/test_scene2/"
return {
["images"] = {

View File

@ -21,22 +21,22 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local TestScene = Scene:extend()
local folder = "examples/basic/test_scene2/"
local folder = "scenes/basic/test_scene2/"
local World = require "gamecore.modules.world.baseworld"
local World = require "framework.scenes.world.baseworld"
function TestScene:new()
TestScene.super.new(self)
self.assets:batchImport("examples.basic.test_scene2.assets")
self.assets:batchImport("scenes.basic.test_scene2.assets")
self.i = 0
self.estImpair = false
World(self, "examples.basic.test_scene2.actors")
World(self, "scenes.basic.test_scene2.actors")
self.world:newActor("explosion", 12, 12)
self.world:newActor("explosion", 1, 78)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Box = Base:extend()
function Box:new(world, x, y, z)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Coin = Base:extend()
function Coin:new(world, x, y, z)

View File

@ -0,0 +1,13 @@
return {
["idle"] = {
{
{"main", {0, 0, 0, 16, 16, 24}, true}
}
},
["punch"] = {
{
{"main", {0, 0, 0, 16, 16, 24}, true},
{"punch", {16, 2, 6, 12, 12, 12}, false}
}
}
}

View File

@ -5,7 +5,7 @@ local cwd = (...):gsub('%.init$', '') .. "."
Obj.Player = require(cwd .. "player")
Obj.Box = require(cwd .. "box")
Obj.Coin = require(cwd .. "coin")
Obj.GFX = require("gamecore.modules.world.actors.gfx3D")
Obj.GFX = require("framework.scenes.world.actors.gfx3D")
Obj.index = {}
Obj.index["player"] = Obj.Player

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Parent = Base:extend()
function Parent:new(world, type, x, y, z, w, h, d, isSolid)

View File

@ -6,9 +6,8 @@ function Player:new(world, x, y, z, id)
Player.super.new(self, world, "player", x, y, 0, 16, 16, 24, true)
self:setGravity(480)
self:setSprite("player", 8, 12)
self:cloneSprite()
self:setHitboxFile("examples.gameplay.action3D.actors.hitboxes.player")
self:setSprite("player", true, 8, 12)
self:setHitboxFile("scenes.gameplay.action3D.actors.hitboxes.player")
end
function Player:updateStart(dt)
@ -49,19 +48,19 @@ end
function Player:setAnimation()
local gsp = utils.math.pointDistance(0, 0, self.xsp, self.ysp)
self:setCustomSpeed(math.abs(gsp) / 12)
self.sprite:setCustomSpeed(math.abs(gsp) / 12)
self:setDirection(self.xsp)
if (self.isPunching) then
self:changeAnimation("punch", false)
self.sprite:changeAnimation("punch", false)
else
if (self.onGround) then
if (math.abs(self.xsp) > 0) or (math.abs(self.ysp) > 0) then
self:changeAnimation("walk", false)
self.sprite:changeAnimation("walk", false)
else
self:changeAnimation("idle", true)
self.sprite:changeAnimation("idle", true)
end
else
self:changeAnimation("jump", true)
self.sprite:changeAnimation("jump", true)
end
end
end
@ -71,7 +70,7 @@ function Player:setDirection(direction)
if direction ~= 0 then
direction = utils.math.sign(direction)
self.direction = direction
self:setSpriteScallingX(direction)
self.sprite:setScalling(direction, nil)
end
end

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Wall = Base:extend()
function Wall:new(world, x, y, z, w, h, d)

View File

@ -21,19 +21,19 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local MovePlayer = Scene:extend()
local World = require "gamecore.modules.world.world3D"
local World = require "framework.scenes.world.world3D"
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
local cameraMode = cameraMode or "split"
MovePlayer.super.new(self)
self.assets:batchImport("examples.gameplay.plateform.assets")
self.assets:batchImport("scenes.gameplay.plateform.assets")
World(self, "examples.gameplay.action3D.actors", "datas/maps/action3D/map.lua")
World(self, "scenes.gameplay.action3D.actors", "datas/maps/action3D/map.lua")
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Parent = Base:extend()
function Parent:new(world, type, x, y, w, h, isSolid)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Wall = Base:extend()
function Wall:new(world, x, y, w, h)

View File

@ -21,10 +21,10 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local MovePlayer = Scene:extend()
local World = require "gamecore.modules.world.world2D"
local World = require "framework.scenes.world.world2D"
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
@ -32,7 +32,7 @@ function MovePlayer:new(playerNumber, cameraMode)
MovePlayer.super.new(self)
World(self, "examples.gameplay.moveplayer.actors", "datas/maps/topdown/arena.lua")
World(self, "scenes.gameplay.moveplayer.actors", "datas/maps/topdown/arena.lua")
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Parent = Base:extend()
function Parent:new(world, type, x, y, z, w, h, d, isSolid)

View File

@ -6,8 +6,7 @@ function Player:new(world, x, y, z, id)
Player.super.new(self, world, "player", x, y, 0, 16, 16, 24, true)
self:setGravity(480)
self:setSprite("player", 8, 12)
self:cloneSprite()
self:setSprite("player", true, 8, 12)
end
function Player:updateStart(dt)
@ -37,19 +36,19 @@ end
function Player:setAnimation()
local gsp = utils.math.pointDistance(0, 0, self.xsp, self.ysp)
self:setCustomSpeed(math.abs(gsp) / 12)
self.sprite:setCustomSpeed(math.abs(gsp) / 12)
self:setDirection(self.xsp)
if (self.isPunching) then
self:changeAnimation("punch", false)
self.sprite:changeAnimation("punch", false)
else
if (self.onGround) then
if (math.abs(self.xsp) > 0) or (math.abs(self.ysp) > 0) then
self:changeAnimation("walk", false)
self.sprite:changeAnimation("walk", false)
else
self:changeAnimation("idle", true)
self.sprite:changeAnimation("idle", true)
end
else
self:changeAnimation("jump", true)
self.sprite:changeAnimation("jump", true)
end
end
end
@ -59,7 +58,7 @@ function Player:setDirection(direction)
if direction ~= 0 then
direction = utils.math.sign(direction)
self.direction = direction
self:setSpriteScallingX(direction)
self.sprite:setScalling(direction, nil)
end
end

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Base = require "framework.scenes.world.actors.actor3D"
local Wall = Base:extend()
function Wall:new(world, x, y, z, w, h, d)

View File

@ -21,19 +21,19 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local MovePlayer = Scene:extend()
local World = require "gamecore.modules.world.world3D"
local World = require "framework.scenes.world.world3D"
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
local cameraMode = cameraMode or "split"
MovePlayer.super.new(self)
self.assets:batchImport("examples.gameplay.plateform.assets")
self.assets:batchImport("scenes.gameplay.plateform.assets")
World(self, "examples.gameplay.moveplayer3D.actors", "datas/maps/topdown/arena.lua")
World(self, "scenes.gameplay.moveplayer3D.actors", "datas/maps/topdown/arena.lua")
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Coin = Base:extend()
function Coin:new(world, x, y)

View File

@ -0,0 +1,13 @@
return {
["idle"] = {
{
{"main", {0, 0, 16, 24}, true}
}
},
["punch"] = {
{
{"main", {0, 0, 16, 24}, true},
{"punch", {16, 6, 12, 12}, false}
}
}
}

View File

@ -4,7 +4,7 @@ local Obj = {}
local cwd = (...):gsub('%.init$', '') .. "."
Obj.Player = require(cwd .. "player")
Obj.GFX = require("gamecore.modules.world.actors.gfx2D")
Obj.GFX = require("framework.scenes.world.actors.gfx2D")
Obj.index = {}
Obj.index["player"] = require(cwd .. "player")

View File

@ -1,17 +1,18 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Player = Base:extend()
function Player:new(world, x, y, id)
Player.super.new(self, world, "player", x, y, 16, 24, true)
self:setSprite("player", 8, 12)
self:cloneSprite()
self:setSprite("player", true, 8, 12)
self:setGravity(480)
self.isPunching = false
self.direction = 1
self.startx, self.starty = self.x, self.y
self.isDead = false
self.punchName = ""
self:setHitboxFile("examples.gameplay.plateform.actors.hitboxes.player")
self:setHitboxFile("scenes.gameplay.plateform.actors.hitboxes.player")
end
function Player:updateStart(dt)
@ -39,7 +40,7 @@ function Player:updateStart(dt)
end
if (self.isPunching) then
self:checkHitboxesCollisions()
self:applyHitboxesCollisions()
end
if self.keys["start"].isPressed then
@ -55,21 +56,28 @@ end
function Player:updateEnd(dt)
self:setAnimation()
local width, height = self.world:getDimensions()
if (self.y > height + self.h) and (self.isDead == false) then
self:addTimer("respawn", 1)
self.isDead = true
end
end
function Player:setAnimation()
self:setCustomSpeed(math.abs(self.xsp) / 12)
self.sprite:setCustomSpeed(math.abs(self.xsp) / 12)
if (self.isPunching) then
self:changeAnimation("punch", false)
self.sprite:changeAnimation("punch", false)
else
if (self.onGround) then
if math.abs(self.xsp) > 0 then
self:changeAnimation("walk", false)
self.sprite:changeAnimation("walk", false)
else
self:changeAnimation("idle", true)
self.sprite:changeAnimation("idle", true)
end
else
self:changeAnimation("jump", true)
self.sprite:changeAnimation("jump", true)
end
end
end
@ -79,7 +87,16 @@ function Player:setDirection(direction)
if direction ~= 0 then
direction = utils.math.sign(direction)
self.direction = direction
self:setSpriteScallingX(direction)
self.sprite:setScallingX(direction)
end
end
function Player:timerResponse(timer)
if timer == "respawn" then
self.x, self.y = self.startx, self.starty
self.xspeed = 0
self.yspeed = 0
self.isDead = false
end
end

View File

@ -1,4 +1,4 @@
local Base = require "gamecore.modules.world.actors.actor2D"
local Base = require "framework.scenes.world.actors.actor2D"
local Wall = Base:extend()
function Wall:new(world, x, y, w, h)

View File

@ -21,39 +21,39 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Scene = require "gamecore.modules.scenes"
local Scene = require "framework.scenes"
local Plateformer = Scene:extend()
local World = require "gamecore.modules.world.world2D"
local Pause = require "examples.gameplay.plateform.pause"
local World = require "framework.scenes.world.world2D"
local Pause = require "scenes.gameplay.plateform.pause"
function Plateformer:new()
Plateformer.super.new(self)
local folder = "examples.gameplay.plateform"
local folder = "scenes.gameplay.plateform"
self.assets:batchImport("examples.gameplay.plateform.assets")
self.assets:batchImport("scenes.gameplay.plateform.assets")
World(self, folder .. ".actors", "datas/maps/plateformer/platformer.lua")
Pause(self)
self.menusystem:deactivate()
self.menusystem:lockWorldWhenActive(true)
self.menusystem:lockAssetsWhenActive(true)
--Pause(self)
--self.menusystem:deactivate()
--self.menusystem:lockWorldWhenActive(true)
--self.menusystem:lockAssetsWhenActive(true)
self.world:loadMap()
end
function Plateformer:restart()
self.menusystem:deactivate()
--self.menusystem:deactivate()
collectgarbage()
self.world:reset()
end
function Plateformer:update(dt)
if (self.menusystem.isActive == true) and self.sources[1].keys["start"].isPressed then
self.menusystem:deactivate()
end
--if (self.menusystem.isActive == true) and self.sources[1].keys["start"].isPressed then
--self.menusystem:deactivate()
--end
end
function Plateformer:draw()

View File

@ -1,5 +1,5 @@
local ListMenu = require "gamecore.modules.menusystem.listbox"
local Widget = require "gamecore.modules.menusystem.widgets"
local ListMenu = require "framework.scenes.gui.menus.listbox"
local Widget = require "framework.scenes.gui.menus.widgets"
local PauseMenu = ListMenu:extend()
@ -7,26 +7,27 @@ local ResumeWidget = Widget.Text:extend()
local RestartWidget = Widget.Text:extend()
local ExitWidget = Widget.Text:extend()
local MENU_NAME = "PauseMenu"
function PauseMenu:new(scene)
self.scene = scene
local screenHeight, screenWidth = core.screen:getDimensions()
local w, h = 424/4, 240 - 48*4
local x, y = 3*w/2, 24*4
PauseMenu.super.new(self, scene.menusystem, "PauseMenu", x, y, w, h, 3)
PauseMenu.super.new(self, scene.menusystem, MENU_NAME, x, y, w, h, 3)
ResumeWidget(self)
RestartWidget(self)
ExitWidget(self)
ResumeWidget()
RestartWidget()
ExitWidget()
end
-- WIDGETS
-- All widgets used by the pause menu
function ResumeWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets.fonts["medium"]
function ResumeWidget:new()
self.scene = core.scenemanager:getScene()
local label = "resume"
ResumeWidget.super.new(self, menu, font, label)
ResumeWidget.super.new(self, MENU_NAME, "medium", label)
end
function ResumeWidget:action()
@ -34,11 +35,10 @@ function ResumeWidget:action()
self.scene.menusystem:deactivate()
end
function RestartWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets.fonts["medium"]
function RestartWidget:new()
self.scene = core.scenemanager:getScene()
local label = "restart"
RestartWidget.super.new(self, menu, font, label)
RestartWidget.super.new(self, MENU_NAME, "medium", label)
end
function RestartWidget:action()
@ -46,11 +46,10 @@ function RestartWidget:action()
self.scene:restart()
end
function ExitWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets.fonts["medium"]
function ExitWidget:new()
self.scene = core.scenemanager:getScene()
local label = "exit"
ExitWidget.super.new(self, menu, font, label)
ExitWidget.super.new(self, MENU_NAME, "medium", label)
end
function ExitWidget:action()

12
examples/scenes/init.lua Normal file
View File

@ -0,0 +1,12 @@
return {
MainMenu = require "scenes.mainmenu",
Test = require "scenes.basic.test_scene",
Test2 = require "scenes.basic.test_scene2",
TestMenu = require "scenes.basic.test_menus",
Inventory = require "scenes.menus.inventory",
Options = require "scenes.menus.options",
MovePlayer = require "scenes.gameplay.moveplayer",
MovePlayer3D = require "scenes.gameplay.moveplayer3D",
Action3D = require "scenes.gameplay.action3D",
Plateformer = require "scenes.gameplay.plateform"
}

Some files were not shown because too many files have changed in this diff Show More