Skip to content

Commit

Permalink
Gameplay adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dancovich committed May 27, 2021
1 parent 1aae795 commit 8457982
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 111 deletions.
20 changes: 19 additions & 1 deletion main_scene.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=16 format=2]

[ext_resource path="res://resources/font_outline_45.tres" type="DynamicFont" id=1]
[ext_resource path="res://resources/green_button01.png" type="Texture" id=2]
Expand All @@ -13,6 +13,7 @@
[ext_resource path="res://resources/XboxOne_Left_Stick.png" type="Texture" id=11]
[ext_resource path="res://main_scene.gd" type="Script" id=12]
[ext_resource path="res://resources/green_button02.png" type="Texture" id=13]
[ext_resource path="res://tilesets/stage.tres" type="TileSet" id=14]

[sub_resource type="Animation" id=1]
resource_name = "pulse"
Expand Down Expand Up @@ -64,6 +65,11 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 14 )
format = 1
tile_data = PoolIntArray( 0, 0, 327680, 1, 0, 327680, 2, 0, 327680, 3, 0, 327680, 4, 0, 327680, 5, 0, 327680, 6, 0, 327680, 7, 0, 327680, 8, 0, 327680, 9, 0, 327680, 10, 0, 327680, 11, 0, 327680, 12, 0, 327680, 13, 0, 327680, 14, 0, 327680, 15, 0, 327680, 16, 0, 327680, 17, 0, 327680, 18, 0, 327680, 19, 0, 327680, 65536, 0, 327680, 65537, 0, 327680, 65538, 0, 327680, 65539, 0, 327680, 65540, 0, 327680, 65541, 0, 327680, 65542, 0, 327680, 65543, 0, 327680, 65544, 0, 327680, 65545, 0, 327680, 65546, 0, 327680, 65547, 0, 327680, 65548, 0, 327680, 65549, 0, 327680, 65550, 0, 327680, 65551, 0, 327680, 65552, 0, 327680, 65553, 0, 327680, 65554, 0, 327680, 65555, 0, 327680, 131072, 0, 327680, 131073, 0, 327680, 131074, 0, 327680, 131075, 0, 327680, 131076, 0, 327680, 131077, 0, 327680, 131078, 0, 327680, 131079, 0, 327680, 131080, 0, 327680, 131081, 0, 327680, 131082, 0, 327680, 131083, 0, 327680, 131084, 0, 327680, 131085, 0, 327680, 131086, 0, 327680, 131087, 0, 327680, 131088, 0, 327680, 131089, 0, 327680, 131090, 0, 327680, 131091, 0, 327680, 196608, 0, 327680, 196609, 0, 327680, 196610, 0, 327680, 196611, 0, 327680, 196612, 0, 327680, 196613, 0, 327680, 196614, 0, 327680, 196615, 0, 327680, 196616, 0, 327680, 196617, 0, 327680, 196618, 0, 327680, 196619, 0, 327680, 196620, 0, 327680, 196621, 0, 327680, 196622, 0, 327680, 196623, 0, 327680, 196624, 0, 327680, 196625, 0, 327680, 196626, 0, 327680, 196627, 0, 327680, 262144, 0, 327680, 262145, 0, 327680, 262146, 0, 327680, 262147, 0, 327680, 262148, 0, 327680, 262149, 0, 327680, 262150, 0, 327680, 262151, 0, 327680, 262152, 0, 327680, 262153, 0, 327680, 262154, 0, 327680, 262155, 0, 327680, 262156, 0, 327680, 262157, 0, 327680, 262158, 0, 327680, 262159, 0, 327680, 262160, 0, 327680, 262161, 0, 327680, 262162, 0, 327680, 262163, 0, 327680, 327680, 0, 327680, 327681, 0, 327680, 327682, 0, 327680, 327683, 0, 327680, 327684, 0, 327680, 327685, 0, 327680, 327686, 0, 327680, 327687, 0, 327680, 327688, 0, 327680, 327689, 0, 327680, 327690, 0, 327680, 327691, 0, 327680, 327692, 0, 327680, 327693, 0, 327680, 327694, 0, 327680, 327695, 0, 327680, 327696, 0, 327680, 327697, 0, 327680, 327698, 0, 327680, 327699, 0, 327680, 393216, 0, 327680, 393217, 0, 327680, 393218, 0, 327680, 393219, 0, 327680, 393220, 0, 327680, 393221, 0, 327680, 393222, 0, 327680, 393223, 0, 327680, 393224, 0, 327680, 393225, 0, 327680, 393226, 0, 327680, 393227, 0, 327680, 393228, 0, 327680, 393229, 0, 327680, 393230, 0, 327680, 393231, 0, 327680, 393232, 0, 327680, 393233, 0, 327680, 393234, 0, 327680, 393235, 0, 327680, 458752, 0, 327680, 458753, 0, 327680, 458754, 0, 327680, 458755, 0, 327680, 458756, 0, 327680, 458757, 0, 327680, 458758, 0, 327680, 458759, 0, 327680, 458760, 0, 327680, 458761, 0, 327680, 458762, 0, 327680, 458763, 0, 327680, 458764, 0, 327680, 458765, 0, 327680, 458766, 0, 327680, 458767, 0, 327680, 458768, 0, 327680, 458769, 0, 327680, 458770, 0, 327680, 458771, 0, 327680, 524288, 0, 327680, 524289, 0, 327680, 524290, 0, 327680, 524291, 0, 327680, 524292, 0, 327680, 524293, 0, 327680, 524294, 0, 327680, 524295, 0, 327680, 524296, 0, 327680, 524297, 0, 327680, 524298, 0, 327680, 524299, 0, 327680, 524300, 0, 327680, 524301, 0, 327680, 524302, 0, 327680, 524303, 0, 327680, 524304, 0, 327680, 524305, 0, 327680, 524306, 0, 327680, 524307, 0, 327680, 589824, 0, 327680, 589825, 0, 327680, 589826, 0, 327680, 589827, 0, 327680, 589828, 0, 327680, 589829, 0, 327680, 589830, 0, 327680, 589831, 0, 327680, 589832, 0, 327680, 589833, 0, 327680, 589834, 0, 327680, 589835, 0, 327680, 589836, 0, 327680, 589837, 0, 327680, 589838, 0, 327680, 589839, 0, 327680, 589840, 0, 327680, 589841, 0, 327680, 589842, 0, 327680, 589843, 0, 327680, 655360, 0, 327680, 655361, 0, 327680, 655362, 0, 327680, 655363, 0, 327680, 655364, 0, 327680, 655365, 0, 327680, 655366, 0, 327680, 655367, 0, 327680, 655368, 0, 327680, 655369, 0, 327680, 655370, 0, 327680, 655371, 0, 327680, 655372, 0, 327680, 655373, 0, 327680, 655374, 0, 327680, 655375, 0, 327680, 655376, 0, 327680, 655377, 0, 327680, 655378, 0, 327680, 655379, 0, 327680, 720896, 0, 327680, 720897, 0, 327680, 720898, 0, 327680, 720899, 0, 327680, 720900, 0, 327680, 720901, 0, 327680, 720902, 0, 327680, 720903, 0, 327680, 720904, 0, 327680, 720905, 0, 327680, 720906, 0, 327680, 720907, 0, 327680, 720908, 0, 327680, 720909, 0, 327680, 720910, 0, 327680, 720911, 0, 327680, 720912, 0, 327680, 720913, 0, 327680, 720914, 0, 327680, 720915, 0, 327680 )

