smaller map, eating apples, death
This commit is contained in:
parent
8c0860a840
commit
2c512d5764
12 changed files with 152 additions and 13 deletions
BIN
assets/apple.png
Normal file
BIN
assets/apple.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 530 B |
34
assets/apple.png.import
Normal file
34
assets/apple.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dmmdu0ayhmlnk"
|
||||||
|
path="res://.godot/imported/apple.png-d0c5a0e024efc439723035186c67a74a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/apple.png"
|
||||||
|
dest_files=["res://.godot/imported/apple.png-d0c5a0e024efc439723035186c67a74a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
BIN
assets/smallMap.png
Normal file
BIN
assets/smallMap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 372 B |
34
assets/smallMap.png.import
Normal file
34
assets/smallMap.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b1sese4p8sck3"
|
||||||
|
path="res://.godot/imported/smallMap.png-d58217680d47594e6bef5c91f3e22694.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/smallMap.png"
|
||||||
|
dest_files=["res://.godot/imported/smallMap.png-d58217680d47594e6bef5c91f3e22694.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
12
braincell.gd
12
braincell.gd
|
|
@ -9,12 +9,12 @@ var ready_to_door : bool = true
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
if not is_on_floor():
|
#if not is_on_floor():
|
||||||
velocity += get_gravity() * delta
|
#velocity += get_gravity() * delta
|
||||||
|
#
|
||||||
# Handle jump.
|
## Handle jump.
|
||||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
#if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||||
velocity.y = JUMP_VELOCITY
|
#velocity.y = JUMP_VELOCITY
|
||||||
|
|
||||||
# Get the input direction and handle the movement/deceleration.
|
# Get the input direction and handle the movement/deceleration.
|
||||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func _process(delta: float) -> void:
|
||||||
snake_line.z_index = 9
|
snake_line.z_index = 9
|
||||||
else:
|
else:
|
||||||
position = Vector2(0,0)
|
position = Vector2(0,0)
|
||||||
zoom = Vector2(0.05,0.05)
|
zoom = Vector2(0.1,0.1)
|
||||||
snake_line.modulate = Color(1,1,1,1)
|
snake_line.modulate = Color(1,1,1,1)
|
||||||
snake_line.z_index = 11
|
snake_line.z_index = 11
|
||||||
z_index = 1
|
z_index = 1
|
||||||
|
|
|
||||||
15
prefabs/apple.tscn
Normal file
15
prefabs/apple.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://qpjwodeafyno"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dmmdu0ayhmlnk" path="res://assets/apple.png" id="1_sblxh"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_5v1qd"]
|
||||||
|
radius = 50.0
|
||||||
|
|
||||||
|
[node name="Apple" type="Area2D" groups=["apple"]]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(10, 10)
|
||||||
|
texture = ExtResource("1_sblxh")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_5v1qd")
|
||||||
|
|
@ -61,3 +61,13 @@ func become_fake():
|
||||||
#modulate = Color.DIM_GRAY
|
#modulate = Color.DIM_GRAY
|
||||||
#collision_layer = 2
|
#collision_layer = 2
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_eat_die_box_area_entered(area: Area2D) -> void:
|
||||||
|
if(area.is_in_group("apple")):
|
||||||
|
area.queue_free()
|
||||||
|
print("mmm tasty apple")
|
||||||
|
if(area.is_in_group("wall")):
|
||||||
|
print("i die")
|
||||||
|
get_tree().get_root().process_mode = Node.PROCESS_MODE_DISABLED
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://bwoeu7ask0fck"]
|
[gd_scene load_steps=8 format=3 uid="uid://bwoeu7ask0fck"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b5cqo12km1nh3" path="res://prefabs/snake_segment.gd" id="1_3ulhv"]
|
[ext_resource type="Script" uid="uid://b5cqo12km1nh3" path="res://prefabs/snake_segment.gd" id="1_3ulhv"]
|
||||||
[ext_resource type="Texture2D" uid="uid://l8x3dp68yyxr" path="res://assets/segement.png" id="1_6uqch"]
|
[ext_resource type="Texture2D" uid="uid://l8x3dp68yyxr" path="res://assets/segement.png" id="1_6uqch"]
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_08kyq"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_08kyq"]
|
||||||
size = Vector2(8, 64)
|
size = Vector2(8, 64)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_08kyq"]
|
||||||
|
radius = 50.0
|
||||||
|
|
||||||
[node name="SnakeSegment" type="AnimatableBody2D" node_paths=PackedStringArray("door")]
|
[node name="SnakeSegment" type="AnimatableBody2D" node_paths=PackedStringArray("door")]
|
||||||
script = ExtResource("1_3ulhv")
|
script = ExtResource("1_3ulhv")
|
||||||
door = NodePath("DoorArm")
|
door = NodePath("DoorArm")
|
||||||
|
|
@ -49,3 +52,10 @@ 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="CollisionShape2D" type="CollisionShape2D" parent="EatDieBox"]
|
||||||
|
shape = SubResource("CircleShape2D_08kyq")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="EatDieBox" to="." method="_on_eat_die_box_area_entered"]
|
||||||
|
|
|
||||||
9
prefabs/wall.tscn
Normal file
9
prefabs/wall.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bl5py87o1qbgr"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_iy8pp"]
|
||||||
|
size = Vector2(6400, 320)
|
||||||
|
|
||||||
|
[node name="Wall" type="Area2D" groups=["wall"]]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_iy8pp")
|
||||||
|
|
@ -29,6 +29,11 @@ window/stretch/mode="canvas_items"
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/godot-donut-collision-polygon-2d-7780d026ae3d4a37fe68f43cc1f97ba664dd775d/addons/donut_collision_polygon2D/plugin.cfg")
|
enabled=PackedStringArray("res://addons/godot-donut-collision-polygon-2d-7780d026ae3d4a37fe68f43cc1f97ba664dd775d/addons/donut_collision_polygon2D/plugin.cfg")
|
||||||
|
|
||||||
|
[global_group]
|
||||||
|
|
||||||
|
apple=""
|
||||||
|
wall=""
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
left={
|
left={
|
||||||
|
|
|
||||||
32
test.tscn
32
test.tscn
|
|
@ -1,22 +1,24 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://daqqurdrnk61h"]
|
[gd_scene load_steps=8 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"]
|
||||||
[ext_resource type="Texture2D" uid="uid://byibhn8fi6ve0" path="res://assets/bg.png" id="1_ppyta"]
|
[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="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"]
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
position = Vector2(-160, -160)
|
position = Vector2(-160, -160)
|
||||||
scale = Vector2(320, 320)
|
scale = Vector2(320, 320)
|
||||||
texture = ExtResource("1_ppyta")
|
texture = ExtResource("1_vbegm")
|
||||||
|
|
||||||
[node name="Snake" type="Node2D" parent="." node_paths=PackedStringArray("segements_holder", "snake_line", "player")]
|
[node name="Snake" type="Node2D" parent="." node_paths=PackedStringArray("segements_holder", "snake_line", "player")]
|
||||||
script = ExtResource("1_6uqi0")
|
script = ExtResource("1_6uqi0")
|
||||||
segements_holder = NodePath("SegementHolder")
|
segements_holder = NodePath("SegementHolder")
|
||||||
SNAKE_SPEED = 0.3
|
SNAKE_SPEED = 0.6
|
||||||
snake_line = NodePath("Line2D")
|
snake_line = NodePath("Line2D")
|
||||||
player = NodePath("SegementHolder/SnakeSegment/Braincell")
|
player = NodePath("SegementHolder/SnakeSegment/Braincell")
|
||||||
|
|
||||||
|
|
@ -43,7 +45,27 @@ begin_cap_mode = 2
|
||||||
end_cap_mode = 2
|
end_cap_mode = 2
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("snake_line", "player")]
|
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("snake_line", "player")]
|
||||||
zoom = Vector2(0.05, 0.05)
|
zoom = Vector2(0.1, 0.1)
|
||||||
script = ExtResource("5_ykrsh")
|
script = ExtResource("5_ykrsh")
|
||||||
snake_line = NodePath("../Snake/Line2D")
|
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")]
|
||||||
|
position = Vector2(1276, -954)
|
||||||
|
|
||||||
|
[node name="Apple2" parent="." instance=ExtResource("6_g14j6")]
|
||||||
|
position = Vector2(960, 1280)
|
||||||
|
|
||||||
|
[node name="Wall" parent="." instance=ExtResource("7_vbegm")]
|
||||||
|
position = Vector2(-160, -1920)
|
||||||
|
|
||||||
|
[node name="Wall2" parent="." instance=ExtResource("7_vbegm")]
|
||||||
|
position = Vector2(-160, 1600)
|
||||||
|
|
||||||
|
[node name="Wall3" parent="." instance=ExtResource("7_vbegm")]
|
||||||
|
position = Vector2(-1920, -160)
|
||||||
|
rotation = 1.5708
|
||||||
|
|
||||||
|
[node name="Wall4" parent="." instance=ExtResource("7_vbegm")]
|
||||||
|
position = Vector2(1600, -160)
|
||||||
|
rotation = 1.5708
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue