Skip to content

Commit

Permalink
У врага появились жизни и урон от снарядов
Browse files Browse the repository at this point in the history
  • Loading branch information
Allespro committed Apr 23, 2019
1 parent b26436a commit 5b6b99c
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .import/amg1_bk1.png-030132975b8230ef880eedf5c61c605b.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="b5c935cd630a1ae65ae370a5866771b3"
dest_md5="c148e6f6cae2843eba7990a6de070358"
dest_md5="963e3f7c79db5f3aebb5187890c6be6e"

Binary file modified .import/amg1_bk1.png-030132975b8230ef880eedf5c61c605b.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_bk2.png-2380b47d2f707432e332b78737eb4060.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="4662762a869a130b3f48f0da852f3a57"
dest_md5="c18aa7eaff091acea896909d46da8c3e"
dest_md5="f463ec304944466ef996ff21302d9b5b"

Binary file modified .import/amg1_bk2.png-2380b47d2f707432e332b78737eb4060.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_fr1.png-462c45c0aa6b7e685b7bcd9b30fab3a4.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="aaf16ebbc2e817b5f321c79b80708dae"
dest_md5="dea02330cf7c595cfb735df6a7f812a7"
dest_md5="04eaa086274695806aed6e9748e0862d"

Binary file modified .import/amg1_fr1.png-462c45c0aa6b7e685b7bcd9b30fab3a4.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_fr2.png-4710f8052bb4d0e97500d14c848f8a04.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="57aea223614b603deae1e50ed8c4cff1"
dest_md5="fd30040b5ba51cb6c2136b6360058973"
dest_md5="ba16374ecf1e650192dfd82619adc978"

Binary file modified .import/amg1_fr2.png-4710f8052bb4d0e97500d14c848f8a04.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_lf1.png-e054fe75857017589bf8e0614d33db2c.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="8815b99c223feb3b87943850897ddbda"
dest_md5="2adb7c0ae3bcb18ccb9413417c5fb738"
dest_md5="ee1b9d9bf13d04f4844eac5553b1f594"

Binary file modified .import/amg1_lf1.png-e054fe75857017589bf8e0614d33db2c.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_lf2.png-f0de760f5e5fc2246364a8aab1fbb7ef.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="4bfb364168f227da44b32e95ea68df81"
dest_md5="83365ef8a0d5a83be63764340b0b848b"
dest_md5="90b16aa1fe89ee71f10dc85a53bd9cc7"

Binary file modified .import/amg1_lf2.png-f0de760f5e5fc2246364a8aab1fbb7ef.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_rt1.png-ea08426d9b587d5fd6272284ce8c4274.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="76ae883507e61bef46426bdbc72811a9"
dest_md5="157712c138b3e2a86cb5d24a87cf8835"
dest_md5="3cb43707b548483615c69971ca30dbb2"

Binary file modified .import/amg1_rt1.png-ea08426d9b587d5fd6272284ce8c4274.stex
Binary file not shown.
2 changes: 1 addition & 1 deletion .import/amg1_rt2.png-fc7299c3b439d6cbdddd23865c013f2d.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="b0e391b200eeee2190a7779a8bd0c449"
dest_md5="951b3813b75f107fe289372319c544e5"
dest_md5="8009ba60faa0e92b216cebb60c5f1454"

Binary file modified .import/amg1_rt2.png-fc7299c3b439d6cbdddd23865c013f2d.stex
Binary file not shown.
31 changes: 30 additions & 1 deletion Enemy1.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=18 format=2]

[ext_resource path="res://KinematicEnemy1.gd" type="Script" id=1]
[ext_resource path="res://enemy/amg1_lf1.png" type="Texture" id=2]
Expand All @@ -10,6 +10,9 @@
[ext_resource path="res://enemy/amg1_fr1.png" type="Texture" id=8]
[ext_resource path="res://enemy/amg1_fr2.png" type="Texture" id=9]
[ext_resource path="res://Enemy/KnightBody.gd" type="Script" id=10]
[ext_resource path="res://images/pixel_under_health.png" type="Texture" id=11]
[ext_resource path="res://images/health_bar.png" type="Texture" id=12]
[ext_resource path="res://images/pixel_health.png" type="Texture" id=13]

