Skip to content

Commit

Permalink
Extra 4
Browse files Browse the repository at this point in the history
Crossbow
  • Loading branch information
MateuSai committed Feb 21, 2022
1 parent a1aa923 commit 9445f46
Show file tree
Hide file tree
Showing 20 changed files with 393 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .import/Arrow.png-b56f04d1758996141f2ed93e732b5504.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="97a1aad633916f32016c83d8e6d26c85"
dest_md5="5f230eceb13bee0eb1f9668d48296c23"

Binary file not shown.
3 changes: 3 additions & 0 deletions .import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="267539b6fe85a306ba3094d840700091"
dest_md5="c1ce6c9d1400ca0fcd5281b7209524ed"

Binary file not shown.
Binary file added Art/Arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions Art/Arrow.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Art/Arrow.png"
dest_files=[ "res://.import/Arrow.png-b56f04d1758996141f2ed93e732b5504.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=false
svg/scale=1.0
Binary file added Art/Crossbow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions Art/Crossbow.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Art/Crossbow.png"
dest_files=[ "res://.import/Crossbow.png-1c44d5a236fb4e3633b253c8aa061ca9.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=false
svg/scale=1.0
2 changes: 1 addition & 1 deletion Characters/Enemies/Goblin/Goblin.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends Enemy

const THROWABLE_KNIFE_SCENE: PackedScene = preload("res://Characters/Enemies/Goblin/ThrowableKnike.tscn")
const THROWABLE_KNIFE_SCENE: PackedScene = preload("res://Characters/Enemies/Goblin/ThrowableKnife.tscn")

const MAX_DISTANCE_TO_PLAYER: int = 80
const MIN_DISTANCE_TO_PLAYER: int = 40
Expand Down
5 changes: 5 additions & 0 deletions Characters/Enemies/Goblin/ThrowableKnife.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://Weapons/Projectile.tscn" type="PackedScene" id=1]

[node name="ThrowableKnife" instance=ExtResource( 1 )]
7 changes: 6 additions & 1 deletion Rooms/SpawnRoom1.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://Rooms/Room.tscn" type="PackedScene" id=1]
[ext_resource path="res://Rooms/Furniture and Traps/Door.tscn" type="PackedScene" id=2]
[ext_resource path="res://Rooms/Furniture and Traps/Torch.tscn" type="PackedScene" id=3]
[ext_resource path="res://Weapons/Crossbow.tscn" type="PackedScene" id=4]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 32, 24 )
Expand Down Expand Up @@ -33,3 +34,7 @@ position = Vector2( 56, 24 )

[node name="Torch2" parent="." index="10" instance=ExtResource( 3 )]
position = Vector2( 168, 104 )

[node name="Crossbow" parent="." index="11" instance=ExtResource( 4 )]
position = Vector2( 166, 70 )
on_floor = true
18 changes: 18 additions & 0 deletions Weapons/Arrow.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://Weapons/Projectile.tscn" type="PackedScene" id=1]
[ext_resource path="res://Art/Arrow.png" type="Texture" id=2]

[sub_resource type="CapsuleShape2D" id=1]
resource_local_to_scene = true
radius = 1.41421
height = 15.5564

[node name="Arrow" instance=ExtResource( 1 )]
collision_mask = 2

[node name="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 )

[node name="Sprite" parent="." index="1"]
texture = ExtResource( 2 )
15 changes: 15 additions & 0 deletions Weapons/Crossbow.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends Weapon

const ARROW_SCENE: PackedScene = preload("res://Weapons/Arrow.tscn")


func shoot(offset: int) -> void:
var arrow: Area2D = ARROW_SCENE.instance()
get_tree().current_scene.add_child(arrow)
arrow.launch(global_position, Vector2.LEFT.rotated(deg2rad(rotation_degrees + offset)), 400)


func triple_shoot() -> void:
shoot(0)
shoot(12)
shoot(-12)
234 changes: 234 additions & 0 deletions Weapons/Crossbow.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
[gd_scene load_steps=13 format=2]

[ext_resource path="res://Weapons/Weapon.tscn" type="PackedScene" id=1]
[ext_resource path="res://Weapons/Crossbow.gd" type="Script" id=2]
[ext_resource path="res://Art/Crossbow.png" type="Texture" id=3]
[ext_resource path="res://Characters/Player/White.gdshader" type="Shader" id=4]
[ext_resource path="res://Art/19+ icons/iceB.png" type="Texture" id=5]

[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
shader = ExtResource( 4 )
shader_param/active = false

[sub_resource type="CapsuleShape2D" id=1]
radius = 7.0
height = 2.0

[sub_resource type="Animation" id=7]
resource_name = "active_ability"
length = 0.6
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1 ),
"transitions": PoolRealArray( 1, 1 ),
"values": [ {
"args": [ ],
"method": "triple_shoot"
}, {
"args": [ ],
"method": "triple_shoot"
} ]
}

[sub_resource type="Animation" id=3]
resource_local_to_scene = true
resource_name = "attack"
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ 0 ],
"method": "shoot"
} ]
}

[sub_resource type="Animation" id=4]
resource_local_to_scene = true
resource_name = "cancel_attack"
length = 0.3
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite/ChargeParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Node2D/Sprite:material:shader_param/active")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}

[sub_resource type="Animation" id=5]
resource_local_to_scene = true
resource_name = "charge"
length = 1.2
step = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite:material:shader_param/active")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0.2, 0.4, 0.6, 0.8, 1 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ true, false, true, false, true ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Node2D/Sprite/ChargeParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 1.2 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}

[sub_resource type="Animation" id=6]
resource_local_to_scene = true
resource_name = "strong_attack"
length = 0.7
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite:material:shader_param/active")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Node2D/Sprite/ChargeParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "triple_shoot"
} ]
}

[node name="Crossbow" instance=ExtResource( 1 )]
script = ExtResource( 2 )
ranged_weapon = true
rotation_offset = 180

[node name="Sprite" parent="Node2D" index="0"]
material = SubResource( 2 )
position = Vector2( 0, -3 )
texture = ExtResource( 3 )

[node name="CollisionShape2D" parent="Node2D/Sprite/Hitbox" index="0"]
disabled = false

[node name="CollisionShape2D" parent="PlayerDetector" index="0"]
position = Vector2( -9, -1 )
rotation = 1.5708
shape = SubResource( 1 )

[node name="AnimationPlayer" parent="." index="2"]
anims/active_ability = SubResource( 7 )
anims/attack = SubResource( 3 )
anims/cancel_attack = SubResource( 4 )
anims/charge = SubResource( 5 )
anims/strong_attack = SubResource( 6 )

[node name="AbilityIcon" parent="UI" index="0"]
texture_under = ExtResource( 5 )
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func _on_ThrowableKnike_body_exited(_body: KinematicBody) -> void:
enemy_exited = true
set_collision_mask_bit(0, true)
set_collision_mask_bit(1, true)
set_collision_mask_bit(2, true)
set_collision_mask_bit(3, true)


func _collide(body: KinematicBody2D) -> void:
Expand Down
Loading

0 comments on commit 9445f46

Please sign in to comment.