galo 1 год назад
Родитель
Сommit
2f7d1768b6
3 измененных файлов с 8 добавлено и 8 удалено
  1. 3 2
      main.tscn
  2. 3 3
      playerphysics.gd
  3. 2 3
      spawner.gd

+ 3 - 2
main.tscn

@@ -45,7 +45,7 @@ render_target_v_flip = true
 [node name="Goblin" type="AnimatedSprite" parent="Textures/Goblin1"]
 modulate = Color( 0, 0.811765, 1, 1 )
 frames = SubResource( 5 )
-frame = 1
+frame = 2
 playing = true
 offset = Vector2( 32, 32 )
 
@@ -57,7 +57,7 @@ render_target_v_flip = true
 
 [node name="Goblin" type="AnimatedSprite" parent="Textures/Goblin2"]
 frames = SubResource( 5 )
-frame = 3
+frame = 1
 speed_scale = 0.8
 playing = true
 offset = Vector2( 32, 32 )
@@ -85,6 +85,7 @@ render_target_v_flip = true
 [node name="Goblin" type="AnimatedSprite" parent="Textures/Goblin4"]
 modulate = Color( 1, 0, 0.984314, 1 )
 frames = SubResource( 5 )
+frame = 3
 speed_scale = 0.9
 playing = true
 offset = Vector2( 32, 32 )

+ 3 - 3
playerphysics.gd

@@ -16,10 +16,10 @@ var vida = 100
 
 func damage(arg, id):
 	vida += arg
-	if vida <= 0: 
-		vida = 0
+#	if vida <= 0: 
+#		vida = 0
 	get_node('../..').hp_update(vida, name)
-	if vida == 0: 
+	if vida <= 0: 
 		queue_free()
 
 func regenhp(arg):

+ 2 - 3
spawner.gd

@@ -72,10 +72,8 @@ func _physics_process(delta):
 				if dict.arraytarget[i] == null:
 					if get_node('../players').get_child_count() == 0: return
 					var array = get_node('../players').get_children()
-					array.shuffle()
 					if array.size() > 0:
-						dict.arraytarget[i] = array[0]
-						print(dict.arraytarget[i])
+						dict.arraytarget[i] = array[randi()%array.size()]
 
 #exclusive movmenet code
 				if fmod(tick, dict.arraydirtime[i]) == 0:
@@ -93,6 +91,7 @@ func _physics_process(delta):
 				var rot = rand_range(-PI,PI)
 				dict.arraypos[i] = (Vector2(sin(rot), cos(rot)) * rand_range(400,800)) + Vector2(320,180)
 				dict.arrayvida[i] = 100
+				dict.arraytarget[i] = null
 				death_count(dict.attacker[i])