Skip to content

Commit

Permalink
Merge branch 'master' of github.com:BUG-inc/ant
Browse files Browse the repository at this point in the history
  • Loading branch information
diogoalmeida committed Nov 25, 2021
2 parents 843e254 + 861677b commit 2090be0
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 23 deletions.
16 changes: 8 additions & 8 deletions entities/base_ant.gd
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ func _process(_delta: float) -> void:
set_state(State.WALKING)

func _update_animation(dir: Vector2) -> void:
if dir.x > 0:
active_sprite.flip_h = false

if dir.x < 0:
active_sprite.flip_h = true

if !is_equal_approx(velocity.length(), 0):
rotation = atan2(velocity.y, velocity.x) + PI/2
if _current_state == State.ATTACKING:
rotation = atan2(_dir.y, _dir.x) + PI/2
else:
active_sprite.flip_h = dir.x > 0
active_sprite.flip_h = dir.x < 0
if !is_equal_approx(velocity.length(), 0):
rotation = atan2(velocity.y, velocity.x) + PI/2

if _current_state != State.DEAD or not _death_animation_finished:
$AnimationPlayer.play(STATE_NAMES[_current_state])

Expand Down
310 changes: 305 additions & 5 deletions entities/base_ant.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,54 @@ tracks/10/keys = {
"update": 0,
"values": [ Color( 1, 1, 1, 1 ) ]
}
tracks/11/type = "value"
tracks/11/path = NodePath("Default:position")
tracks/11/interp = 1
tracks/11/loop_wrap = true
tracks/11/imported = false
tracks/11/enabled = true
tracks/11/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 5.96046e-08, 0 ) ]
}
tracks/12/type = "value"
tracks/12/path = NodePath("Miner:position")
tracks/12/interp = 1
tracks/12/loop_wrap = true
tracks/12/imported = false
tracks/12/enabled = true
tracks/12/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 9.83477e-07, -8.04663e-07 ) ]
}
tracks/13/type = "value"
tracks/13/path = NodePath("Miner:rotation_degrees")
tracks/13/interp = 1
tracks/13/loop_wrap = true
tracks/13/imported = false
tracks/13/enabled = true
tracks/13/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/14/type = "value"
tracks/14/path = NodePath("Chief:rotation_degrees")
tracks/14/interp = 1
tracks/14/loop_wrap = true
tracks/14/imported = false
tracks/14/enabled = true
tracks/14/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}

[sub_resource type="Animation" id=45]
resource_name = "attacking"
Expand Down Expand Up @@ -227,10 +275,22 @@ tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0, 0.48 ),
"transitions": PoolRealArray( 61.8199, 42.2243 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -2 ) ]
"times": PoolRealArray( 0, 0.52, 0.8 ),
"transitions": PoolRealArray( 61.8199, 42.2243, 1 ),
"update": 1,
"values": [ Vector2( 0, 0 ), Vector2( 0, -15 ), Vector2( 0, 0 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Default:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0, 0.52, 0.8 ),
"transitions": PoolRealArray( 132.514, 73.5168, 1 ),
"update": 1,
"values": [ Vector2( 5.96046e-08, 0 ), Vector2( 0, -15 ), Vector2( 0, 0 ) ]
}

[sub_resource type="Animation" id=51]
Expand Down Expand Up @@ -312,6 +372,54 @@ tracks/4/keys = {
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 0.32549, 0.113725, 0.113725, 1 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Default:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 5.96046e-08, 0 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Default:rotation_degrees")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Chief:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ) ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("Chief:rotation_degrees")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}

[sub_resource type="Animation" id=50]
resource_name = "hurting"
Expand Down Expand Up @@ -417,6 +525,102 @@ tracks/3/keys = {
"update": 1,
"values": [ 0 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Chief:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Chief:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Enemy:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Enemy:rotation_degrees")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("Miner:position")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 9.83477e-07, -8.04663e-07 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath("Miner:rotation_degrees")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/10/type = "value"
tracks/10/path = NodePath("Default:position")
tracks/10/interp = 1
tracks/10/loop_wrap = true
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 5.96046e-08, 0 ) ]
}
tracks/11/type = "value"
tracks/11/path = NodePath("Default:rotation_degrees")
tracks/11/interp = 1
tracks/11/loop_wrap = true
tracks/11/imported = false
tracks/11/enabled = true
tracks/11/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}

[sub_resource type="Animation" id=46]
resource_name = "walking"
Expand Down Expand Up @@ -470,11 +674,108 @@ tracks/3/keys = {
"update": 1,
"values": [ 0, 1, 2, 3 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Default:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 5.96046e-08, 0 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Default:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Miner:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 9.83477e-07, -8.04663e-07 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Miner:rotation_degrees")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("Enemy:position")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath("Enemy:rotation_degrees")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/10/type = "value"
tracks/10/path = NodePath("Chief:position")
tracks/10/interp = 1
tracks/10/loop_wrap = true
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ) ]
}
tracks/11/type = "value"
tracks/11/path = NodePath("Chief:rotation_degrees")
tracks/11/interp = 1
tracks/11/loop_wrap = true
tracks/11/imported = false
tracks/11/enabled = true
tracks/11/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}

[node name="base_ant" type="KinematicBody2D"]
scale = Vector2( 0.4, 0.4 )
collision_mask = 12
script = ExtResource( 5 )
hit_points = 1

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.57254
Expand Down Expand Up @@ -522,7 +823,6 @@ anims/walking = SubResource( 46 )
visible = false
scale = Vector2( 2, 2 )
texture = ExtResource( 3 )
offset = Vector2( 0, 0.0650516 )
hframes = 4

[connection signal="body_entered" from="interaction_field" to="." method="_on_interaction_field_body_entered"]
Expand Down
2 changes: 1 addition & 1 deletion entities/coins.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ func collect():

func _shrink():
scale.x = resource_size_scale * (total_resources / max_resources) + scale_offset
scale.y = resource_size_scale * (total_resources / max_resources) + scale_offset
scale.y = resource_size_scale * (total_resources / max_resources) + scale_offset
Loading

0 comments on commit 2090be0

Please sign in to comment.