Merge pull request 'hand to hand weapon' (#8) from slash_weapon into main
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
commit
7ffc756b36
6 files changed
+106
-15
No files matched your search
@@ -7,3 +7,5 @@ extends Node
|
||||
var death_counter = 3
|
||||
var cassets = 0
|
||||
var doing_puzzle: bool = false
|
||||
var hurtable = false
|
||||
var weapon = 1
|
||||
@@ -21,6 +21,8 @@ GloblaData="*uid://chv42jjv2lka4"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=2000
|
||||
window/size/viewport_height=1000
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
@@ -85,6 +87,16 @@ fire={
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(150, 14),"global_position":Vector2(159, 62),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
slash_weapon={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
gun={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
||||
+11
-2
@@ -4,6 +4,7 @@ extends CharacterBody2D
|
||||
var SPEED = Vector2(5, 0)
|
||||
const JUMP_VELOCITY = -400.0
|
||||
@onready var projectile: PackedScene = preload("res://scenes/projectile.tscn")
|
||||
var death_counter = 3
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +16,12 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if death_counter == 2:
|
||||
$ColorRect4.hide()
|
||||
if death_counter == 1:
|
||||
$ColorRect3.hide()
|
||||
if death_counter == 0:
|
||||
queue_free()
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
patrol()
|
||||
@@ -30,8 +37,10 @@ func _on_timer_timeout() -> void:
|
||||
|
||||
|
||||
func _on_area_2d_area_entered(area: Area2D) -> void:
|
||||
queue_free()
|
||||
|
||||
if GloblaData.hurtable:
|
||||
death_counter -= 1
|
||||
elif GloblaData.weapon == 2:
|
||||
death_counter -= 1
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
GloblaData.death_counter -= 1
|
||||
@@ -31,6 +31,27 @@ collision_mask = 11
|
||||
position = Vector2(84, 79)
|
||||
shape = SubResource("RectangleShape2D_yg5ta")
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="." unique_id=797261471]
|
||||
offset_left = 4.0
|
||||
offset_top = -56.0
|
||||
offset_right = 44.0
|
||||
offset_bottom = -16.0
|
||||
color = Color(0, 1, 0, 1)
|
||||
|
||||
[node name="ColorRect3" type="ColorRect" parent="." unique_id=76071947]
|
||||
offset_left = 61.0
|
||||
offset_top = -57.0
|
||||
offset_right = 101.0
|
||||
offset_bottom = -17.0
|
||||
color = Color(0, 1, 0, 1)
|
||||
|
||||
[node name="ColorRect4" type="ColorRect" parent="." unique_id=526458105]
|
||||
offset_left = 126.0
|
||||
offset_top = -58.0
|
||||
offset_right = 166.0
|
||||
offset_bottom = -18.0
|
||||
color = Color(0, 1, 0, 1)
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
+35
-8
@@ -6,6 +6,9 @@
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d2by0"]
|
||||
size = Vector2(111, 105)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"]
|
||||
size = Vector2(11.886017, 125.91957)
|
||||
|
||||
[node name="player" type="CharacterBody2D" unique_id=1596338883]
|
||||
position = Vector2(510, 410)
|
||||
collision_mask = 22
|
||||
@@ -49,19 +52,43 @@ position = Vector2(112, 38)
|
||||
position = Vector2(57, 54)
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=519077191]
|
||||
offset_left = -314.0
|
||||
offset_top = -265.0
|
||||
offset_right = -281.0
|
||||
offset_bottom = -231.0
|
||||
offset_left = -722.0
|
||||
offset_top = -416.0
|
||||
offset_right = -689.0
|
||||
offset_bottom = -382.0
|
||||
theme_override_fonts/font = ExtResource("2_g2els")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "0"
|
||||
|
||||
[node name="Label2" type="Label" parent="." unique_id=1907510281]
|
||||
offset_left = -516.0
|
||||
offset_top = -266.0
|
||||
offset_right = -264.0
|
||||
offset_bottom = -232.0
|
||||
offset_left = -924.0
|
||||
offset_top = -417.0
|
||||
offset_right = -672.0
|
||||
offset_bottom = -383.0
|
||||
theme_override_fonts/font = ExtResource("2_g2els")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "cassets:"
|
||||
|
||||
[node name="ColorRect5" type="ColorRect" parent="." unique_id=823301403]
|
||||
offset_left = 107.0
|
||||
offset_top = 47.0
|
||||
offset_right = 119.0
|
||||
offset_bottom = 177.0
|
||||
rotation = -2.268928
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="ColorRect5" unique_id=1787254827]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColorRect5/Area2D" unique_id=1167506979]
|
||||
position = Vector2(5.6205444, 65.769745)
|
||||
shape = SubResource("RectangleShape2D_aqe1g")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." unique_id=331042830]
|
||||
wait_time = 0.1
|
||||
|
||||
[node name="Marker2D2" type="Marker2D" parent="." unique_id=354625466]
|
||||
position = Vector2(11, 54)
|
||||
|
||||
[node name="Marker2D3" type="Marker2D" parent="." unique_id=2052549441]
|
||||
position = Vector2(107, 48)
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
@@ -46,7 +46,7 @@ var direction = 0
|
||||
@export_range(0, 0.5) var coyoteTime: float = 0.2
|
||||
##The window of time (in seconds) that your player can press the jump button before hitting the ground and still have their input registered as a jump. This is set to 0.2 seconds by default.
|
||||
@export_range(0, 0.5) var jumpBuffering: float = 0.2
|
||||
|
||||
var slash = 300
|
||||
#INFO EXTRAS
|
||||
@export_category("Wall Jumping")
|
||||
##Allows your player to jump off of walls. Without a Wall Kick Angle, the player will be able to scale the wall.
|
||||
@@ -162,7 +162,7 @@ var death_counter = 3
|
||||
var anim = PlayerSprite
|
||||
var col
|
||||
var animScaleLock : Vector2
|
||||
|
||||
var weapon = 1
|
||||
#Input Variables for the whole script
|
||||
var upHold
|
||||
var downHold
|
||||
@@ -324,20 +324,36 @@ func _process(_delta):
|
||||
var dir: bool = 1
|
||||
|
||||
func _physics_process(delta):
|
||||
if Input.is_action_just_pressed("slash_weapon"):
|
||||
weapon = 1
|
||||
GloblaData.weapon = 1
|
||||
if Input.is_action_just_pressed("gun"):
|
||||
weapon = 2
|
||||
GloblaData.weapon = 2
|
||||
if GloblaData.doing_puzzle == true:
|
||||
$".".global_position = $"../Marker2D2".global_position
|
||||
$Label.text = str(int(GloblaData.cassets))
|
||||
if Input.is_action_pressed("right"):
|
||||
if Input.is_action_just_pressed("right"):
|
||||
dir = 1
|
||||
if Input.is_action_pressed("left"):
|
||||
$ColorRect5.global_position = $Marker2D3.global_position
|
||||
$ColorRect5.rotation = 130
|
||||
if Input.is_action_just_pressed("left"):
|
||||
$ColorRect5.global_position = $Marker2D2.global_position
|
||||
$ColorRect5.rotation = -130
|
||||
dir = 0
|
||||
if GloblaData.doing_puzzle == false:
|
||||
if Input.is_action_just_pressed("fire"):
|
||||
if Input.is_action_just_pressed("fire") and weapon == 2:
|
||||
var instance = projectile.instantiate()
|
||||
if !dir:
|
||||
instance.speed = -instance.speed
|
||||
instance.position = $Marker2D.global_position
|
||||
GloblaData.level_1.add_child(instance)
|
||||
elif Input.is_action_just_pressed("fire") and weapon == 1:
|
||||
$ColorRect5.rotation -= slash
|
||||
slash = -slash
|
||||
GloblaData.hurtable = true
|
||||
$Timer.start()
|
||||
|
||||
if GloblaData.death_counter == 0:
|
||||
get_tree().quit()
|
||||
if GloblaData.death_counter == 2:
|
||||
@@ -698,3 +714,7 @@ func _placeHolder():
|
||||
|
||||
func shoot():
|
||||
pass
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
GloblaData.hurtable = false
|
||||
Reference in new issue
Block a user