Skip to content

Commit

Permalink
Primo commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucass97 committed Jun 2, 2022
1 parent 190341a commit 2fee309
Show file tree
Hide file tree
Showing 319 changed files with 11,494 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Imported translations (automatically generated from CSV files)
*.translation

# Mono-specific ignores
.mono/
data_*/
94 changes: 93 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,93 @@
# progettoMobileComputing
# Samurai Game

Un gioco platform a tema samurai sviluppato per piattaforme mobile.
Samurai Game è stato realizzato per il corso di Mobile Computing di Roma Tre (2021/2022).

Autore : *Luca Gregori*

![Spuntoni](docs/demo.gif)

## Wiki
Qui di seguito saranno mostrati i principali aspetti del gioco.
### Obiettivi

| Immagine | Obiettivo |
|------------------------|--------------------------------------------------|
| ![Coin](docs/coin.gif) | Collezionare le monete sparse per il gioco |
| ![Skull](docs/skull.gif) | Raccogliore il teschio per concludere il livello |


### Consigli

![Wiki](docs/screenshot1.png "Consigli")

> Esegui un attacco corpo a corpo contro una freccia in arrivo per rimandarla indietro e uccidere l'arciere o qualsiasi nemico che si trova in mezzo.
> Se lasciato indisturbato lo spadaccino con lo scudo non ti attaccherà.

### Nemici

| Immagine | Entità | Velocità | Attacco | Difesa | Vita | Descrizione |
|-----------------------------------------------------------------------|----------------------|----------|---------|--------|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ![Skeleton](docs/skeleton.gif) | **Scheletro** | Veloce | Mischia | No | 1 HP | Nemico semplice che esegue attacchi in mischia. |
| ![Knight](docs/knight.gif) | **Spadaccino** | Medio | Spada | No | 2 HP | Nemico che esegue attacchi con la spada. |
| ![Shield](docs/shield.png) | **Spadaccino** con scudo | Lento | Spada | Scudo | 3 HP | Quando chiude la distanza del giocatore alza in automatico lo scudo per difendersi.<br/>Se si colpisce lo scudo il colpo verrò parato e il nemico contrattaccherà subito dopo.<br/>Se non si dovesse colpire il nemico mentre questo è con lo scudo alzato c'è una buona probabilità che questo esegua un attacco di sua iniziativa.<br/>La probabilità di attacco per iniziativa aumenta man mano che passa il tempo.<br/> |
| ![Archer](docs/archer.gif) | **Arciere** | Medio | Arco | No | 2 HP | Appena il giocatore entrerà nel campo visivo dell'arciere quest'ultimo scaglierà una freccia verso lui.<br/>Le frecce possono danneggiare anche gli altri nemici oltre che il giocatore. |
| ![YellowArcher](docs/yellow_archer.gif) | **Arciere Giallo** | Medio | Arco | No | 2 HP | Si comporta come un arciere normale, tuttavia scocca 5 freccie consecutive in rapida successione come singolo attacco. |
| ![RedArcher](docs/red_archer.gif) | **Arciere Rosso** | Medio | Arco | No | 2 HP | Si comporta come un arciere normale, tuttavia scocca 3 freccie contemporaneamente in un singolo attacco. | |

### Altro

| Immagine | Descrizione |
|---------------------------------------------------------------------|-------------------------------------------------------|
| ![CircularSaw](docs/circular_saw.png) | Sega circolante in grado di danneggiare il giocatore. |
| ![Spuntoni](docs/spuntoni.png) | Spuntoni in grado di danneggiare il giocatore. |


### Livelli

Al momento sono disponibili due livelli.

![Selezione livello](docs/screenshot3.png "Schermata di selezione del livello")
*Screenshot della schermata di selezione del livello.*

---

![Primo livello](docs/screenshot4.png "Primo livello")
*Screenshot del primo livello.*

---

![Secondo livello](docs/screenshot5.png "Secondo livello")
*Screeshot del secondo livello.*

---


## Installazione
Per installare "Samurai Game" su `android` navigare all'interno di questa repository in `release` e scaricare l'**APK**.
Copiare sul proprio dispositivo il file **APK** e, prima di procedere con l'installazione, assicurarsi di abilitare la funzione: `Installa da origini sconosciute`.
Una volta installato il gioco navigare nelle impostazione per fornire all'applicativo le autorizzazioni di lettura e scrittura di file.
Senza questo passaggio non sarà possibile usufruire delle statistiche in game.

Versione di android testata: 6.0

## Riferimenti

Sviluppato e ideato da _Luca Gregori_.

![Secondo livello](docs/screenshot2.png "Secondo livello")

---