[node name="Title" type="Sprite" parent="."]
position = Vector2( 637.469, 223.614 )
texture = ExtResource( 4 )
Expand Down Expand Up @@ -147,4 +153,16 @@ anims/pulse = SubResource( 1 )

[node name="ControlsAnimation" type="AnimationPlayer" parent="."]

[node name="Copyright" type="Label" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -407.0
margin_top = -47.0
margin_right = -10.0
margin_bottom = -10.0
custom_fonts/font = ExtResource( 5 )
text = "© Danilo (Dancovich)"

[connection signal="pressed" from="TextureButton" to="." method="_on_start_pressed"]
4 changes: 2 additions & 2 deletions snake/snake.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ signal food_eaten(snake, food)
signal food_swallowed(snake, qtd_food_swallowed)
signal dead

const SPEED := 200.0
const SPEED := 220.0
const ROTATION_SPEED := 2.2
const DEFAULT_SIZE := 0.85
const SIZE_INCREMENT := 0.2
const SIZE_INCREMENT := 0.08

export var snake_body: PackedScene = preload("res://snake/snake_body_part.tscn")

Expand Down
2 changes: 1 addition & 1 deletion snake/snake_body_part.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ext_resource path="res://snake/snake_body_part.gd" type="Script" id=2]

[sub_resource type="CircleShape2D" id=1]
radius = 28.5643
radius = 26.7813

[node name="SnakeBodyPart" type="Area2D"]
collision_layer = 2
Expand Down
2 changes: 1 addition & 1 deletion snake/snake_head.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class_name SnakeHead
extends Area2D

const BASE_SIZE := 78.0
const BASE_COLLISION_RADIUS := 38.0
const BASE_COLLISION_RADIUS := 35.0

onready var _sprite: Sprite = $Sprite
onready var _collision: CollisionShape2D = $Collision
Expand Down
4 changes: 2 additions & 2 deletions snake/snake_head.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
[ext_resource path="res://snake/snake_head.gd" type="Script" id=2]

[sub_resource type="CircleShape2D" id=1]
radius = 37.9039
radius = 35.0

