diff --git a/WikiJam/Models/Blender/Dino.stl b/WikiJam/Models/Blender/Dino.stl new file mode 100644 index 0000000..bba95ab Binary files /dev/null and b/WikiJam/Models/Blender/Dino.stl differ diff --git a/WikiJam/Models/Blender/Dino7.blend b/WikiJam/Models/Blender/Dino7.blend index f554324..f70c987 100644 Binary files a/WikiJam/Models/Blender/Dino7.blend and b/WikiJam/Models/Blender/Dino7.blend differ diff --git a/WikiJam/Models/Blender/Dino7.blend1 b/WikiJam/Models/Blender/Dino7.blend1 index a305f07..805d74a 100644 Binary files a/WikiJam/Models/Blender/Dino7.blend1 and b/WikiJam/Models/Blender/Dino7.blend1 differ diff --git a/WikiJam/Models/Blender/Dino8.blend b/WikiJam/Models/Blender/Dino8.blend new file mode 100644 index 0000000..e4d5014 Binary files /dev/null and b/WikiJam/Models/Blender/Dino8.blend differ diff --git a/WikiJam/Models/Blender/Dino8.blend1 b/WikiJam/Models/Blender/Dino8.blend1 new file mode 100644 index 0000000..d5d53fb Binary files /dev/null and b/WikiJam/Models/Blender/Dino8.blend1 differ diff --git a/WikiJam/Models/Blender/Dino8.fbx b/WikiJam/Models/Blender/Dino8.fbx new file mode 100644 index 0000000..e05069e Binary files /dev/null and b/WikiJam/Models/Blender/Dino8.fbx differ diff --git a/WikiJam/Models/Blender/Dino9.blend b/WikiJam/Models/Blender/Dino9.blend new file mode 100644 index 0000000..e27e66d Binary files /dev/null and b/WikiJam/Models/Blender/Dino9.blend differ diff --git a/WikiJam/Models/Blender/Dino9.blend1 b/WikiJam/Models/Blender/Dino9.blend1 new file mode 100644 index 0000000..a828472 Binary files /dev/null and b/WikiJam/Models/Blender/Dino9.blend1 differ diff --git a/WikiJam/Models/Blender/Dino9.fbx b/WikiJam/Models/Blender/Dino9.fbx new file mode 100644 index 0000000..c3d0d65 Binary files /dev/null and b/WikiJam/Models/Blender/Dino9.fbx differ diff --git a/WikiJam/Player/Player.gd b/WikiJam/Player/Player.gd index 4876c7e..e43cbe9 100644 --- a/WikiJam/Player/Player.gd +++ b/WikiJam/Player/Player.gd @@ -15,6 +15,7 @@ const SPRINT_SPEED = 12 const ACCEL = 15.0 const MAX_SLOPE_ANGLE = 40 const MOUSE_SENSITIVITY = 0.05 +const MAX_MOUSE_SPEED = 25 const INTERACT_DISTANCE = 4 const SPRINT_DEC = 0.01; const SPRINT_ACC = 0.005; @@ -94,6 +95,14 @@ func _process_input(): _dir += -camera_transform.basis.z * input_movement_vector.y _dir += camera_transform.basis.x * input_movement_vector.x + # look around with controller + #var look = Vector2() + #look.x = -Input.get_action_strength("cam_move_left") + Input.get_action_strength("cam_move_right") + #look.y = +Input.get_action_strength("cam_move_down") - Input.get_action_strength("cam_move_up") + ##Logger.info("look at: " + String(look)) + ##Input.warp_mouse_position(look) + #look_at(Vector3(look.x, look.y, 1), Vector3.UP) + # jumping if Input.is_action_just_pressed("move_jump") and is_on_floor(): _vel.y = JUMP_SPEED diff --git a/WikiJam/Player/Player.tscn b/WikiJam/Player/Player.tscn index 356ef40..292a645 100644 --- a/WikiJam/Player/Player.tscn +++ b/WikiJam/Player/Player.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://Player/Player.gd" type="Script" id=1] [ext_resource path="res://Player/Footsteps.gd" type="Script" id=2] [ext_resource path="res://Resources/Audio/Step.wav" type="AudioStream" id=3] [ext_resource path="res://Player/UI/HUD.tscn" type="PackedScene" id=4] [ext_resource path="res://Sounds/dino-eat.wav" type="AudioStream" id=5] +[ext_resource path="res://Sounds/ding.wav" type="AudioStream" id=6] [sub_resource type="CylinderShape" id=1] height = 2.5 @@ -79,10 +80,14 @@ unit_db = -10.0 pitch_scale = 1.5 [node name="HUD" parent="." instance=ExtResource( 4 )] +collect_sound_path = NodePath("../CollectSound") [node name="GameOverSound" type="AudioStreamPlayer" parent="."] stream = ExtResource( 5 ) +[node name="CollectSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) + [node name="InteractArea" type="Area" parent="."] gravity = 0.0 diff --git a/WikiJam/Player/UI/HUD.gd b/WikiJam/Player/UI/HUD.gd index c0ecb4f..2a089ca 100644 --- a/WikiJam/Player/UI/HUD.gd +++ b/WikiJam/Player/UI/HUD.gd @@ -1,43 +1,81 @@ extends Control -export(NodePath) var label_nodepath export(NodePath) var popup_nodepath export(NodePath) var gameover_sound_path +export(NodePath) var collect_sound_path +export(NodePath) var container_path -const SCORE = 100 - -var _labelScore: Label var _popup: Popup var _gameover_sound: AudioStreamPlayer +var _collect_sound: AudioStreamPlayer +var _collectibles: GridContainer + +var _itemWidth = 50; var _score: int = 0 +var _init: bool = false +var _texCrystal = preload("res://Images/crystal-unlit.png") +var _texCrystalLit = preload("res://Images/crystal.png") func _ready(): - _labelScore = get_node(label_nodepath) as Label - assert(null != _labelScore) - _popup = get_node(popup_nodepath) as Popup assert(null != _popup) _gameover_sound = get_node(gameover_sound_path) as AudioStreamPlayer assert(null != _gameover_sound) + + _collect_sound = get_node(collect_sound_path) as AudioStreamPlayer + assert(null != _collect_sound) + + _collectibles = get_node(container_path) as GridContainer + assert(null != _collectibles) + + +func _process(_delta): + if _init == false: + _init = true + + # TODO: handle with signals + var count = Collector.getCount() + _itemWidth = int(get_viewport_rect().size.x / (count + 1)) + _collectibles.columns = count + + for i in count: + var rect = _createTexture(_texCrystal) + _collectibles.add_child(rect) + + +func _createTexture(texture): + var rect = TextureRect.new() + rect.texture = texture + rect.expand = true + rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT + rect.rect_min_size = Vector2(_itemWidth, _itemWidth) + return rect func increaseScore(): - _score += SCORE - _labelScore.text = "Score: " + String(_score) - Logger.info(String(_score) + " of " + String(Collector.getCount() * SCORE) + " possible points") - if (_score >= (Collector.getCount() * SCORE)): - Logger.info("YOU WON!") + _score += 1 + Logger.info(String(_score) + " of " + String(Collector.getCount()) + " possible points") + + _collect_sound.play() + + var rect = _createTexture(_texCrystalLit) + _collectibles.add_child_below_node(_collectibles.get_child(0), rect) + _collectibles.remove_child(_collectibles.get_child(0 if _score == 1 else _score)) + + if (_score >= (Collector.getCount())): success() func gameOver(): + Logger.info("YOU FAILED!") _gameover_sound.play() _endGame(false) func success(): + Logger.info("YOU WON!") _endGame(true) diff --git a/WikiJam/Player/UI/HUD.tscn b/WikiJam/Player/UI/HUD.tscn index d69ac8b..a7b2f6e 100644 --- a/WikiJam/Player/UI/HUD.tscn +++ b/WikiJam/Player/UI/HUD.tscn @@ -6,16 +6,9 @@ margin_right = 40.0 margin_bottom = 40.0 script = ExtResource( 1 ) -label_nodepath = NodePath("../HUD/LabelScore") popup_nodepath = NodePath("../HUD/Popup") gameover_sound_path = NodePath("../GameOverSound") - -[node name="LabelScore" type="Label" parent="."] -margin_left = 15.0 -margin_top = 15.0 -margin_right = 115.0 -margin_bottom = 30.0 -text = "Score: 0" +container_path = NodePath("GridContainer") [node name="Popup" type="Popup" parent="."] editor/display_folded = true @@ -71,4 +64,8 @@ margin_right = 614.651 margin_bottom = 582.551 step = 1.0 value = 100.0 + +[node name="GridContainer" type="GridContainer" parent="."] +margin_right = 250.0 +margin_bottom = 150.0 [connection signal="pressed" from="Popup/Button" to="." method="_on_Button_pressed"] diff --git a/WikiJam/project.godot b/WikiJam/project.godot index 025125d..396cd50 100644 --- a/WikiJam/project.godot +++ b/WikiJam/project.godot @@ -65,36 +65,72 @@ config/icon="res://icon.png" Logger="*res://Util/gs_logger/logger.gd" Collector="*res://Util/Collector.gd" +[display] + +window/size/width=1080 +window/size/height=720 + [input] move_fwrd={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null) ] } move_back={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null) ] } move_left={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) ] } move_right={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) ] } move_jump={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null) ] } move_sprint={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null) + ] +} +cam_move_left={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null) + ] +} +cam_move_right={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) + ] +} +cam_move_up={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null) + ] +} +cam_move_down={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null) ] }