Skip to content

Commit

Permalink
Cambio de los sprites de los enemigos en duelo, creación de animacion…
Browse files Browse the repository at this point in the history
…es y barras de vida de los enemigos.
  • Loading branch information
SeindElBardo committed Jun 7, 2021
1 parent 354ff7c commit 9957a03
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 39 deletions.
22 changes: 22 additions & 0 deletions assets/animations/slime_fire.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_resource type="SpriteFrames" load_steps=3 format=2]

[ext_resource path="res://assets/prototipos/enemigos/enemy_slime_fire.png" type="Texture" id=1]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f2.png" type="Texture" id=2]

[resource]
animations = [ {
"frames": [ ExtResource( 1 ) ],
"loop": true,
"name": "idle",
"speed": 4.0
}, {
"frames": [ ExtResource( 2 ) ],
"loop": false,
"name": "dead",
"speed": 5.0
}, {
"frames": [ ExtResource( 1 ) ],
"loop": false,
"name": "attack",
"speed": 5.0
} ]
22 changes: 22 additions & 0 deletions assets/animations/slime_normal.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_resource type="SpriteFrames" load_steps=3 format=2]

[ext_resource path="res://assets/prototipos/enemigos/enemy_slime_normal.png" type="Texture" id=1]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f2.png" type="Texture" id=2]

[resource]
animations = [ {
"frames": [ ExtResource( 1 ) ],
"loop": true,
"name": "idle",
"speed": 4.0
}, {
"frames": [ ExtResource( 2 ) ],
"loop": false,
"name": "dead",
"speed": 5.0
}, {
"frames": [ ExtResource( 1 ) ],
"loop": false,
"name": "attack",
"speed": 5.0
} ]
31 changes: 31 additions & 0 deletions assets/animations/slime_original.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[gd_resource type="SpriteFrames" load_steps=12 format=2]

[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f1.png" type="Texture" id=1]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f3.png" type="Texture" id=2]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f1.png" type="Texture" id=3]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f0.png" type="Texture" id=4]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f2.png" type="Texture" id=5]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f2.png" type="Texture" id=6]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f0.png" type="Texture" id=7]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f0.png" type="Texture" id=8]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f2.png" type="Texture" id=9]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f3.png" type="Texture" id=10]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f1.png" type="Texture" id=11]

[resource]
animations = [ {
"frames": [ ExtResource( 7 ), ExtResource( 1 ), ExtResource( 6 ), ExtResource( 2 ), ExtResource( 8 ), ExtResource( 11 ), ExtResource( 9 ), ExtResource( 10 ) ],
"loop": true,
"name": "idle",
"speed": 4.0
}, {
"frames": [ ExtResource( 4 ), ExtResource( 3 ), ExtResource( 5 ) ],
"loop": false,
"name": "dead",
"speed": 5.0
}, {
"frames": [ ExtResource( 9 ), null, ExtResource( 9 ), null, ExtResource( 9 ) ],
"loop": false,
"name": "attack",
"speed": 5.0
} ]
Binary file added assets/gris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/rojo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 19 additions & 34 deletions real_deal/scenes/duel/DuelEnemy.tscn
Original file line number Diff line number Diff line change
@@ -1,50 +1,35 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://real_deal/scripts/duel/DuelEnemy.gd" type="Script" id=1]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f0.png" type="Texture" id=2]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f2.png" type="Texture" id=3]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f0.png" type="Texture" id=4]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f1.png" type="Texture" id=5]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f1.png" type="Texture" id=6]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f2.png" type="Texture" id=7]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_run_anim_f3.png" type="Texture" id=8]
[ext_resource path="res://assets/prototipos/characters_sprites/swampy_idle_anim_f3.png" type="Texture" id=9]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f0.png" type="Texture" id=10]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f1.png" type="Texture" id=11]
[ext_resource path="res://assets/prototipos/characters_sprites/skelet_idle_anim_f2.png" type="Texture" id=12]
[ext_resource path="res://assets/animations/slime_normal.tres" type="SpriteFrames" id=2]
[ext_resource path="res://assets/gris.png" type="Texture" id=3]
[ext_resource path="res://assets/rojo.png" type="Texture" id=4]

