Tuto Gideros Game Template1 Part 1 Project Setup

From GiderosMobile
Revision as of 17:06, 25 October 2024 by MoKaLux (talk | contribs) (Created page with "__TOC__ == Project setup == Create a project and call it anything you want, eg.: "''Gideros_Game_Template1''" for example. In the project properties (right click your project...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Project setup

Create a project and call it anything you want, eg.: "Gideros_Game_Template1" for example.

In the project properties (right click your project name), in the Graphics tab, please enter your settings, eg.:

  • Scale Mode: Letterbox
  • Logical Dimensions: 360 * 640 px
  • Orientation: Landscape Left

Feel free to configure the other tabs.

Plugins

To have the basics of a game I added the following plugins:

  • JSON: to save user preferences to disk
  • Require: for Mobile support

You can double click the Require plugin and configure it to your liking.

We will add more Classes later on.

Files and Folders

This is how I would organise my files and folders:

Gideros_Game_Template1 (root)

  • Plugins
    • JSON
    • Require
  • Files
    • audio (folder)
    • classes (folder)
    • fonts (folder)
    • gfx (folder)
    • scenes (folder)
    • init.lua (file)
    • main.lua (file)


Let's add our first Classes/functions. In the folder classes add these two:

  • Media:buttonMonster.lua for player control and keyboard navigation (tip: right click and save link as)
  • to save data persistently, in the classes folder, create a file called "save_prefs.lua" and copy the following:
require "json"

function saveData(filepath, value)
	local contents = json.encode(value)
	local file = io.open(filepath, "w") -- create file
	file:write(contents) -- save json string in file
	io.close(file)
end

function getData(filepath)
	local value
	local file = io.open(filepath, "r")
	if file then
		local contents = file:read("*a") -- read contents
		value = json.decode(contents) -- decode json
		io.close(file)
	end
	return value
end

Assets

To build your personalized Game Template you will need some assets like sounds, fonts, ...

In this tutorial I will use my own assets and you will need to replace them with yours in both files and code.

Next?

That should be enough to get us started. In the next part we will code our init.lua file.


Next: Tuto Gideros Game Template1 Part 2 Init


Tutorial - Gideros Game Template1