Changes the grid size to be 40 instead of 20px
							parent
							
								
									a0bcea4697
								
							
						
					
					
						commit
						d405ab5846
					
				| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
size = Vector2(18, 18)
 | 
					size = Vector2(18, 18)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_kum7e"]
 | 
					[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_kum7e"]
 | 
				
			||||||
size = Vector2(20, 20)
 | 
					size = Vector2(40, 40)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Fruit" type="Area2D" groups=["BlocksSpawn"]]
 | 
					[node name="Fruit" type="Area2D" groups=["BlocksSpawn"]]
 | 
				
			||||||
script = ExtResource("1_o20pv")
 | 
					script = ExtResource("1_o20pv")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,10 @@
 | 
				
			||||||
[gd_scene load_steps=5 format=3 uid="uid://gkqku38yb2ng"]
 | 
					[gd_scene load_steps=5 format=3 uid="uid://gkqku38yb2ng"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_51e2h"]
 | 
					[sub_resource type="RectangleShape2D" id="RectangleShape2D_51e2h"]
 | 
				
			||||||
 | 
					size = Vector2(40, 40)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="QuadMesh" id="QuadMesh_tumq0"]
 | 
					[sub_resource type="QuadMesh" id="QuadMesh_tumq0"]
 | 
				
			||||||
size = Vector2(21.5, 21.5)
 | 
					size = Vector2(43, 43)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="Gradient" id="Gradient_k5f4k"]
 | 
					[sub_resource type="Gradient" id="Gradient_k5f4k"]
 | 
				
			||||||
interpolation_mode = 2
 | 
					interpolation_mode = 2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,8 @@
 | 
				
			||||||
[node name="Main" type="Node2D"]
 | 
					[node name="Main" type="Node2D"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Level" parent="." instance=ExtResource("1_bo1nx")]
 | 
					[node name="Level" parent="." instance=ExtResource("1_bo1nx")]
 | 
				
			||||||
position = Vector2(620, 320)
 | 
					position = Vector2(640, 320)
 | 
				
			||||||
scale = Vector2(50, 30)
 | 
					scale = Vector2(24, 14)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Timer" type="Timer" parent="." groups=["GameClock"]]
 | 
					[node name="Timer" type="Timer" parent="." groups=["GameClock"]]
 | 
				
			||||||
wait_time = 0.3
 | 
					wait_time = 0.3
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,18 @@ position = Vector2(420, 240)
 | 
				
			||||||
[node name="Fruit" parent="." instance=ExtResource("3_8gbba")]
 | 
					[node name="Fruit" parent="." instance=ExtResource("3_8gbba")]
 | 
				
			||||||
position = Vector2(707, 325)
 | 
					position = Vector2(707, 325)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Fruit2" parent="." instance=ExtResource("3_8gbba")]
 | 
				
			||||||
 | 
					position = Vector2(707, 325)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Fruit3" parent="." instance=ExtResource("3_8gbba")]
 | 
				
			||||||
 | 
					position = Vector2(707, 325)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Fruit4" parent="." instance=ExtResource("3_8gbba")]
 | 
				
			||||||
 | 
					position = Vector2(707, 325)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Fruit5" parent="." instance=ExtResource("3_8gbba")]
 | 
				
			||||||
 | 
					position = Vector2(707, 325)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="RestartTimer" type="Timer" parent="." groups=["GameClockPause"]]
 | 
					[node name="RestartTimer" type="Timer" parent="." groups=["GameClockPause"]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[connection signal="area_exited" from="Level" to="SnakePart" method="_on_level_area_exited"]
 | 
					[connection signal="area_exited" from="Level" to="SnakePart" method="_on_level_area_exited"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
size = Vector2(18, 18)
 | 
					size = Vector2(18, 18)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_kum7e"]
 | 
					[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_kum7e"]
 | 
				
			||||||
size = Vector2(20, 20)
 | 
					size = Vector2(40, 40)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="SnakePart" type="Area2D" groups=["BlocksSpawn"]]
 | 
					[node name="SnakePart" type="Area2D" groups=["BlocksSpawn"]]
 | 
				
			||||||
script = ExtResource("1_iuiyg")
 | 
					script = ExtResource("1_iuiyg")
 | 
				
			||||||
| 
						 | 
					@ -18,17 +18,17 @@ shape = SubResource("RectangleShape2D_hf2pu")
 | 
				
			||||||
texture = SubResource("PlaceholderTexture2D_kum7e")
 | 
					texture = SubResource("PlaceholderTexture2D_kum7e")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="DownRayCast2D" type="RayCast2D" parent="."]
 | 
					[node name="DownRayCast2D" type="RayCast2D" parent="."]
 | 
				
			||||||
target_position = Vector2(0, 30)
 | 
					target_position = Vector2(0, 60)
 | 
				
			||||||
collide_with_areas = true
 | 
					collide_with_areas = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="LeftRayCast2D" type="RayCast2D" parent="."]
 | 
					[node name="LeftRayCast2D" type="RayCast2D" parent="."]
 | 
				
			||||||
target_position = Vector2(-30, 0)
 | 
					target_position = Vector2(-60, 0)
 | 
				
			||||||
collide_with_areas = true
 | 
					collide_with_areas = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="UpRayCast2D" type="RayCast2D" parent="."]
 | 
					[node name="UpRayCast2D" type="RayCast2D" parent="."]
 | 
				
			||||||
target_position = Vector2(0, -30)
 | 
					target_position = Vector2(0, -60)
 | 
				
			||||||
collide_with_areas = true
 | 
					collide_with_areas = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="RightRayCast2D" type="RayCast2D" parent="."]
 | 
					[node name="RightRayCast2D" type="RayCast2D" parent="."]
 | 
				
			||||||
target_position = Vector2(30, 0)
 | 
					target_position = Vector2(60, 0)
 | 
				
			||||||
collide_with_areas = true
 | 
					collide_with_areas = true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
extends Area2D
 | 
					extends Area2D
 | 
				
			||||||
class_name Fruit
 | 
					class_name Fruit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TILE_SIZE = 20
 | 
					const TILE_SIZE = 40
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var all_positions : Array[Vector2] = []
 | 
					var all_positions : Array[Vector2] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,10 @@ func respawn() -> void:
 | 
				
			||||||
	for obstacle in obstacles:
 | 
						for obstacle in obstacles:
 | 
				
			||||||
		if obstacle is Area2D:
 | 
							if obstacle is Area2D:
 | 
				
			||||||
			possible_positions.erase(obstacle.position)
 | 
								possible_positions.erase(obstacle.position)
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
						if possible_positions.is_empty():
 | 
				
			||||||
 | 
							queue_free()
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var chosen_position = possible_positions.pick_random()
 | 
						var chosen_position = possible_positions.pick_random()
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
extends Area2D
 | 
					extends Area2D
 | 
				
			||||||
class_name SnakePart
 | 
					class_name SnakePart
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TILE_SIZE = 20
 | 
					const TILE_SIZE = 40
 | 
				
			||||||
enum PartTypes {HEAD, BODY, TAIL}
 | 
					enum PartTypes {HEAD, BODY, TAIL}
 | 
				
			||||||
enum States {ALIVE, DEAD, OUROBOROS, OLD_OUROBOROS}
 | 
					enum States {ALIVE, DEAD, OUROBOROS, OLD_OUROBOROS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue