Compare commits
137 Commits
Author | SHA1 | Date |
---|---|---|
Kazhnuz Klappsthul | 7fd8db592d | |
Kazhnuz Klappsthul | a5f075d5d2 | |
Kazhnuz Klappsthul | c64b9a42b7 | |
Kazhnuz Klappsthul | 5ab63a145a | |
Kazhnuz Klappsthul | 6d3c8de013 | |
Kazhnuz Klappsthul | d5f446f4ed | |
Kazhnuz Klappsthul | 69a567e4c2 | |
Kazhnuz Klappsthul | f3d175266b | |
Kazhnuz Klappsthul | f9b936a726 | |
Kazhnuz Klappsthul | 3cb6c61cac | |
Kazhnuz Klappsthul | eec43a522e | |
Kazhnuz Klappsthul | f892b1ce4e | |
Kazhnuz Klappsthul | de08fbd56b | |
Kazhnuz Klappsthul | 4722b734ed | |
Kazhnuz Klappsthul | a315fcebb5 | |
Kazhnuz Klappsthul | 5178ee0020 | |
Kazhnuz Klappsthul | c3179dcf9d | |
Kazhnuz Klappsthul | 8c4bcc70d5 | |
Kazhnuz Klappsthul | 2974d94df4 | |
Kazhnuz Klappsthul | fff87e8ebb | |
Kazhnuz Klappsthul | b8ac8e7d51 | |
Kazhnuz Klappsthul | b670e456e4 | |
Kazhnuz Klappsthul | 43f7277dab | |
Kazhnuz Klappsthul | a4045ba456 | |
Kazhnuz Klappsthul | c5c8897aa6 | |
Kazhnuz Klappsthul | 8ade1a1f93 | |
Kazhnuz Klappsthul | f347f47aab | |
Kazhnuz Klappsthul | e8b796f978 | |
Kazhnuz Klappsthul | 150aad86f1 | |
Kazhnuz Klappsthul | baa5a24ce6 | |
Kazhnuz Klappsthul | 8f1c326e6a | |
Kazhnuz Klappsthul | f8910aefa4 | |
Kazhnuz Klappsthul | af6ceef38d | |
Kazhnuz Klappsthul | d3350e3938 | |
Kazhnuz Klappsthul | 99952487a9 | |
Kazhnuz Klappsthul | 870a4f7118 | |
Kazhnuz Klappsthul | 772becc1a8 | |
Kazhnuz Klappsthul | 92c10440a1 | |
Kazhnuz Klappsthul | e5d8e699bc | |
Kazhnuz Klappsthul | b22cc2159f | |
Kazhnuz Klappsthul | 0f4b6daf73 | |
Kazhnuz Klappsthul | 72829eb02a | |
Kazhnuz Klappsthul | 49509001ab | |
Kazhnuz Klappsthul | 93bbf56047 | |
Kazhnuz Klappsthul | abfda56b14 | |
Kazhnuz Klappsthul | 3ae96e4cfc | |
Kazhnuz Klappsthul | e2d029ab0f | |
Kazhnuz Klappsthul | bb6cf14437 | |
Kazhnuz Klappsthul | a72dfc0711 | |
Kazhnuz Klappsthul | 7e697c3628 | |
Kazhnuz Klappsthul | 37fc1fc9be | |
Kazhnuz Klappsthul | 4ff85e2cc1 | |
Kazhnuz Klappsthul | 89bbf5fff2 | |
Kazhnuz Klappsthul | 876d30671d | |
Kazhnuz Klappsthul | 12b4b3fbc1 | |
Kazhnuz Klappsthul | a3e2da3972 | |
Kazhnuz Klappsthul | b1cd9a6683 | |
Kazhnuz Klappsthul | d9b8b71672 | |
Kazhnuz Klappsthul | 7e7cfe3763 | |
Kazhnuz Klappsthul | dca462803f | |
Kazhnuz Klappsthul | 74d8e904b2 | |
Kazhnuz Klappsthul | 4b66d15014 | |
Kazhnuz Klappsthul | 82cf59588a | |
Kazhnuz Klappsthul | e58f197049 | |
Kazhnuz Klappsthul | cf1928444f | |
Kazhnuz Klappsthul | fb55c9e706 | |
Kazhnuz Klappsthul | c3ee812d1a | |
Kazhnuz Klappsthul | dcc2965431 | |
Kazhnuz Klappsthul | 9eb0d321c8 | |
Kazhnuz Klappsthul | b2623cdb6a | |
Kazhnuz Klappsthul | f30fc6346d | |
Kazhnuz Klappsthul | 9993221e0d | |
Kazhnuz Klappsthul | b071547630 | |
Kazhnuz Klappsthul | 92c08e30ee | |
Kazhnuz Klappsthul | 79902a097f | |
Kazhnuz Klappsthul | 5393d16007 | |
Kazhnuz Klappsthul | b97d320dc7 | |
Kazhnuz Klappsthul | 730d89a76c | |
Kazhnuz Klappsthul | 124a228d3b | |
Kazhnuz Klappsthul | 5837fd8b51 | |
Kazhnuz Klappsthul | c5c9f040bc | |
Kazhnuz Klappsthul | 3b1097c917 | |
Kazhnuz Klappsthul | fed8ab4662 | |
Kazhnuz Klappsthul | 6a66cff503 | |
Kazhnuz Klappsthul | 77311a803b | |
Kazhnuz Klappsthul | 982be45f1a | |
Kazhnuz Klappsthul | 6bac6704f5 | |
Kazhnuz Klappsthul | e8e75ac4db | |
Kazhnuz | c946e582bd | |
Kazhnuz | 9a0db953ba | |
Kazhnuz | 92cbda69a1 | |
Kazhnuz | 8b3a5f1f0c | |
Kazhnuz | b12108a260 | |
Kazhnuz | f843d4f550 | |
Kazhnuz | 5575b90271 | |
Kazhnuz | ccbff45f21 | |
Kazhnuz | 9f4c057a27 | |
Kazhnuz | b98e8dd291 | |
Kazhnuz | 4cedf30bfd | |
Kazhnuz | d59fe10927 | |
Kazhnuz | a83dceee80 | |
Kazhnuz | ad295bf9c9 | |
Kazhnuz | 84919719f8 | |
Kazhnuz | 4b24579070 | |
Kazhnuz | 8385a69636 | |
Kazhnuz | a1afa0821c | |
Kazhnuz | 02bc52a49b | |
Kazhnuz | 8290fbb8d2 | |
Kazhnuz | ab3d9abf9f | |
Kazhnuz | eccaf77687 | |
Kazhnuz | e40ea3cfab | |
Kazhnuz | c339129566 | |
Kazhnuz | 8e000dbc44 | |
Kazhnuz | 47c6bab698 | |
Kazhnuz | 8d524fb4db | |
Kazhnuz | 077b1151f1 | |
Kazhnuz | 0fecc3a431 | |
Kazhnuz | 60390ed1a7 | |
Kazhnuz | e6f0315a8c | |
Kazhnuz | 76fb15f862 | |
Kazhnuz | f61f529302 | |
Kazhnuz | 3a696ee58c | |
Kazhnuz | 77670d8ec0 | |
Kazhnuz | b5059e848a | |
Kazhnuz | b167c45530 | |
Kazhnuz | ca721ec8ac | |
Kazhnuz | 9ea2d2ca40 | |
Kazhnuz | 2da2ffd538 | |
Kazhnuz | 3e907b69d7 | |
Kazhnuz | 2e3fd587c0 | |
Kazhnuz | 70d5fdfd8c | |
Kazhnuz | 4e9923b2ea | |
Kazhnuz | 543247e721 | |
Kazhnuz | 88526282ea | |
Kazhnuz | df274f9dd0 | |
Kazhnuz | e068acbc7b | |
Kazhnuz | d8c0e62190 |
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"Lua.diagnostics.globals": [
|
||||
"love",
|
||||
"loadstring",
|
||||
"unpack",
|
||||
"framework",
|
||||
"utils",
|
||||
"core",
|
||||
"scenes",
|
||||
"game"
|
||||
],
|
||||
"Lua.diagnostics.disable": [
|
||||
"redundant-parameter"
|
||||
]
|
||||
}
|
22
CHANGELOG.md
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
62
README.md
|
@ -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
|
||||
```
|
41
conf.lua
|
@ -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
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
return {}
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1 @@
|
|||
../framework/
|
|
@ -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
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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()
|
|
@ -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
|
||||
|
|
@ -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)
|
|
@ -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)
|
|
@ -1,4 +1,4 @@
|
|||
local folder = "examples/basic/test_scene2/"
|
||||
local folder = "scenes/basic/test_scene2/"
|
||||
|
||||
return {
|
||||
["images"] = {
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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)
|
|
@ -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
|
||||
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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
|
||||
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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")
|
|
@ -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
|
||||
|
|
@ -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)
|
|
@ -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()
|
|
@ -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()
|
|
@ -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"
|
||||
}
|