Skip to content

Commit 7fc605d

Browse files
committed
Prima versione
1 parent 432dcad commit 7fc605d

28 files changed

+1036
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_build
2+
extensions/__pycache__

LICENSE.txt

+324
Large diffs are not rendered by default.

Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = ScopriamoGodot
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
# Scopriamo-Godot
2-
Una guida introduttiva a Godot per chi conosce Scratch
1+
# Scopriamo Godot!
2+
3+
Questo repository contiene i sorgenti della guida "Scopriamo Godot"
4+
5+
6+
## Licenza
7+
8+
Il materiale è distribuito sotto licenza Creative Commons Attribution 3.0 Unported license ([CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)) . Lo script pygment gdscript.py proviene dal ([repository originale di Godot Docs] (https://github.com/godotengine/godot-docs/) by "Juan Linietsky, Ariel Manzur and the Godot community"
9+
10+
Vedi [LICENSE.txt](/LICENSE.txt) per dettagli

_templates/layout.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{# Import the theme's layout. #}
2+
{% extends "!layout.html" %}
3+
4+
{% block extrahead %}
5+
6+
<script type="text/javascript">
7+
$(document).ready(function(){
8+
$('div.admonition.hint p.first.admonition-title').text("Soluzione (clicca per mostrare)")
9+
$('div.admonition.hint p.first.admonition-title').nextAll('p').slideToggle(0)
10+
$('div.admonition.hint p.first.admonition-title').nextAll('div.highlight-gdscript').slideToggle(0)
11+
$('div.admonition.hint p.first.admonition-title').click(function(){
12+
$(this).toggleClass('active');
13+
$(this).nextAll('p').slideToggle(1);
14+
$(this).nextAll('div.highlight-gdscript').slideToggle(1)
15+
});
16+
});
17+
</script>
18+
19+
{{ super() }}
20+
{% endblock %}

come_si_fa.rst

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
.. _ComeSiFa:
2+
3+
**********************
4+
Come si fa
5+
**********************
6+
7+
Questa sezione spiega come fare delle cose specifiche in Godot.
8+
9+
10+
Fare qualcosa se un tasto è premuto
11+
================================================
12+
13+
Per fare qualcosa quando si preme un tasto, bisogna innanzitutto configurare un'azione nel menu ``Progetto->Impostazioni Progetto->Mappa Input``:
14+
15+
.. figure:: img/Mappa_Input.png
16+
:alt: Mappa Input
17+
18+
Si scrive il nome dell'azione e si preme su ``Aggiungi``:
19+
20+
.. figure:: img/aggiungi_azione.png
21+
:alt: Aggiungi Azione
22+
23+
Poi si specifica il tasto:
24+
25+
.. figure:: img/aggiungi_tasto.png
26+
:alt: Aggiungi Tasto
27+
28+
.. figure:: img/premi_tasto.png
29+
:alt: Premi un Tasto
30+
31+
Infine, si può usare l'azione nel codice: ::
32+
33+
var colpisci = Input.is_action_pressed('colpisci')
34+
if colpisci:
35+
# fai qualcosa
36+
37+
.. IMPORTANT:: ci sono due funzioni simili: ``Input.is_action_pressed`` e ``Input.is_action_just_pressed``. La prima
38+
serve per controllare se il tasto è premuto. La seconda per controllare se è stato **appena** premuto. La prima funzione va
39+
bene ad esempio per i tasti freccia, perchè finchè il tasto è premuto, il personaggio si sposta. La seconda va bene per quando
40+
si attacca: ogni volta che viene premuto il tasto, il personaggio attacca
41+
42+
43+
Animazioni!
44+
================================================
45+
46+
In Godot per fare le animazioni si usano i Nodi di tipo `AnimatedSprite`.
47+
48+
Ad esempio per il gioco del Cavaliere Miaogico, usiamo il nodo `Animazioni`:
49+
50+
.. figure:: img/animazione/nodo_animazione.png
51+
:alt: Il nodo `Animazioni`
52+
53+
Cliccando sul nodo, possiamo vedere che una delle sue proprietà si chiama `Frames`. I `Frames` sono un pò come i costumi di Scratch, ma possono essere raggruppati in animazioni diverse. Cliccando sulla parte bassa della finestra di Godot, sulla parola `SpriteFrames`, vengono visualizzate tutte le animazioni presenti.
54+
Ad esempio per il gioco del Cavaliere Miaogico, ci sono animazioni diverse per l'attacco e la camminata; ognuna ha i suoi costumi:
55+
56+
.. figure:: img/animazione/frames.png
57+
:alt: Il frames
58+
59+
Per far partire un'animazione usiamo le funzioni `play()` e `stop()`. Ad esempio, nello script del Personaggio: ::
60+
61+
$Animazioni.play("camminata")
62+
$Animazioni.set_flip_h(true)
63+
64+
.. NOTE:: la funzione `set_flip_h(true)` serve per riflettere orizzontalmente l'animazione. Serve per poter usare la stessa animazione sia quando il Personaggio è rivolto verso destra che verso sinistra.
65+
66+
Aggiungere una "Camera"
67+
================================================
68+
69+
La ``Camera`` serve per inquadrare sempre il personaggio anche se il livello è più grande dello schermo
70+
71+
Per prima cosa bisogna aggiungere un nodo ``Camera2d`` al personaggio:
72+
73+
.. figure:: img/camera/camera.png
74+
:alt: Nodo Camera2d
75+
76+
Poi si configurano le opzioni. ``Current`` va impostato a ``On`` se si vuole che la ``Camera`` sia attiva. I ``Limiti`` servono per fare in modo che la ``Camera`` non inquadri mai oltre il bordo del livello. In questo esempio sono impostati a mano:
77+
78+
.. figure:: img/camera/camera_opzioni.png
79+
:alt: Opzioni Camera
80+
81+
82+
Disegnare il livello
83+
================================================
84+
85+
Per disegnare il livello bisogna agire sul nodo `TileMap`(letteralmente vuol dire "mappa di piastrelle"):
86+
87+
.. figure:: img/tilemap/nodo.png
88+
:alt: Nodo TileMap
89+
90+
Selezionando il nodo `TileMap` appaiono tante piastrelle diverse utilizzabili
91+
92+
.. NOTE:: le piastrelle le abbiamo preparate noi. Per prepararle bisogna fare un pò di passaggi, che spiegheremo in un altro "come si fa".
93+
94+
.. figure:: img/tilemap/seleziona-tile.png
95+
:alt: Seleziona Piastrella
96+
97+
Dopo aver selezionato una piastrella:
98+
99+
- con il tastro sinistro si aggiunge la piastrella al livello
100+
- con il tasto destro si cancella
101+
102+
il tasto sinistro / destro si possono anche tenere premuti, per essere più veloci.
103+
104+
105+
Usare i "segnali"
106+
================================================
107+
108+
In Godot alcuni nodi hanno la possibilità di mandare dei "segnali", che sono un pò come i messaggi di Scratch.
109+
In Godot però i messaggi non vengono inviati a tutti gli altri nodi. Bisogna collegarli. Per farlo, bisogna andare nella sezione "Nodo" del nodo. Ad esempio per il gioco del Cavaliere Miaogico, usiamo il nodo `Slash`
110+
111+
.. figure:: img/slash/seleziona_nodo.png
112+
:alt: Il nodo `Slash`
113+
114+
Scegliamo il segnale che ci interessa: `body_entered`, che vuol dire che un altro oggetto (in questo caso un nemico) è "entrato" nello slash (o viceversa):
115+
116+
.. figure:: img/slash/segnale.png
117+
:alt: Il segnale `body_entered`
118+
119+
E lo colleghiamo a una funzione. Godot è così gentile da creare per noi una funzione con un nome appropriato:
120+
121+
.. figure:: img/slash/metodo.png
122+
:alt: La scelta della funzione.
123+
124+
Infine possiamo fare qualcosa nella funzione, ad esempio: ::
125+
126+
func _on_Slash_body_entered(body):
127+
if "Alieno" in body.name:
128+
body.morto()
129+
queue_free()

conf.py

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
import os
16+
import sys
17+
# sys.path.insert(0, os.path.abspath('.'))
18+
19+
sys.path.append(os.path.abspath('extensions'))
20+
extensions = ['gdscript']
21+
22+
from gdscript import GDScriptLexer
23+
from sphinx.highlighting import lexers
24+
lexers['gdscript'] = GDScriptLexer()
25+
26+
27+
28+
# -- Project information -----------------------------------------------------
29+
30+
project = 'Scopriamo Godot'
31+
copyright = '2019, Antonio Castaldo D\'Ursi - CoderDojo Lissone - CC-BY-3.0'
32+
author = 'Antonio Castaldo D\'Ursi'
33+
34+
# The short X.Y version
35+
version = ''
36+
# The full version, including alpha/beta/rc tags
37+
release = ''
38+
39+
40+
# -- General configuration ---------------------------------------------------
41+
42+
# If your documentation needs a minimal Sphinx version, state it here.
43+
#
44+
# needs_sphinx = '1.0'
45+
46+
# Add any Sphinx extension module names here, as strings. They can be
47+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
48+
# ones.
49+
extensions = [
50+
'sphinx.ext.mathjax',
51+
]
52+
53+
# Add any paths that contain templates here, relative to this directory.
54+
templates_path = ['_templates']
55+
56+
# The suffix(es) of source filenames.
57+
# You can specify multiple suffix as a list of string:
58+
#
59+
# source_suffix = ['.rst', '.md']
60+
source_suffix = '.rst'
61+
62+
# The master toctree document.
63+
master_doc = 'index'
64+
65+
# The language for content autogenerated by Sphinx. Refer to documentation
66+
# for a list of supported languages.
67+
#
68+
# This is also used if you do content translation via gettext catalogs.
69+
# Usually you set "language" from the command line for these cases.
70+
language = 'it'
71+
72+
# List of patterns, relative to source directory, that match files and
73+
# directories to ignore when looking for source files.
74+
# This pattern also affects html_static_path and html_extra_path .
75+
exclude_patterns = []
76+
77+
# Pygments (syntax highlighting) style to use
78+
pygments_style = 'sphinx'
79+
highlight_language = 'gdscript'
80+
81+
82+
# -- Options for HTML output -------------------------------------------------
83+
84+
# The theme to use for HTML and HTML Help pages. See the documentation for
85+
# a list of builtin themes.
86+
#
87+
#html_theme = 'alabaster'
88+
html_theme = "sphinx_rtd_theme"
89+
90+
# Theme options are theme-specific and customize the look and feel of a theme
91+
# further. For a list of options available for each theme, see the
92+
# documentation.
93+
#
94+
# html_theme_options = {}
95+
96+
# Add any paths that contain custom static files (such as style sheets) here,
97+
# relative to this directory. They are copied after the builtin static files,
98+
# so a file named "default.css" will overwrite the builtin "default.css".
99+
html_static_path = ['_static']
100+
101+
# Custom sidebar templates, must be a dictionary that maps document names
102+
# to template names.
103+
#
104+
# The default sidebars (for documents that don't match any pattern) are
105+
# defined by theme itself. Builtin themes are using these templates by
106+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
107+
# 'searchbox.html']``.
108+
#
109+
# html_sidebars = {}
110+
111+
112+
# -- Options for HTMLHelp output ---------------------------------------------
113+
114+
# Output file base name for HTML help builder.
115+
htmlhelp_basename = 'ScopriamoGodotdoc'
116+
117+
118+
# -- Options for LaTeX output ------------------------------------------------
119+
120+
latex_elements = {
121+
# The paper size ('letterpaper' or 'a4paper').
122+
#
123+
# 'papersize': 'letterpaper',
124+
125+
# The font size ('10pt', '11pt' or '12pt').
126+
#
127+
# 'pointsize': '10pt',
128+
129+
# Additional stuff for the LaTeX preamble.
130+
#
131+
# 'preamble': '',
132+
133+
# Latex figure (float) alignment
134+
#
135+
# 'figure_align': 'htbp',
136+
}
137+
138+
# Grouping the document tree into LaTeX files. List of tuples
139+
# (source start file, target name, title,
140+
# author, documentclass [howto, manual, or own class]).
141+
latex_documents = [
142+
(master_doc, 'ScopriamoGodot.tex', 'Scopriamo Godot Documentation',
143+
'Antonio Castaldo D\'Ursi', 'manual'),
144+
]
145+
146+
147+
# -- Options for manual page output ------------------------------------------
148+
149+
# One entry per manual page. List of tuples
150+
# (source start file, name, description, authors, manual section).
151+
man_pages = [
152+
(master_doc, 'scopriamogodot', 'Scopriamo Godot Documentation',
153+
[author], 1)
154+
]
155+
156+
157+
# -- Options for Texinfo output ----------------------------------------------
158+
159+
# Grouping the document tree into Texinfo files. List of tuples
160+
# (source start file, target name, title, author,
161+
# dir menu entry, description, category)
162+
texinfo_documents = [
163+
(master_doc, 'ScopriamoGodot', 'Scopriamo Godot Documentation',
164+
author, 'ScopriamoGodot', 'One line description of project.',
165+
'Miscellaneous'),
166+
]
167+
168+
169+
# -- Options for Epub output -------------------------------------------------
170+
171+
# Bibliographic Dublin Core info.
172+
epub_title = project
173+
epub_author = author
174+
epub_publisher = author
175+
epub_copyright = copyright
176+
177+
# The unique identifier of the text. This can be a ISBN number
178+
# or the project homepage.
179+
#
180+
# epub_identifier = ''
181+
182+
# A unique identification for the text.
183+
#
184+
# epub_uid = ''
185+
186+
# A list of files that should not be packed into the epub file.
187+
epub_exclude_files = ['search.html']
188+
189+
190+
# -- Extension configuration -------------------------------------------------

esercizi.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*****************
2+
Esercizi
3+
*****************
4+
5+
In questa sezione ci sono un pò di esercizi:
6+
7+
:ref:`Il Cavaliere Miaogico` : un progetto di base
8+
9+
.. .. include:: esercizi/scratchy/scratchy.rst
10+
11+
12+
13+
14+
Binary file not shown.

0 commit comments

Comments
 (0)