[sub_resource type="CapsuleShape2D" id=1]
radius = 15.6866
Expand Down Expand Up @@ -41,9 +44,13 @@ animations = [ {
[sub_resource type="CircleShape2D" id=3]
radius = 148.282

[sub_resource type="CircleShape2D" id=4]
radius = 23.0975

[node name="Enemy1" type="Node2D"]

[node name="KinematicEnemy1" type="KinematicBody2D" parent="."]
scale = Vector2( 0.7, 0.7 )
script = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicEnemy1"]
Expand All @@ -56,11 +63,33 @@ animation = "RIGHT"
[node name="Body" type="Area2D" parent="KinematicEnemy1" groups=[
"noheavy",
]]
editor/display_folded = true
visible = false
script = ExtResource( 10 )

[node name="CollisionShape2D2" type="CollisionShape2D" parent="KinematicEnemy1/Body"]
position = Vector2( -0.71698, 0 )
shape = SubResource( 3 )

[node name="HitZone" type="Area2D" parent="KinematicEnemy1"]
editor/display_folded = true
visible = false

[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicEnemy1/HitZone"]
shape = SubResource( 4 )

[node name="HealthBar" type="TextureProgress" parent="KinematicEnemy1"]
margin_left = -12.7624
margin_top = -21.5248
margin_right = 11.2376
margin_bottom = -18.5248
value = 20.0
texture_under = ExtResource( 11 )
texture_over = ExtResource( 12 )
texture_progress = ExtResource( 13 )
fill_mode = 1
nine_patch_stretch = true

[connection signal="area_entered" from="KinematicEnemy1/Body" to="KinematicEnemy1/Body" method="_on_Body_area_entered"]
[connection signal="area_exited" from="KinematicEnemy1/Body" to="KinematicEnemy1/Body" method="_on_Body_area_exited"]
[connection signal="area_entered" from="KinematicEnemy1/HitZone" to="KinematicEnemy1" method="_on_HitZone_area_entered"]
14 changes: 12 additions & 2 deletions KinematicEnemy1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ extends KinematicBody2D

var IsPlayerNear = false
var SPEED = 120
var health = 100
var PlayerPos = Vector2(0,0)

func _physics_process(delta):
$HealthBar.set_value(health)
if(health <= 0):
queue_free()
if(IsPlayerNear == true):
PlayerPos.x = $"../../../../KinematicPlayer".global_position.x - self.global_position.x
PlayerPos.y = $"../../../../KinematicPlayer".global_position.y - self.global_position.y
Expand All @@ -16,6 +20,12 @@ func _physics_process(delta):

func attack():
IsPlayerNear = true

func stop_attack():
IsPlayerNear = false
IsPlayerNear = false

func _on_HitZone_area_entered(area):
var groups = area.get_groups()
if (groups.has("player")):
print("EEEEBOYYY")
if (groups.has("bullet")):
health -= 10
2 changes: 1 addition & 1 deletion enemy/amg1_bk1.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_bk2.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_fr1.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_fr2.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_lf1.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_lf2.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_rt1.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
2 changes: 1 addition & 1 deletion enemy/amg1_rt2.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
Expand Down
1 change: 0 additions & 1 deletion player/Bullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ script = ExtResource( 1 )
position = Vector2( -5.32552, 0 )
scale = Vector2( 0.470545, 0.470545 )
frames = SubResource( 1 )
frame = 1
playing = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="BulletArea"]
Expand Down
9 changes: 4 additions & 5 deletions player/bars.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
[node name="CanvasLayer" type="CanvasLayer"]

[node name="Player_bars" type="Control" parent="."]
editor/display_folded = true
margin_right = 40.0
margin_bottom = 40.0

[node name="player1_health_bar" type="TextureProgress" parent="Player_bars"]
anchor_top = 0.5
anchor_bottom = 0.5
margin_left = 1121.0
margin_top = 636.0
margin_right = 1289.0
margin_bottom = 647.0
margin_left = 1121.31
margin_top = 636.307
margin_right = 1289.31
margin_bottom = 647.307
step = 0.005
value = 30.0
texture_under = ExtResource( 1 )
Expand Down

0 comments on commit 5b6b99c

Please sign in to comment.