[Link ufficiale a Godot.](https://godotengine.org/)

### Assets utilizzati
- Autore: _[Senari Rey](https://senari-rey.itch.io/)_
- Tipo di licenza: CC BY 4.0
- Reperibili al seguente [link](https://senari-rey.itch.io/pixel-art-platformer-tileset)

### Musica utilizzata
- Titolo: Slave Knight Gael (8-bit)
- Reberibile al seguente [link](https://www.youtube.com/watch?v=JBts5_EPu38)
13 changes: 13 additions & 0 deletions addons/SpriteSheetImporter/SpriteSheetImporter.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tool

extends EditorPlugin

var import_plugin

func _enter_tree():
import_plugin = preload("import_plugin.gd").new()
add_import_plugin(import_plugin)

func _exit_tree():
remove_import_plugin(import_plugin)
import_plugin = null
Binary file added addons/SpriteSheetImporter/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions addons/SpriteSheetImporter/icon.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-d1785e39e0071dbb1073cf2150fa4769.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/SpriteSheetImporter/icon.png"
dest_files=[ "res://.import/icon.png-d1785e39e0071dbb1073cf2150fa4769.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
122 changes: 122 additions & 0 deletions addons/SpriteSheetImporter/import_plugin.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
tool
extends EditorImportPlugin

enum Preset { PRESET_DEFAULT }

func get_importer_name():
return "snkkid.SpriteSheetImporter"

func get_visible_name():
return "Sprite sheet importer"

func get_recognized_extensions():
return ["json"]

func get_save_extension():
return "res"

func get_resource_type():
return "Resource"

func get_preset_count():
return Preset.size()

func get_preset_name(preset):
match preset:
PRESET_DEFAULT: return "Default"

func get_import_options(preset):
match preset:
PRESET_DEFAULT:
return [{
"name": "Import_As_Atlas",
"default_value": true
}]
_:
return []

func get_option_visibility(option, options):
return true

func get_import_order():
return 200

func import(source_file, save_path, options, r_platform_variants, r_gen_files):
print("Importing sprite sheet from "+source_file);

var sheets = read_sprite_sheet(source_file)
if typeof(sheets) == TYPE_INT:
return sheets

if options.Import_As_Atlas:
var sheetFolder = source_file.get_basename()+".sprites";
var err = create_folder(sheetFolder)
if typeof(err) == TYPE_INT:
return 1

var image = ImageTexture.new()
image = load(source_file.get_base_dir().plus_file(sheets.meta.image))

for sheet in sheets.frames:
var texture = AtlasTexture.new()
texture.atlas = image
var name = sheetFolder+"/"+sheet.filename.get_basename()+".tres"
texture.region = Rect2(sheet.frame.x,sheet.frame.y,sheet.frame.w,sheet.frame.h)
save_resource(name, texture)

return ResourceSaver.save("%s.%s" % [save_path, get_save_extension()], Resource.new())

func save_resource(name, texture):
create_folder(name.get_base_dir())

var status = ResourceSaver.save(name, texture)
if status != OK:
printerr("Failed to save resource "+name)
return false
return true

func read_sprite_sheet(fileName):
var nbError = 0
var file = File.new()
if file.open(fileName, file.READ) != OK:
printerr("Failed to load "+fileName)
return 1
var text = file.get_as_text()
var dict = JSON.parse(text).result
file.close()

if !dict:
nbError = nbError + 1
if !dict.has("meta"):
nbError = nbError + 1
if !dict.meta.has("image"):
nbError = nbError + 1
if !dict.has("frames"):
nbError = nbError + 1
if dict.frames.size() == 0:
nbError = nbError + 1
if !dict.frames[0].has("filename"):
nbError = nbError + 1
if !dict.frames[0].has("frame"):
nbError = nbError + 1
if !dict.frames[0].frame.has("x"):
nbError = nbError + 1
if !dict.frames[0].frame.has("y"):
nbError = nbError + 1
if !dict.frames[0].frame.has("w"):
nbError = nbError + 1
if !dict.frames[0].frame.has("h"):
nbError = nbError + 1

if nbError > 0:
printerr("Invalid json data in "+fileName)
return nbError

return dict

func create_folder(folder):
var dir = Directory.new()
if !dir.dir_exists(folder):
if dir.make_dir_recursive(folder) != OK:
printerr("Failed to create folder: " + folder)
return 1
7 changes: 7 additions & 0 deletions addons/SpriteSheetImporter/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="Sprite sheet importer"
description="Importer for sprite sheet JSON (array)"
author="snkkid"
version="1.0"
script="SpriteSheetImporter.gd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Andreas Loew / CodeAndWeb GmbH www.codeandweb.com
#
# 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.

tool
extends EditorPlugin

var import_plugin_tilesheet = null
var import_plugin_spritesheet = null

func get_name():
return "TexturePacker Importer"


func _enter_tree():
import_plugin_tilesheet = preload("texturepacker_import_tileset.gd").new()
add_import_plugin(import_plugin_tilesheet)
import_plugin_spritesheet = preload("texturepacker_import_spritesheet.gd").new()
add_import_plugin(import_plugin_spritesheet)


func _exit_tree():
remove_import_plugin(import_plugin_spritesheet)
import_plugin_spritesheet = null
remove_import_plugin(import_plugin_tilesheet)
import_plugin_tilesheet = null
59 changes: 59 additions & 0 deletions addons/codeandweb.texturepacker/image_loader.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 George Marques
#
# 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.

tool
extends Object

func load_image(rel_path, source_path, options):
var flags = options.image_flags if "image_flags" in options else Texture.FLAGS_DEFAULT
var embed = options.embed_internal_images if "embed_internal_images" in options else false

var ext = rel_path.get_extension().to_lower()
if not ext in ["png","jpg","webp","pvr","tga"]:
printerr("Unsupported image format: %s. Use PNG, JPG, WEBP, PVR or TGA instead." % [ext])
return ERR_FILE_UNRECOGNIZED

var total_path = rel_path
if rel_path.is_rel_path():
total_path = ProjectSettings.globalize_path(source_path.get_base_dir()).plus_file(rel_path)
total_path = ProjectSettings.localize_path(total_path)

var dir = Directory.new()
if not dir.file_exists(total_path):
printerr("Image not found: %s" % [total_path])
return ERR_FILE_NOT_FOUND

if not total_path.begins_with("res://"):
# External images need to be embedded
embed = true

var image = null
if embed:
image = ImageTexture.new()
image.load(total_path)
else:
image = ResourceLoader.load(total_path, "ImageTexture")

if image != null:
image.set_flags(flags)

return image
Loading

0 comments on commit 2fee309

Please sign in to comment.