[node name="SnakeHead" type="Area2D"]
collision_mask = 12
script = ExtResource( 2 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
offset = Vector2( 0, 5 )
offset = Vector2( 0, 6 )
region_enabled = true
region_rect = Rect2( 0, 0, 80, 91 )

Expand Down
3 changes: 2 additions & 1 deletion stage/stage.gd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func reset_game() -> void:
var entities: Node2D = $Entities

for entity in entities.get_children():
entity.remove_from_group("spawn_obstacles")
entity.queue_free()

spawn_snake()
Expand Down Expand Up @@ -177,7 +178,7 @@ func _on_food_eaten(snake: Snake, food: Food) -> void:
_node_multiplier.text = "x" + str(_multiplier)

func _on_food_swallowed(snake: Snake, qtd_food_swallowed: int) -> void:
_score += int(round(qtd_food_swallowed * _multiplier))
_score += int(round(qtd_food_swallowed * _multiplier)) * 10
_node_score.text = str(_score)
_multiplier = 1.0
_node_multiplier.text = "x" + str(_multiplier)
Expand Down
108 changes: 5 additions & 103 deletions stage/stage.tscn
Original file line number Diff line number Diff line change
@@ -1,109 +1,11 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://tilesets/sheet.png" type="Texture" id=1]
[ext_resource path="res://tilesets/stage.tres" type="TileSet" id=1]
[ext_resource path="res://resources/font_outline_50.tres" type="DynamicFont" id=2]
[ext_resource path="res://resources/font_whiteoutline_80.tres" type="DynamicFont" id=3]
[ext_resource path="res://stage/stage.gd" type="Script" id=5]
[ext_resource path="res://stage/gameover_screen.tscn" type="PackedScene" id=8]

[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 56, 0, 70, 0, 70, 70, 0, 70, 0, 56, 56, 56 )

[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 14, 0, 14, 56, 70, 56, 70, 70, 0, 70, 0, 0 )

[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 70, 70, 56, 70, 56, 0, 70, 0 )

[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 14, 70, 0, 70, 0, 0, 14, 0 )

[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 70, 0, 70, 70, 56, 70, 56, 14, 0, 14 )

[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 70, 0, 0, 70, 0, 70, 14, 14, 14, 14, 70 )

[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 70, 70, 0, 70, 0, 56, 70, 56 )

[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 70, 14, 0, 14, 0, 0, 70, 0 )

[sub_resource type="TileSet" id=9]
0/name = "sheet.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 420, 490 )
0/tile_mode = 1
0/autotile/bitmask_mode = 1
0/autotile/bitmask_flags = [ Vector2( 0, 5 ), 21299386, Vector2( 0, 6 ), 327738, Vector2( 1, 2 ), 65562, Vector2( 1, 3 ), 262194, Vector2( 2, 0 ), 4259994, Vector2( 2, 1 ), 17039538, Vector2( 2, 4 ), 4194456, Vector2( 2, 5 ), 16777392, Vector2( 4, 3 ), 20971704 ]
0/autotile/icon_coordinate = Vector2( 0, 5 )
0/autotile/tile_size = Vector2( 70, 70 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 1 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 1, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 6 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0

[node name="Stage" type="Node2D"]
script = ExtResource( 5 )

Expand All @@ -129,9 +31,9 @@ __meta__ = {
}

[node name="Score" type="Label" parent="Hud"]
margin_left = 187.694
margin_left = 150.694
margin_top = 26.0
margin_right = 210.694
margin_right = 173.694
margin_bottom = 87.0
rect_min_size = Vector2( 23, 61 )
custom_fonts/font = ExtResource( 2 )
Expand All @@ -144,7 +46,7 @@ __meta__ = {

[node name="TileMap" type="TileMap" parent="."]
position = Vector2( 10, 10.488 )
tile_set = SubResource( 9 )
tile_set = ExtResource( 1 )
cell_size = Vector2( 70, 70 )
collision_layer = 8
collision_mask = 3
Expand Down
101 changes: 101 additions & 0 deletions tilesets/stage.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[gd_resource type="TileSet" load_steps=10 format=2]

[ext_resource path="res://tilesets/sheet.png" type="Texture" id=1]

[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 56, 0, 70, 0, 70, 70, 0, 70, 0, 56, 56, 56 )

[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 14, 0, 14, 56, 70, 56, 70, 70, 0, 70, 0, 0 )

[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 70, 70, 56, 70, 56, 0, 70, 0 )

[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 14, 70, 0, 70, 0, 0, 14, 0 )

[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 70, 0, 70, 70, 56, 70, 56, 14, 0, 14 )

[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 70, 0, 0, 70, 0, 70, 14, 14, 14, 14, 70 )

[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 70, 70, 0, 70, 0, 56, 70, 56 )

[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 70, 14, 0, 14, 0, 0, 70, 0 )

[resource]
0/name = "sheet.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 420, 490 )
0/tile_mode = 1
0/autotile/bitmask_mode = 1
0/autotile/bitmask_flags = [ Vector2( 0, 5 ), 21299386, Vector2( 0, 6 ), 327738, Vector2( 1, 2 ), 65562, Vector2( 1, 3 ), 262194, Vector2( 2, 0 ), 4259994, Vector2( 2, 1 ), 17039538, Vector2( 2, 4 ), 4194456, Vector2( 2, 5 ), 16777392, Vector2( 4, 3 ), 20971704 ]
0/autotile/icon_coordinate = Vector2( 0, 5 )
0/autotile/tile_size = Vector2( 70, 70 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 1 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 1, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 5 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 6 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0

0 comments on commit 8457982

Please sign in to comment.