Punch fist item for punch attack.

This commit is contained in:
Dustin 2025-04-07 20:35:43 -07:00
parent a0d3ded185
commit fc5898ce7a
9 changed files with 88 additions and 4 deletions

View File

@ -25,3 +25,4 @@ script = ExtResource( 1 )
name = "mushroom" name = "mushroom"
inventory_icon = ExtResource( 3 ) inventory_icon = ExtResource( 3 )
in_game_sprite = SubResource( 3 ) in_game_sprite = SubResource( 3 )
consumable = true

BIN
assets/items/fist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/fist.png-706e5fdb4c3a8f903a9552e9097a3a72.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/items/fist.png"
dest_files=[ "res://.import/fist.png-706e5fdb4c3a8f903a9552e9097a3a72.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

10
assets/items/punch.tres Normal file
View 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/fist.png" type="Texture" id=2]
[resource]
script = ExtResource( 1 )
name = "punch"
inventory_icon = ExtResource( 2 )
consumable = false

BIN
assets/items/sword.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sword.png-847a038487b8fb3480b77e98fb70eb52.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/items/sword.png"
dest_files=[ "res://.import/sword.png-847a038487b8fb3480b77e98fb70eb52.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -8,7 +8,7 @@ export var player_number: int = 1
onready var player_inventory :InventoryManager = InventoryManager.new() onready var player_inventory :InventoryManager = InventoryManager.new()
#var mushroom :Item = preload("res://assets/items/doodad.tres") var punch_item :Item = preload("res://assets/items/punch.tres")
# 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():
@ -17,8 +17,8 @@ func _ready():
# Set initial player position in world. # Set initial player position in world.
global_position = LevelInfo.player_start_position global_position = LevelInfo.player_start_position
# player_inventory.add_to_inventory(mushroom) player_inventory.add_to_inventory(punch_item)
# player_inventory.select_primary(mushroom) player_inventory.select_primary(punch_item)
@ -56,6 +56,6 @@ func touch_the_thing(the_thing: Interactable) -> bool:
the_thing.trigger_interaction() the_thing.trigger_interaction()
if the_thing is ItemPickup: if the_thing is ItemPickup:
player_inventory.add_to_inventory(the_thing.item) player_inventory.add_to_inventory(the_thing.item)
player_inventory.select_primary(the_thing.item) player_inventory.select_secondary(the_thing.item)
the_thing.trigger_interaction() the_thing.trigger_interaction()
return true return true

View File

@ -8,6 +8,7 @@ extends Resource
export var name :String export var name :String
export var inventory_icon :Texture export var inventory_icon :Texture
export var in_game_sprite :SpriteFrames export var in_game_sprite :SpriteFrames
export var consumable :bool = true
# 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():

View File

@ -17,3 +17,5 @@ func _process(delta):
if (PlayerInfo.player_inventory.primary_selection): if (PlayerInfo.player_inventory.primary_selection):
primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon
if (PlayerInfo.player_inventory.secondary_selection):
secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon