Swordgit add .!
This commit is contained in:
parent
dced928e16
commit
ed0ee8de71
10
assets/items/sword.tres
Normal file
10
assets/items/sword.tres
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_resource type="Resource" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/classes/item.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://assets/items/sword.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
name = "sword"
|
||||||
|
inventory_icon = ExtResource( 2 )
|
||||||
|
consumable = false
|
||||||
|
|
@ -7,17 +7,22 @@ extends Interactable
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
export var item :Resource
|
export var item :Resource
|
||||||
|
|
||||||
var item_sprite :AnimatedSprite
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
assert( item is Item, "Proper Item resourse type not given " + self.name)
|
assert( item is Item, "Proper Item resourse type not given " + self.name)
|
||||||
if item is Item:
|
if item is Item:
|
||||||
item_sprite = AnimatedSprite.new()
|
if item.in_game_sprite != null:
|
||||||
item_sprite.frames = item.in_game_sprite
|
var anim_sprite = AnimatedSprite.new()
|
||||||
add_child(item_sprite)
|
anim_sprite.frames = item.in_game_sprite
|
||||||
item_sprite.play()
|
add_child(anim_sprite)
|
||||||
|
anim_sprite.play()
|
||||||
|
elif item.inventory_icon != null:
|
||||||
|
var sprite = Sprite.new()
|
||||||
|
sprite.texture = item.inventory_icon
|
||||||
|
add_child(sprite)
|
||||||
|
|
||||||
func trigger_interaction():
|
func trigger_interaction():
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=15 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
[ext_resource path="res://assets/UI/no_cam_tile.png" type="Texture" id=6]
|
[ext_resource path="res://assets/UI/no_cam_tile.png" type="Texture" id=6]
|
||||||
[ext_resource path="res://src/Interactables/ItemPickup.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://src/Interactables/ItemPickup.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://assets/items/doodad.tres" type="Resource" id=8]
|
[ext_resource path="res://assets/items/doodad.tres" type="Resource" id=8]
|
||||||
|
[ext_resource path="res://assets/items/sword.tres" type="Resource" id=9]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 5.09902
|
radius = 5.09902
|
||||||
|
|
@ -116,7 +117,7 @@ show_collision = true
|
||||||
collision_layer = 256
|
collision_layer = 256
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 524287, 0, 0, 589824, 0, 0, 589838, 0, 0 )
|
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 524304, 0, 0, 589824, 0, 0, 589838, 0, 0 )
|
||||||
|
|
||||||
[node name="ItemPickup" parent="." index="9" instance=ExtResource( 7 )]
|
[node name="ItemPickup" parent="." index="9" instance=ExtResource( 7 )]
|
||||||
position = Vector2( 203, 38 )
|
position = Vector2( 203, 38 )
|
||||||
|
|
@ -125,3 +126,11 @@ item = ExtResource( 8 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ItemPickup" index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ItemPickup" index="0"]
|
||||||
shape = SubResource( 6 )
|
shape = SubResource( 6 )
|
||||||
|
|
||||||
|
[node name="ItemPickup2" parent="." index="10" instance=ExtResource( 7 )]
|
||||||
|
position = Vector2( 155, 133 )
|
||||||
|
type_name = "item_pickup"
|
||||||
|
item = ExtResource( 9 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ItemPickup2" index="0"]
|
||||||
|
shape = SubResource( 6 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user