Merge pull request 'feature/move-camera' (#35) from feature/move-camera into dev

Reviewed-on: Athena/game-source#35
This commit is contained in:
darknight
2021-05-13 13:35:11 +02:00
26 changed files with 124 additions and 22 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,26 +2,29 @@
importer="texture"
type="StreamTexture"
path="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.stex"
path.s3tc="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.s3tc.stex"
path.etc2="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc2.stex"
path.etc="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc.stex"
metadata={
"vram_texture": false
"imported_formats": [ "s3tc", "etc2", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://assets/props/dagger/textures/dagger_NM.tga"
dest_files=[ "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.stex" ]
dest_files=[ "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.s3tc.stex", "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc2.stex", "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc.stex" ]
[params]
compress/mode=0
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
compress/normal_map=1
flags/repeat=true
flags/filter=true
flags/mipmaps=false
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
@@ -30,5 +33,5 @@ process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
detect_3d=false
svg/scale=1.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -35,3 +35,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien"
msgid "ABOUT_SOURCE_GAME"
msgstr "Source code of game : https://dev.stilobique.com/Athena/game-source"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE"
msgstr "Exit ?"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"
msgstr "Are you sure to quit ?"
+6
View File
@@ -34,3 +34,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien"
msgid "ABOUT_SOURCE_GAME"
msgstr "Code source du jeux : https://dev.stilobique.com/Athena/game-source"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE"
msgstr "Quit ?"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"
msgstr "Voulez vous vraiement quitté ?"
+6
View File
@@ -35,3 +35,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien"
msgid "ABOUT_SOURCE_GAME"
msgstr "Source code of game : https://dev.stilobique.com/Athena/game-source"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE"
msgstr "Exit ?"
msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"
msgstr "Are you sure to quit ?"
+5
View File
@@ -24,6 +24,11 @@ func goto_scene(path):
wait_frames = 1
Loading.get_node("ColorRect/CenterContainer/VBoxContainer/ProgressBar").set_max(loader.get_stage_count())
func gyroscope_enabled():
if Input.get_gyroscope():
return true
else:
return false
func _process(_delta):
print("[global#_process]")
Binary file not shown.
+1 -1
View File
@@ -21,4 +21,4 @@ flags/filter=true
flags/mipmaps=false
flags/srgb=false
slices/horizontal=1
slices/vertical=1
slices/vertical=4
+79 -6
View File
@@ -1,6 +1,11 @@
extends Spatial
const time_max = 3000 # msec
const TIME_MAX = 3000 # msec
const GYROSCOPE_MAX_DIFF = 0.5
const OFFSET_CAMERA_MAX = 0.12
const OFFSET_STEP_CHANGE = 0.01
var gyroscope_value_old = Vector3(0, 0, 0)
onready var meshes = {
"dagger": {
@@ -13,27 +18,95 @@ onready var meshes = {
}
func _ready():
$Dialog/ConfirmEscape.set_title("Quit ?")
$Dialog/ConfirmEscape.set_text("Voulez vous vraiment quitté ?")
$Dialog/ConfirmEscape.set_title(tr("SCENE_WARCRAFT_DIALOG_QUIT_TITLE"))
$Dialog/ConfirmEscape.set_text(tr("SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"))
func _process(_delta):
_check_quit_scene()
_check_dissolve_mesh()
_check_change_angle_camera()
func _check_quit_scene():
# Event key "escape" and "godot event" ui_end
if Input.is_action_just_pressed("ui_end"):
_confirm_before_quit()
func _check_dissolve_mesh():
# Event dissolve in object searched by gamer
for mesh in meshes:
if meshes[mesh]["lock"] == true and meshes[mesh]["mesh"] != null:
if meshes[mesh]["tick_reference"] == null:
meshes[mesh]["tick_reference"] = OS.get_ticks_msec()
if OS.get_ticks_msec() < meshes[mesh]["tick_reference"] + time_max:
if OS.get_ticks_msec() < meshes[mesh]["tick_reference"] + TIME_MAX:
meshes[mesh]["value"] += 0.01
meshes[mesh]["mesh"].get_surface_material(0).set("shader_param/dissolve_amount", meshes[mesh]["value"])
else:
meshes[mesh]["mesh"].call_deferred("free")
meshes[mesh]["mesh"] = null
func _check_change_angle_camera():
var camera = $"Main Camera"
var gyroscope = Input.get_gyroscope()
if camera.h_offset >= -OFFSET_CAMERA_MAX:
if _action_pressed("ui_left") or _action_gyroscope("left", gyroscope):
print("[warcraft#_ready] move camera angle to left")
$"Main Camera".h_offset -= OFFSET_STEP_CHANGE
if camera.h_offset <= OFFSET_CAMERA_MAX:
if _action_pressed("ui_right") or _action_gyroscope("right", gyroscope):
print("[warcraft#_ready] move camera angle to right")
$"Main Camera".h_offset += OFFSET_STEP_CHANGE
if camera.v_offset >= -OFFSET_CAMERA_MAX:
if _action_pressed("ui_down") or _action_gyroscope("down", gyroscope):
print("[warcraft#_ready] move camera angle to down")
$"Main Camera".v_offset -= OFFSET_STEP_CHANGE
if camera.v_offset <= OFFSET_CAMERA_MAX:
if _action_pressed("ui_up") or _action_gyroscope("up", gyroscope):
print("[warcraft#_ready] move camera angle to up")
$"Main Camera".v_offset += OFFSET_STEP_CHANGE
gyroscope_value_old = gyroscope
func _action_pressed(action):
return Input.is_action_pressed(action)
func _action_gyroscope(action, gyroscope):
if Global.gyroscope_enabled():
var expression = Expression.new()
expression.parse("_gyroscope_changed_"+action+"(gyroscope)", ["gyroscope"])
if expression.execute([gyroscope], self):
return true
else:
return false
else:
return false
func _gyroscope_changed_left(gyroscope):
return (gyroscope.abs().y - gyroscope_value_old.abs().y) > GYROSCOPE_MAX_DIFF and \
gyroscope.y < gyroscope_value_old.y
func _gyroscope_changed_right(gyroscope):
return (gyroscope.abs().y - gyroscope_value_old.abs().y) > GYROSCOPE_MAX_DIFF and \
gyroscope.y > gyroscope_value_old.y
func _gyroscope_changed_down(gyroscope):
return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \
gyroscope.z > gyroscope_value_old.z or \
(gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \
gyroscope.x > gyroscope_value_old.x
func _gyroscope_changed_up(gyroscope):
return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \
gyroscope.z < gyroscope_value_old.z or \
(gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \
gyroscope.x < gyroscope_value_old.x
func _notification(what):
# Notification for android back action
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
@@ -47,7 +120,7 @@ func _quit_to_menu():
Global.goto_scene("res://scenes/main.tscn")
# Event when user click/touch dagger
func _on_dagger_input_event(camera, event, click_position, click_normal, shape_idx):
func _on_dagger_input_event(_camera, event, _click_position, _click_normal, _shape_idx):
_initialize_mesh_ref("dagger", event)
func _initialize_mesh_ref(meshInstance, event):
Binary file not shown.
+7 -7
View File
@@ -37,14 +37,14 @@ surfaces/0 = {
"vertex_count": 66436
}
[sub_resource type="CapsuleShape" id=5]
[sub_resource type="CapsuleShape" id=3]
[sub_resource type="PanoramaSky" id=3]
[sub_resource type="PanoramaSky" id=4]
panorama = ExtResource( 11 )
[sub_resource type="Environment" id=4]
[sub_resource type="Environment" id=5]
background_mode = 3
background_sky = SubResource( 3 )
background_sky = SubResource( 4 )
background_color = Color( 0.188235, 0.133333, 0.133333, 1 )
background_energy = 0.6
ambient_light_color = Color( 0.694118, 0.168627, 0.67451, 1 )
@@ -113,7 +113,7 @@ cell_center_y = false
cell_center_z = false
baked_meshes = [ SubResource( 2 ) ]
data = {
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 536870915, 65533, 0, 3, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, -536870909, 65535, 1, 3, 0, 2, -1610612733, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65534, 3, 65531, 65534, -1073741821, 65532, 65534, -1610612733, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, -1610612733, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, -1610612733, 65533, 65535, 3, 65534, 65535, 536870915, 65535, 65535, 3 )
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 536870915, 65533, 0, 3, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, -1610612733, 65533, 2, 3, 65534, 2, 3, 65535, 2, -1073741821, 0, 65534, 536870915, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, -1610612733, 65534, 65534, 3, 65535, 65534, -1073741821, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, 3, 65533, 65535, 3, 65534, 65535, 3, 65535, 65535, 3 )
}
__meta__ = {
"_editor_clip_": 0,
@@ -220,7 +220,7 @@ material/0 = ExtResource( 19 )
[node name="Area" type="Area" parent="Main Scene Props/dagger"]
[node name="CollisionShape" type="CollisionShape" parent="Main Scene Props/dagger/Area"]
shape = SubResource( 5 )
shape = SubResource( 3 )
[node name="sm_stool_b2" type="MeshInstance" parent="Main Scene Props"]
transform = Transform( -0.232037, 0, -0.972707, 0, 1, 0, 0.972707, 0, -0.232037, -2.91873, 0.0130518, 0.702275 )
@@ -387,7 +387,7 @@ shadow_enabled = true
shadow_contact = 0.3
[node name="WorldEnvironment" type="WorldEnvironment" parent="Lighting"]
environment = SubResource( 4 )
environment = SubResource( 5 )
[node name="Dialog" type="Control" parent="."]
margin_right = 40.0
+3
View File
@@ -3,7 +3,10 @@ extends Node
export (PackedScene) var about = load("res://scenes/UI/About.tscn")
export (PackedScene) var scenes = load("res://scenes/UI/ChooseScene.tscn")
const max_diff = 0.08
var current_scene = null
var value_old = Vector2(0, 0)
func _ready():
print(tr("MESSAGE_READY"))