mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-22 16:14:22 +00:00
Configure MainGame
This commit is contained in:
parent
adf87b1268
commit
ac1a35c938
6 changed files with 43 additions and 46 deletions
1
main.gd
1
main.gd
|
@ -61,7 +61,6 @@ func build_menu() -> void:
|
||||||
scene_menu.selected_options.connect(_on_menu_selected_options)
|
scene_menu.selected_options.connect(_on_menu_selected_options)
|
||||||
container.add_child(scene_menu)
|
container.add_child(scene_menu)
|
||||||
|
|
||||||
|
|
||||||
## Build the main menu.
|
## Build the main menu.
|
||||||
func build_game() -> void:
|
func build_game() -> void:
|
||||||
scene_game = SCENE_GAME.instantiate()
|
scene_game = SCENE_GAME.instantiate()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://b38wkla8e7rmo"]
|
[gd_scene load_steps=3 format=3 uid="uid://b38wkla8e7rmo"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://main.gd" id="1_jyg3q"]
|
[ext_resource type="Script" path="res://main.gd" id="1_jyg3q"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bkm7id1wdwywg" path="res://scenes/interface/safe_margin_container.tscn" id="2_ah6n8"]
|
[ext_resource type="PackedScene" uid="uid://bkm7id1wdwywg" path="res://scenes/menu/safe_margin_container.tscn" id="2_ah6n8"]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
script = ExtResource("1_jyg3q")
|
script = ExtResource("1_jyg3q")
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
extends Node2D
|
|
||||||
class_name MainGame
|
|
||||||
|
|
||||||
## Emitted when the player has clicked on the Options button.
|
|
||||||
signal selected_exit
|
|
||||||
|
|
||||||
|
|
||||||
func _on_exit_pressed() -> void:
|
|
||||||
selected_exit.emit()
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
|
@ -1,26 +0,0 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://cxj5aud02f40j"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/game/game.gd" id="1_tau5t"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="2_8268g"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="3_48ps6"]
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_g2dkm"]
|
|
||||||
|
|
||||||
[node name="World" type="Node2D"]
|
|
||||||
script = ExtResource("1_tau5t")
|
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
|
||||||
tile_set = SubResource("TileSet_g2dkm")
|
|
||||||
format = 2
|
|
||||||
|
|
||||||
[node name="Sheep" parent="." instance=ExtResource("2_8268g")]
|
|
||||||
position = Vector2(637, 318)
|
|
||||||
run_speed = 600
|
|
||||||
|
|
||||||
[node name="Gold" parent="." instance=ExtResource("3_48ps6")]
|
|
||||||
|
|
||||||
[node name="Gold2" parent="." instance=ExtResource("3_48ps6")]
|
|
||||||
position = Vector2(368, 391)
|
|
||||||
|
|
||||||
[node name="Gold3" parent="." instance=ExtResource("3_48ps6")]
|
|
||||||
position = Vector2(620, 464)
|
|
15
scenes/game/menu_game.gd
Normal file
15
scenes/game/menu_game.gd
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
extends Node2D
|
||||||
|
class_name MainGame
|
||||||
|
|
||||||
|
|
||||||
|
## Get the first possible [MainGame] instance by climbing the scene tree one ancestor at a time.
|
||||||
|
static func get_ancestor(start: Node):
|
||||||
|
var current = start
|
||||||
|
while current is Node:
|
||||||
|
if current is MainGame:
|
||||||
|
return current
|
||||||
|
current = current.get_parent()
|
||||||
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
@onready var gold_counter: Counter = $"GoldCounter"
|
27
scenes/game/menu_game.tscn
Normal file
27
scenes/game/menu_game.tscn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://cxj5aud02f40j"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/game/menu_game.gd" id="1_vrqkh"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://brvbtvt4em32" path="res://behaviours/counter.tscn" id="2_7flt7"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_g2dkm"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_p1lg5"]
|
||||||
|
size = Vector2(1280, 720)
|
||||||
|
|
||||||
|
[node name="MainGame" type="Node2D"]
|
||||||
|
script = ExtResource("1_vrqkh")
|
||||||
|
|
||||||
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
|
tile_set = SubResource("TileSet_g2dkm")
|
||||||
|
format = 2
|
||||||
|
|
||||||
|
[node name="PlayArea" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Shape" type="CollisionShape2D" parent="PlayArea"]
|
||||||
|
shape = SubResource("RectangleShape2D_p1lg5")
|
||||||
|
debug_color = Color(1, 1, 1, 0)
|
||||||
|
|
||||||
|
[node name="Camera" type="Camera2D" parent="."]
|
||||||
|
editor_draw_screen = false
|
||||||
|
|
||||||
|
[node name="GoldCounter" parent="." instance=ExtResource("2_7flt7")]
|
Loading…
Reference in a new issue