Small Godot Wild Jam game
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Basic house and selction system

Raptor 8015e911 ed04b7c8

+68 -14
+1 -1
Resources/theme/theme-main.tres
··· 1 1 [gd_resource type="Theme" load_steps=2 format=3 uid="uid://ducfept6pmkkm"] 2 2 3 - [ext_resource type="FontFile" uid="uid://cawekr44fruhm" path="res://assets/fonts/open-sans/open-sans-regular.ttf" id="1_6yttj"] 3 + [ext_resource type="FontFile" uid="uid://cawekr44fruhm" path="res://Assets/fonts/open-sans/open-sans-regular.ttf" id="1_6yttj"] 4 4 5 5 [resource] 6 6 default_font = ExtResource("1_6yttj")
+11 -3
Scenes/gameplay/gameplay.gd
··· 11 11 12 12 @onready var possible_event_nodes: Node2D = $PossibleEventNodes 13 13 14 - const START_TIMER_WAIT_TIME: float = 10.0 #should be 10.0 14 + const START_TIMER_WAIT_TIME: float = 2.0 #should be 10.0 15 15 #endregion 16 16 17 17 # `pre_start()` is called when a scene is loaded. ··· 44 44 45 45 func random_house_select() -> Node2D: 46 46 var random_index = randi() % possible_event_nodes.get_child_count() 47 - print(random_index) 47 + #print(random_index) 48 48 return possible_event_nodes.get_child(random_index) 49 49 50 50 func _on_random_event_timer_timeout() -> void: ··· 58 58 # House selected for random event 59 59 var selected_house: Node2D = random_house_select() 60 60 61 - #selected_house.modulate = Color(randf(),randf(),randf()) 61 + # Make sure it is a valid node 62 + while !selected_house.has_method("get_has_event"): 63 + selected_house = random_house_select() 64 + 65 + while selected_house.get_has_event(): 66 + selected_house = random_house_select() 67 + 68 + selected_house.trigger_event() 69 + 62 70 #print("Selected: " + str(selected_house.name)) 63 71 64 72
+8 -10
Scenes/gameplay/gameplay.tscn
··· 1 - [gd_scene load_steps=5 format=3 uid="uid://4fyoq8npekf0"] 1 + [gd_scene load_steps=6 format=3 uid="uid://4fyoq8npekf0"] 2 2 3 3 [ext_resource type="PackedScene" uid="uid://barl4q1kugrmm" path="res://Scenes/gameplay/pause-layer/pause-layer.tscn" id="2"] 4 4 [ext_resource type="Texture2D" uid="uid://wgw88tinig5v" path="res://Assets/sprites/icon.svg" id="2_tmsds"] 5 5 [ext_resource type="Script" uid="uid://bhgboyg8ipyan" path="res://addons/TopDownCamera2D/top_down_camera_2d.gd" id="4_1f1us"] 6 6 [ext_resource type="Script" uid="uid://b83omkj4aqsph" path="res://Scenes/gameplay/gameplay.gd" id="5"] 7 + [ext_resource type="PackedScene" uid="uid://cwxtebv520vtj" path="res://Scenes/house/house.tscn" id="5_1f1h4"] 7 8 8 9 [node name="Gameplay" type="Node"] 9 10 script = ExtResource("5") ··· 44 45 45 46 [node name="PossibleEventNodes" type="Node2D" parent="."] 46 47 47 - [node name="House" type="Sprite2D" parent="PossibleEventNodes"] 48 - position = Vector2(204, 232) 49 - texture = ExtResource("2_tmsds") 48 + [node name="House" parent="PossibleEventNodes" instance=ExtResource("5_1f1h4")] 49 + position = Vector2(-49, 106) 50 50 51 - [node name="Cuddy" type="Sprite2D" parent="PossibleEventNodes"] 52 - position = Vector2(-367, -188) 53 - texture = ExtResource("2_tmsds") 51 + [node name="Cuddy" parent="PossibleEventNodes" instance=ExtResource("5_1f1h4")] 52 + position = Vector2(241, -83) 54 53 55 - [node name="Wilson" type="Sprite2D" parent="PossibleEventNodes"] 56 - position = Vector2(483, -267) 57 - texture = ExtResource("2_tmsds") 54 + [node name="Wilson" parent="PossibleEventNodes" instance=ExtResource("5_1f1h4")] 55 + position = Vector2(-332, -205) 58 56 59 57 [node name="Timers" type="Node" parent="."] 60 58
+1
Scenes/house/house.gd
··· 1 + extends StaticBody2D
+1
Scenes/house/house.gd.uid
··· 1 + uid://d3xw74b3v5ral
+46
Scenes/house/house.tscn
··· 1 + [gd_scene load_steps=4 format=3 uid="uid://cwxtebv520vtj"] 2 + 3 + [ext_resource type="Texture2D" uid="uid://wgw88tinig5v" path="res://Assets/sprites/icon.svg" id="1_uxphk"] 4 + 5 + [sub_resource type="GDScript" id="GDScript_uxphk"] 6 + script/source = "extends Sprite2D 7 + 8 + @onready var event_signal_ping: Area2D = $EventSignalPing 9 + var has_event: bool = false 10 + 11 + func _ready() -> void: 12 + event_signal_ping.visible = false 13 + 14 + func get_has_event() -> bool: 15 + return has_event 16 + 17 + func trigger_event(): 18 + event_signal_ping.visible = true 19 + has_event = true 20 + 21 + func _on_event_signal_ping_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void: 22 + if event.is_action_pressed(\"interact\"): 23 + event_signal_ping.visible = false 24 + has_event = false 25 + " 26 + 27 + [sub_resource type="RectangleShape2D" id="RectangleShape2D_uxphk"] 28 + size = Vector2(30, 88) 29 + 30 + [node name="House" type="Sprite2D"] 31 + texture = ExtResource("1_uxphk") 32 + script = SubResource("GDScript_uxphk") 33 + 34 + [node name="EventSignalPing" type="Area2D" parent="."] 35 + 36 + [node name="CollisionShape2D" type="CollisionShape2D" parent="EventSignalPing"] 37 + position = Vector2(0, -64) 38 + shape = SubResource("RectangleShape2D_uxphk") 39 + 40 + [node name="EventSignalSprite" type="Sprite2D" parent="EventSignalPing"] 41 + modulate = Color(1, 0.397701, 0.329255, 1) 42 + position = Vector2(0, -64) 43 + scale = Vector2(0.226563, 0.6875) 44 + texture = ExtResource("1_uxphk") 45 + 46 + [connection signal="input_event" from="EventSignalPing" to="." method="_on_event_signal_ping_input_event"]