[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 5 ), ExtResource( 3 ), ExtResource( 9 ), ExtResource( 4 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ) ],
"loop": true,
"name": "idle",
"speed": 4.0
}, {
"frames": [ ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ) ],
"loop": false,
"name": "dead",
"speed": 5.0
}, {
"frames": [ ExtResource( 7 ), null, ExtResource( 7 ), null, ExtResource( 7 ) ],
"loop": false,
"name": "attack",
"speed": 5.0
} ]

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 8.05047, 8.16186 )
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 108.893, 93.6324 )

[node name="Battle_Enemy_Swampy" type="Area2D"]
scale = Vector2( 2, 2 )
script = ExtResource( 1 )

[node name="Character" type="AnimatedSprite" parent="."]
frames = SubResource( 1 )
frames = ExtResource( 2 )
animation = "idle"
flip_h = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
shape = SubResource( 1 )

[node name="HealthBar" type="TextureProgress" parent="."]
margin_left = -108.505
margin_top = 83.9132
margin_right = 108.495
margin_bottom = 98.9132
texture_under = ExtResource( 3 )
texture_progress = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="card_target" from="." to="." method="_on_Battle_Enemy_Swampy_card_target"]
[connection signal="not_card_target" from="." to="." method="_on_Battle_Enemy_Swampy_not_card_target"]
[connection signal="playCard" from="." to="." method="_on_Battle_Enemy_Swampy_playCard"]
Expand Down
11 changes: 9 additions & 2 deletions real_deal/scripts/duel/DuelEnemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ func set_data(enemy_data):
enemy_data["max_energy"],
enemy_data["max_energy"]
)
$HealthBar.max_value = enemy_data["max_health"]
$HealthBar.value = $HealthBar.max_value
self.enemy_name = enemy_data["name"]
$Character.frames = load("res://assets/animations/{}.tres".format([enemy_data["animation"]], "{}"))
$Character.animation = "idle"
self.enemy_class = enemy_data["class"]
self.type = enemy_data["type"]
self.level = enemy_data["level"]
self.strategy = enemy_data["strategy"]
self.skills = enemy_data["skills"]
self.loot = self._generate_loot(enemy_data["loot"])

func modify_health(amount):
.modify_health(amount)
$HealthBar.value += amount

func _generate_loot(loot_posibilities):
var loot = []
Expand All @@ -55,13 +62,13 @@ func _on_Battle_Enemy_Swampy_card_target():
""" Start being a targeteable object
"""
get_tree().call_group("card", "get_target", self)
#print("Enable target")
print("Enable target")


func _on_Battle_Enemy_Swampy_not_card_target():
self.mouse_over = false
get_tree().call_group("card", "get_target", false)
#print("Disable target")
print("Disable target")


func select_card():
Expand Down
2 changes: 1 addition & 1 deletion real_deal/scripts/exploration/actors/enemy_group.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class_name EnemyGroup

# El grupo se define por los nombres de los enemigos que lo componen.
# Todos sus datos son accesibles con el nombre en la base de datos.
export var enemies = ["normal_slime", "normal_slime"]
export var enemies = ["normal_slime"]#, "fire_slime"]


# Called when the node enters the scene tree for the first time.
Expand Down
4 changes: 3 additions & 1 deletion real_deal/scripts/map/actors/Enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class_name Enemy
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var enemies = ["normal_slime", "normal_slime"]
export var enemies = ["normal_slime", "fire_slime", "fire_slime"]

# Called when the node enters the scene tree for the first time.
func _ready():
Expand All @@ -15,3 +15,5 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

# MIRAR PORQUE ESTE SCRIPT Y EL DE ENEMY GROUP ESTÁN DUPLICADOS
4 changes: 3 additions & 1 deletion real_deal/scripts/utils/enemies_database.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ func _ready():
const DATA = {
"normal_slime": {
"name": "Slime",
"scene": preload("res://real_deal/scenes/duel/DuelEnemy.tscn"),
"scene": preload("res://real_deal/scenes/duel/DuelEnemy.tscn"), # Quizá ésta habría que quitarla
"animation": "slime_normal",
"class": "slime",
"type": "ordinary",
"level": 1, # Algunas cosas podrías ser calculadas con funciones en el futuro
Expand Down Expand Up @@ -34,6 +35,7 @@ const DATA = {
"fire_slime": {
"name": "Fire Slime",
"scene": preload("res://real_deal/scenes/duel/DuelEnemy.tscn"),
"animation": "slime_fire",
"class": "slime",
"type": "ordinary",
"level": 2, # Algunas cosas podrías ser calculadas con funciones en el futuro
Expand Down

0 comments on commit 9957a03

Please sign in to comment.