diff --git a/FlyCam/.fscache b/FlyCam/.fscache index 4652e1d..bfcfacb 100644 --- a/FlyCam/.fscache +++ b/FlyCam/.fscache @@ -1,4 +1,4 @@ -::res://::1448637685 -flycam.gd::GDScript::1448637685:: -flycam.xml::PackedScene::1448637600:: +::res://::1449891710 +flycam.gd::GDScript::1449891710:: +flycam.xml::PackedScene::1449715551:: icon.png::ImageTexture::1448615258:: diff --git a/FlyCam/flycam.gd b/FlyCam/flycam.gd index c4d8904..1a27bb2 100644 --- a/FlyCam/flycam.gd +++ b/FlyCam/flycam.gd @@ -10,18 +10,27 @@ var projection var camera var quad export var move_speed = 2 +var tex = preload('res://icon.png') +var direction = Vector3() +var aim # SETUP func _ready(): set_process(true) set_process_input(true) - # The camera could have been added manually, but I wanted this to be plug n' play. camera = Camera.new() camera.make_current() add_child(camera) - + var sprite3d = Sprite3D.new() + sprite3d.set_texture(tex) + sprite3d.set_scale(Vector3(.05,.05,.05)) + sprite3d.set_translation(get_translation()+ Vector3(0,0,-6)) + camera.add_child(sprite3d) + var yaw2 = Spatial.new() + yaw2.set_name('yaw') + add_child(yaw2) # EVENT DRIVEN # This code makes the camera aim. It alone does the aiming. @@ -39,23 +48,30 @@ func _input(event): func _process(delta): # Return a normal vector in worldspace, that is the result of projecting a point on the Viewport rectangle by the camera projection. # Basically it converts the mouse position to a 3d location/vector - projection = camera.project_ray_normal(get_viewport().get_mouse_pos()) + #projection = camera.project_ray_normal(get_viewport().get_mouse_pos()) # Now I can move in the direction of the mouse + walk() - - if Input.is_action_pressed("ui_up"): - set_translation(Vector3(get_translation()+projection*delta*move_speed)) - # multiplied by delta for smoother translation motion - - if Input.is_action_pressed("ui_down"): - set_translation(Vector3(get_translation()-projection*delta*move_speed)) if Input.is_key_pressed(81) or Input.is_key_pressed(16777217): # Q and Escape get_tree().quit() - if Input.is_key_pressed(82): # R get_tree().reload_current_scene() +func walk(): + aim = get_node("yaw").get_global_transform().basis + if Input.is_action_pressed("ui_up"): + direction -= aim[2] + if Input.is_action_pressed("ui_down"): + direction += aim[2] + if Input.is_action_pressed('ui_right'): + direction +=aim[0] + if Input.is_action_pressed('ui_left'): + direction -=aim[0] + set_translation(direction*view_sensitivity) + + + # OTHER BUILT-IN FUNCTIONS func _enter_tree(): @@ -64,4 +80,4 @@ func _enter_tree(): func _exit_tree(): # Show mouse upon exiting the tree/level - Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE); + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE); \ No newline at end of file diff --git a/FlyCam/flycam.xml b/FlyCam/flycam.xml index 8143cdd..257e819 100644 --- a/FlyCam/flycam.xml +++ b/FlyCam/flycam.xml @@ -8,7 +8,7 @@ "conns" "names" - + "Spatial" "_import_path" "_import_transform" @@ -70,18 +70,13 @@ "Head" "script/script" "move_speed" - "Quad" - "quad/axis" - "quad/size" - "quad/offset" - "quad/centered" "node_count" - 7 + 6 "nodes" - -1, -1, 0, 0, -1, 4, 1, 0, 2, 1, 3, 2, 4, 3, 0, 0, 0, 5, 5, -1, 18, 1, 0, 3, 2, 6, 4, 7, 4, 8, 5, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 8, 16, 2, 17, 9, 18, 9, 19, 4, 20, 2, 21, 10, 0, 0, 0, 23, 22, -1, 18, 1, 0, 2, 1, 24, 11, 3, 2, 25, 5, 26, 2, 27, 12, 28, 2, 29, 2, 30, 13, 31, 13, 32, 13, 33, 8, 34, 8, 35, 8, 36, 8, 37, 8, 38, 14, 0, 0, 0, 23, 23, -1, 17, 1, 0, 2, 1, 3, 2, 25, 5, 26, 2, 27, 12, 28, 2, 29, 2, 30, 13, 31, 13, 32, 13, 33, 8, 34, 8, 35, 8, 36, 8, 37, 8, 38, 14, 0, 0, 0, 39, 39, -1, 23, 1, 0, 2, 1, 24, 15, 3, 2, 25, 5, 40, 2, 41, 8, 42, 14, 43, 16, 44, 17, 45, 17, 46, 8, 47, 13, 48, 18, 49, 13, 50, 19, 51, 4, 52, 12, 53, 14, 54, 14, 55, 13, 56, 20, 57, 21, 0, 0, 0, 0, 58, -1, 6, 1, 0, 2, 1, 24, 22, 3, 2, 59, 23, 60, 24, 0, 5, 0, 61, 61, -1, 21, 1, 0, 2, 1, 3, 2, 25, 5, 26, 2, 27, 12, 28, 2, 29, 2, 30, 13, 31, 13, 32, 13, 33, 8, 34, 8, 35, 8, 36, 8, 37, 8, 38, 14, 62, 9, 63, 25, 64, 26, 65, 2, 0 + -1, -1, 0, 0, -1, 4, 1, 0, 2, 1, 3, 2, 4, 3, 0, 0, 0, 5, 5, -1, 18, 1, 0, 3, 2, 6, 4, 7, 4, 8, 5, 9, 6, 10, 7, 11, 0, 12, 0, 13, 0, 14, 0, 15, 8, 16, 2, 17, 9, 18, 9, 19, 4, 20, 2, 21, 10, 0, 0, 0, 23, 22, -1, 18, 1, 0, 2, 1, 24, 11, 3, 2, 25, 5, 26, 2, 27, 12, 28, 2, 29, 2, 30, 13, 31, 13, 32, 13, 33, 8, 34, 8, 35, 8, 36, 8, 37, 8, 38, 14, 0, 0, 0, 23, 23, -1, 17, 1, 0, 2, 1, 3, 2, 25, 5, 26, 2, 27, 12, 28, 2, 29, 2, 30, 13, 31, 13, 32, 13, 33, 8, 34, 8, 35, 8, 36, 8, 37, 8, 38, 14, 0, 0, 0, 39, 39, -1, 23, 1, 0, 2, 1, 24, 15, 3, 2, 25, 5, 40, 2, 41, 8, 42, 14, 43, 16, 44, 17, 45, 17, 46, 8, 47, 13, 48, 18, 49, 13, 50, 19, 51, 4, 52, 12, 53, 14, 54, 14, 55, 13, 56, 20, 57, 21, 0, 0, 0, 0, 58, -1, 6, 1, 0, 2, 1, 24, 22, 3, 2, 59, 23, 60, 24, 0 "variants" - + "" 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 True @@ -245,8 +240,6 @@ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5.19473 3 - 1, 1 - 0, 0 "version" 1 diff --git a/FlyCam/readme.md b/FlyCam/readme.md deleted file mode 100644 index 7cb2a3b..0000000 --- a/FlyCam/readme.md +++ /dev/null @@ -1 +0,0 @@ -A simple demo for a flying camera. Edit to your liking. diff --git a/Piskel Game/.fscache b/Piskel Game/.fscache index 90fc431..bb09e14 100644 --- a/Piskel Game/.fscache +++ b/Piskel Game/.fscache @@ -1,21 +1,22 @@ -::res://::1449375880 +::res://::1449521536 icon.png::ImageTexture::1448925517:: -screenshot.png::ImageTexture::1448925517:: +screenshot.png::ImageTexture::1449520895:: ::res://Assets::1448925517 -::res://Assets/Scripts::1449376208 -anim.gd::GDScript::1449376208:: -game.gd::GDScript::1449376208:: +::res://Assets/Scripts::1449523766 +anim.gd::GDScript::1449523766:: +game.gd::GDScript::1449523766:: +labels.gd::GDScript::1449523766:: loopSprite.gd::GDScript::1448925517:: ::res://Assets/Sounds::1448925517 ::res://Assets/Sounds/Music::1448925517 Vino.ogg::AudioStreamOGGVorbis::1448925517:: -::res://Assets/Sounds/sfx::1449286168 +::res://Assets/Sounds/sfx::1449454022 jump.wav::Sample::1448925517:: punch.wav::Sample::1370673508:: ::res://Assets/Sprites::1449115397 chr_animal_walking_2.png::ImageTexture::1448925517:: large mountain.png::ImageTexture::1448925517:: -::res://Assets/Sprites/Characters::1449449144 +::res://Assets/Sprites/Characters::1449532229 ::res://Assets/Sprites/Characters/chr_base_5_f::1448990523 ::res://Assets/Sprites/Characters/chr_base_5_f/1024::1448990523 chr_base_5_f_1024.png::ImageTexture::1448990523:: @@ -114,6 +115,8 @@ chrs_blueHeros_1024.png::ImageTexture::1448990523:: chrs_blueHeros_256.png::ImageTexture::1448991238:: ::res://Assets/Sprites/Characters/chrs_blueHeros/32::1448990523 chrs_blueHeros_32.png::ImageTexture::1448990523:: +::res://Assets/Sprites/Characters/chrs_frozen::1449532206 +chrs_frozen_256.png::ImageTexture::1449532202:: ::res://Assets/Sprites/Characters/chrs_jackAndjill::1448990523 ::res://Assets/Sprites/Characters/chrs_jackAndjill/1024::1448990523 chrs_jackAndjill_1024.png::ImageTexture::1448990523:: @@ -178,5 +181,5 @@ clouds2.png::ImageTexture::1448507088:: clouds3.png::ImageTexture::1448507088:: ::res://Assets/Sprites/Props/props_studio::1449115368 props_studio_256.png::ImageTexture::1449115362:: -::res://Levels::1449376045 -level 1.xml::PackedScene::1449376045:: +::res://Levels::1449521549 +level 1.xml::PackedScene::1449521549::