cooking again
This commit is contained in:
parent
b0b210a8be
commit
dafae35985
14 changed files with 218 additions and 10 deletions
|
|
@ -15,3 +15,10 @@ Snake jam for SXSW Jam 2025
|
||||||
|
|
||||||
|
|
||||||
https://opengameart.org/content/apple-32x32
|
https://opengameart.org/content/apple-32x32
|
||||||
|
|
||||||
|
## Final Stretch
|
||||||
|
okay theres like 5 days left so lets pivot the plan a bit so we can submit something
|
||||||
|
- Only the first three segments have things in them (the starting segments)
|
||||||
|
- every time we eat an apple, we get longer but cant access those rooms/are empty
|
||||||
|
- apples reduce hunger/if we get too hungry, game over
|
||||||
|
- if snake runs into itself or wall, game over
|
||||||
|
|
|
||||||
13
apple_pit_man.gd
Normal file
13
apple_pit_man.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var snake_man : Node2D
|
||||||
|
@export var count : Label
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
count.text = str(snake_man.pit_apples)
|
||||||
1
apple_pit_man.gd.uid
Normal file
1
apple_pit_man.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://btw5oi52pxy7d
|
||||||
10
braincell.gd
10
braincell.gd
|
|
@ -5,6 +5,8 @@ const SPEED = 170.0
|
||||||
const JUMP_VELOCITY = -400.0
|
const JUMP_VELOCITY = -400.0
|
||||||
var ready_to_door : bool = true
|
var ready_to_door : bool = true
|
||||||
@export var doorBox : Area2D
|
@export var doorBox : Area2D
|
||||||
|
@export var hand : Node2D
|
||||||
|
var holding_apple : bool = false
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
|
@ -30,6 +32,8 @@ func _physics_process(delta: float) -> void:
|
||||||
if !doorBox.has_overlapping_areas():
|
if !doorBox.has_overlapping_areas():
|
||||||
ready_to_door = true
|
ready_to_door = true
|
||||||
|
|
||||||
|
hand.visible = holding_apple
|
||||||
|
|
||||||
|
|
||||||
func _on_door_box_area_entered(area: Area2D) -> void:
|
func _on_door_box_area_entered(area: Area2D) -> void:
|
||||||
print(area.name)
|
print(area.name)
|
||||||
|
|
@ -48,3 +52,9 @@ func _on_door_box_area_entered(area: Area2D) -> void:
|
||||||
ready_to_door = false
|
ready_to_door = false
|
||||||
#Router.activate_seg.emit(Router.cur_id - 1)
|
#Router.activate_seg.emit(Router.cur_id - 1)
|
||||||
# -1 seg
|
# -1 seg
|
||||||
|
|
||||||
|
func grab():
|
||||||
|
holding_apple = true
|
||||||
|
|
||||||
|
func drop():
|
||||||
|
holding_apple = false
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://cusdydgg4b1bo"]
|
[gd_scene load_steps=7 format=3 uid="uid://cusdydgg4b1bo"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b48mlxrnte625" path="res://braincell.gd" id="1_q1ksn"]
|
[ext_resource type="Script" uid="uid://b48mlxrnte625" path="res://braincell.gd" id="1_q1ksn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://qyd5e7lb2esx" path="res://assets/braincell.png" id="2_wv6rk"]
|
[ext_resource type="Texture2D" uid="uid://qyd5e7lb2esx" path="res://assets/braincell.png" id="2_wv6rk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c6ttpr5je1ly1" path="res://prefabs/mini_apple.tscn" id="3_wv6rk"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_g14j6"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_g14j6"]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
|
|
@ -9,11 +10,15 @@ radius = 16.0
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_q1ksn"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_q1ksn"]
|
||||||
radius = 7.07107
|
radius = 7.07107
|
||||||
|
|
||||||
[node name="Braincell" type="CharacterBody2D" node_paths=PackedStringArray("doorBox")]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_wv6rk"]
|
||||||
|
radius = 32.0
|
||||||
|
|
||||||
|
[node name="Braincell" type="CharacterBody2D" node_paths=PackedStringArray("doorBox", "hand")]
|
||||||
z_index = 15
|
z_index = 15
|
||||||
motion_mode = 1
|
motion_mode = 1
|
||||||
script = ExtResource("1_q1ksn")
|
script = ExtResource("1_q1ksn")
|
||||||
doorBox = NodePath("doorBox")
|
doorBox = NodePath("doorBox")
|
||||||
|
hand = NodePath("Hand")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
texture = ExtResource("2_wv6rk")
|
texture = ExtResource("2_wv6rk")
|
||||||
|
|
@ -26,4 +31,14 @@ shape = SubResource("CircleShape2D_g14j6")
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="doorBox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="doorBox"]
|
||||||
shape = SubResource("CircleShape2D_q1ksn")
|
shape = SubResource("CircleShape2D_q1ksn")
|
||||||
|
|
||||||
|
[node name="Hand" type="Node2D" parent="."]
|
||||||
|
position = Vector2(0, -16)
|
||||||
|
|
||||||
|
[node name="MiniApple" parent="Hand" instance=ExtResource("3_wv6rk")]
|
||||||
|
|
||||||
|
[node name="PickupRange" type="Area2D" parent="." groups=["braincell"]]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="PickupRange"]
|
||||||
|
shape = SubResource("CircleShape2D_wv6rk")
|
||||||
|
|
||||||
[connection signal="area_entered" from="doorBox" to="." method="_on_door_box_area_entered"]
|
[connection signal="area_entered" from="doorBox" to="." method="_on_door_box_area_entered"]
|
||||||
|
|
|
||||||
16
prefabs/mini_apple.tscn
Normal file
16
prefabs/mini_apple.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c6ttpr5je1ly1"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dmmdu0ayhmlnk" path="res://assets/apple.png" id="1_aupp8"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_lpmi7"]
|
||||||
|
radius = 12.0
|
||||||
|
|
||||||
|
[node name="MiniApple" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_aupp8")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="." groups=["mini_apple"]]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_lpmi7")
|
||||||
|
|
@ -7,6 +7,7 @@ var want_direction : Vector2 = Vector2.RIGHT
|
||||||
|
|
||||||
@export var next_segment : Node2D
|
@export var next_segment : Node2D
|
||||||
@export var door : Node2D
|
@export var door : Node2D
|
||||||
|
@export var door_disabled : bool = false
|
||||||
var start_pos : Vector2
|
var start_pos : Vector2
|
||||||
var target_pos : Vector2
|
var target_pos : Vector2
|
||||||
var move_progress : float
|
var move_progress : float
|
||||||
|
|
@ -69,6 +70,7 @@ func _on_eat_die_box_area_entered(area: Area2D) -> void:
|
||||||
print("mmm tasty apple")
|
print("mmm tasty apple")
|
||||||
Router.eat_apple.emit()
|
Router.eat_apple.emit()
|
||||||
if(area.is_in_group("wall")):
|
if(area.is_in_group("wall")):
|
||||||
print("i die")
|
Router.die.emit()
|
||||||
get_tree().get_root().process_mode = Node.PROCESS_MODE_DISABLED
|
if(area.is_in_group("snake")):
|
||||||
|
if (area.get_parent().is_head):
|
||||||
|
Router.die.emit()
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ door_in_node = NodePath("Door/DoorIn")
|
||||||
door_out_node = NodePath("Door/DoorOut")
|
door_out_node = NodePath("Door/DoorOut")
|
||||||
|
|
||||||
[node name="Door" type="Node2D" parent="DoorArm"]
|
[node name="Door" type="Node2D" parent="DoorArm"]
|
||||||
z_index = 11
|
|
||||||
position = Vector2(160, 0)
|
position = Vector2(160, 0)
|
||||||
|
|
||||||
[node name="DoorIn" type="Area2D" parent="DoorArm/Door"]
|
[node name="DoorIn" type="Area2D" parent="DoorArm/Door"]
|
||||||
|
|
@ -53,7 +52,7 @@ shape = SubResource("RectangleShape2D_08kyq")
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="DoorArm/Door"]
|
[node name="Sprite2D" type="Sprite2D" parent="DoorArm/Door"]
|
||||||
texture = ExtResource("4_34t3n")
|
texture = ExtResource("4_34t3n")
|
||||||
|
|
||||||
[node name="EatDieBox" type="Area2D" parent="."]
|
[node name="EatDieBox" type="Area2D" parent="." groups=["snake"]]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="EatDieBox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="EatDieBox"]
|
||||||
shape = SubResource("CircleShape2D_08kyq")
|
shape = SubResource("CircleShape2D_08kyq")
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ enabled=PackedStringArray("res://addons/godot-donut-collision-polygon-2d-7780d02
|
||||||
|
|
||||||
apple=""
|
apple=""
|
||||||
wall=""
|
wall=""
|
||||||
|
snake=""
|
||||||
|
mini_apple=""
|
||||||
|
braincell=""
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|
@ -65,6 +68,11 @@ test_switch_cam={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
test_add_segment={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194445,"key_label":0,"unicode":55,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ extends Node
|
||||||
|
|
||||||
signal activate_seg(int)
|
signal activate_seg(int)
|
||||||
signal eat_apple
|
signal eat_apple
|
||||||
|
signal die #trigger game over logic
|
||||||
|
|
||||||
var current_seg : Node2D
|
var current_seg : Node2D
|
||||||
var cur_id : int = 0
|
var cur_id : int = 0
|
||||||
|
|
@ -9,6 +10,7 @@ var player_mode : bool = false
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
die.connect(end_game)
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,3 +18,7 @@ func _ready() -> void:
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if (Input.is_action_just_pressed("test_switch_cam")):
|
if (Input.is_action_just_pressed("test_switch_cam")):
|
||||||
player_mode = !player_mode
|
player_mode = !player_mode
|
||||||
|
|
||||||
|
func end_game():
|
||||||
|
print("i die")
|
||||||
|
get_tree().get_root().process_mode = Node.PROCESS_MODE_DISABLED
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,16 @@ var segements : Array[snake_segment]
|
||||||
@export var SNAKE_SPEED : float = 0.2
|
@export var SNAKE_SPEED : float = 0.2
|
||||||
@export var snake_line : Line2D
|
@export var snake_line : Line2D
|
||||||
@export var player : Node2D
|
@export var player : Node2D
|
||||||
|
var food : float = 5
|
||||||
|
@export var max_food = 5
|
||||||
|
@export var food_drain = 0.1
|
||||||
|
var pit_apples : int = 0
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Router.activate_seg.connect(activate_segment)
|
Router.activate_seg.connect(activate_segment)
|
||||||
|
Router.eat_apple.connect(rec_apple)
|
||||||
|
food = max_food
|
||||||
#segements = get_children() as Array[snake_segment]
|
#segements = get_children() as Array[snake_segment]
|
||||||
segements.assign(segements_holder.get_children())
|
segements.assign(segements_holder.get_children())
|
||||||
for i in segements.size():
|
for i in segements.size():
|
||||||
|
|
@ -28,6 +34,13 @@ func _ready() -> void:
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
redraw_line()
|
redraw_line()
|
||||||
|
|
||||||
|
if(Input.is_action_just_pressed("test_add_segment")):
|
||||||
|
add_segment()
|
||||||
|
|
||||||
|
if food > max_food:
|
||||||
|
food = max_food
|
||||||
|
food -= food_drain * delta
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func activate_segment(act_segment : int):
|
func activate_segment(act_segment : int):
|
||||||
|
|
@ -47,3 +60,21 @@ func redraw_line():
|
||||||
snake_line.clear_points()
|
snake_line.clear_points()
|
||||||
for segment in segements:
|
for segment in segements:
|
||||||
snake_line.add_point(segment.global_position)
|
snake_line.add_point(segment.global_position)
|
||||||
|
|
||||||
|
func add_segment():
|
||||||
|
var new_segement : Node2D = load("res://prefabs/snake_segment.tscn").instantiate()
|
||||||
|
new_segement.global_position = segements[-1].global_position
|
||||||
|
new_segement.next_segment = segements[-1]
|
||||||
|
new_segement.door_disabled = true
|
||||||
|
segements.append(new_segement)
|
||||||
|
segements_holder.add_child(new_segement)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func rec_apple():
|
||||||
|
#food += 1
|
||||||
|
pit_apples += 1
|
||||||
|
SNAKE_SPEED += 0.1
|
||||||
|
add_segment()
|
||||||
|
for seg in segements:
|
||||||
|
seg.snake_speed = SNAKE_SPEED
|
||||||
|
|
||||||
|
|
|
||||||
90
test.tscn
90
test.tscn
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://daqqurdrnk61h"]
|
[gd_scene load_steps=16 format=3 uid="uid://daqqurdrnk61h"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bue4xxejdsmqh" path="res://snakeManager.gd" id="1_6uqi0"]
|
[ext_resource type="Script" uid="uid://bue4xxejdsmqh" path="res://snakeManager.gd" id="1_6uqi0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwoeu7ask0fck" path="res://prefabs/snake_segment.tscn" id="1_8uh7m"]
|
[ext_resource type="PackedScene" uid="uid://bwoeu7ask0fck" path="res://prefabs/snake_segment.tscn" id="1_8uh7m"]
|
||||||
|
|
@ -6,8 +6,23 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://b1sese4p8sck3" path="res://assets/smallMap.png" id="1_vbegm"]
|
[ext_resource type="Texture2D" uid="uid://b1sese4p8sck3" path="res://assets/smallMap.png" id="1_vbegm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cusdydgg4b1bo" path="res://prefabs/braincell.tscn" id="2_6uqi0"]
|
[ext_resource type="PackedScene" uid="uid://cusdydgg4b1bo" path="res://prefabs/braincell.tscn" id="2_6uqi0"]
|
||||||
[ext_resource type="Script" uid="uid://b0djy8fmq4qjq" path="res://camera_2d.gd" id="5_ykrsh"]
|
[ext_resource type="Script" uid="uid://b0djy8fmq4qjq" path="res://camera_2d.gd" id="5_ykrsh"]
|
||||||
|
[ext_resource type="Script" uid="uid://btw5oi52pxy7d" path="res://apple_pit_man.gd" id="6_77dp3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://qpjwodeafyno" path="res://prefabs/apple.tscn" id="6_g14j6"]
|
[ext_resource type="PackedScene" uid="uid://qpjwodeafyno" path="res://prefabs/apple.tscn" id="6_g14j6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bl5py87o1qbgr" path="res://prefabs/wall.tscn" id="7_vbegm"]
|
[ext_resource type="PackedScene" uid="uid://bl5py87o1qbgr" path="res://prefabs/wall.tscn" id="7_vbegm"]
|
||||||
|
[ext_resource type="Script" uid="uid://cpav6iuq2hrns" path="res://uiman.gd" id="9_xersf"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dyxnlko6tpmui" path="res://icon.svg" id="11_77dp3"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_00tp4"]
|
||||||
|
font_size = 36
|
||||||
|
font_color = Color(1, 0, 0, 1)
|
||||||
|
outline_size = 8
|
||||||
|
outline_color = Color(1, 0.478431, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_00tp4"]
|
||||||
|
radius = 80.0
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_77dp3"]
|
||||||
|
radius = 80.0
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ehkex"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_ehkex"]
|
||||||
radius = 50.0
|
radius = 50.0
|
||||||
|
|
@ -36,10 +51,44 @@ is_head = true
|
||||||
|
|
||||||
[node name="Braincell" parent="Snake/SegementHolder/SnakeSegment" instance=ExtResource("2_6uqi0")]
|
[node name="Braincell" parent="Snake/SegementHolder/SnakeSegment" instance=ExtResource("2_6uqi0")]
|
||||||
|
|
||||||
|
[node name="ApplePit" type="Node2D" parent="Snake/SegementHolder/SnakeSegment" node_paths=PackedStringArray("snake_man", "count")]
|
||||||
|
script = ExtResource("6_77dp3")
|
||||||
|
snake_man = NodePath("../../..")
|
||||||
|
count = NodePath("Label")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Snake/SegementHolder/SnakeSegment/ApplePit"]
|
||||||
|
texture = ExtResource("11_77dp3")
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Snake/SegementHolder/SnakeSegment/ApplePit"]
|
||||||
|
offset_left = -80.0
|
||||||
|
offset_right = 80.0
|
||||||
|
offset_bottom = 80.0
|
||||||
|
text = "3"
|
||||||
|
label_settings = SubResource("LabelSettings_00tp4")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 2
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="Snake/SegementHolder/SnakeSegment/ApplePit"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Snake/SegementHolder/SnakeSegment/ApplePit/Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_00tp4")
|
||||||
|
debug_color = Color(0.988946, 0, 0.296194, 0.42)
|
||||||
|
|
||||||
[node name="SnakeSegment2" parent="Snake/SegementHolder" node_paths=PackedStringArray("next_segment") instance=ExtResource("1_8uh7m")]
|
[node name="SnakeSegment2" parent="Snake/SegementHolder" node_paths=PackedStringArray("next_segment") instance=ExtResource("1_8uh7m")]
|
||||||
position = Vector2(-320, 0)
|
position = Vector2(-320, 0)
|
||||||
next_segment = NodePath("../SnakeSegment")
|
next_segment = NodePath("../SnakeSegment")
|
||||||
|
|
||||||
|
[node name="AppleFurnace" type="Node2D" parent="Snake/SegementHolder/SnakeSegment2"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="Snake/SegementHolder/SnakeSegment2/AppleFurnace"]
|
||||||
|
texture = ExtResource("11_77dp3")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="Snake/SegementHolder/SnakeSegment2/AppleFurnace"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Snake/SegementHolder/SnakeSegment2/AppleFurnace/Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_77dp3")
|
||||||
|
debug_color = Color(0.878864, 0.340076, 3.85046e-07, 0.42)
|
||||||
|
|
||||||
[node name="SnakeSegment3" parent="Snake/SegementHolder" node_paths=PackedStringArray("next_segment") instance=ExtResource("1_8uh7m")]
|
[node name="SnakeSegment3" parent="Snake/SegementHolder" node_paths=PackedStringArray("next_segment") instance=ExtResource("1_8uh7m")]
|
||||||
position = Vector2(-640, 0)
|
position = Vector2(-640, 0)
|
||||||
next_segment = NodePath("../SnakeSegment2")
|
next_segment = NodePath("../SnakeSegment2")
|
||||||
|
|
@ -58,10 +107,10 @@ snake_line = NodePath("../Snake/Line2D")
|
||||||
player = NodePath("../Snake/SegementHolder/SnakeSegment/Braincell")
|
player = NodePath("../Snake/SegementHolder/SnakeSegment/Braincell")
|
||||||
|
|
||||||
[node name="Apple" parent="." instance=ExtResource("6_g14j6")]
|
[node name="Apple" parent="." instance=ExtResource("6_g14j6")]
|
||||||
position = Vector2(1276, -954)
|
position = Vector2(0, -640)
|
||||||
|
|
||||||
[node name="Apple2" parent="." instance=ExtResource("6_g14j6")]
|
[node name="Apple2" parent="." instance=ExtResource("6_g14j6")]
|
||||||
position = Vector2(960, 1280)
|
position = Vector2(640, 0)
|
||||||
|
|
||||||
[node name="Wall" parent="." instance=ExtResource("7_vbegm")]
|
[node name="Wall" parent="." instance=ExtResource("7_vbegm")]
|
||||||
position = Vector2(-160, -1920)
|
position = Vector2(-160, -1920)
|
||||||
|
|
@ -81,6 +130,41 @@ rotation = 1.5708
|
||||||
position = Vector2(-1600, -1600)
|
position = Vector2(-1600, -1600)
|
||||||
|
|
||||||
[node name="TestArea" type="Area2D" parent="."]
|
[node name="TestArea" type="Area2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TestArea"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TestArea"]
|
||||||
shape = SubResource("CircleShape2D_ehkex")
|
shape = SubResource("CircleShape2D_ehkex")
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("food_bar", "snake_manager")]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("9_xersf")
|
||||||
|
food_bar = NodePath("PanelContainer/HBoxContainer/ProgressBar")
|
||||||
|
snake_manager = NodePath("../../Snake")
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="CanvasLayer/Control"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 12
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Food:"
|
||||||
|
|
||||||
|
[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
step = 0.0
|
||||||
|
|
|
||||||
15
uiman.gd
Normal file
15
uiman.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
@export var food_bar : ProgressBar
|
||||||
|
@export var snake_manager : Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
food_bar.max_value = snake_manager.max_food
|
||||||
|
food_bar.value = snake_manager.food
|
||||||
1
uiman.gd.uid
Normal file
1
uiman.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cpav6iuq2hrns
|
||||||
Loading…
Add table
Add a link
Reference in a new issue