Pew now has more pew.

This commit is contained in:
Dustin 2025-04-09 22:26:51 -07:00
parent 023e749833
commit 12da9e3334
4 changed files with 10 additions and 6 deletions

View File

@ -42,7 +42,9 @@ func shoot(direction = 1):
# t.origin = Vector2(position.x, position.y) # t.origin = Vector2(position.x, position.y)
# transform = t # transform = t
print("Fire Debug: ", direction, " Gun position: ", position, transform.origin) var normal_vector = (position * get_parent().transform.x).normalized()
print("Fire Debug: ", direction, " Gun position: ", get_parent().transform.x, position, normal_vector)
# position.x = position.x * direction #shifting position before fire was unreliable # position.x = position.x * direction #shifting position before fire was unreliable
if not timer.is_stopped(): if not timer.is_stopped():
return false return false
@ -53,6 +55,7 @@ func shoot(direction = 1):
# bullet.global_position = global_position - Vector2(position.x * 2, 0) # bullet.global_position = global_position - Vector2(position.x * 2, 0)
if bullet is Projectile: if bullet is Projectile:
bullet.global_position = global_position bullet.global_position = global_position
bullet.direction_normal = normal_vector
#bullet.linear_velocity = Vector2(direction * BULLET_VELOCITY, 0) #bullet.linear_velocity = Vector2(direction * BULLET_VELOCITY, 0)

View File

@ -85,7 +85,7 @@ states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8
[node name="AnimatedSprite_StateReceiver" parent="." index="1"] [node name="AnimatedSprite_StateReceiver" parent="." index="1"]
frames = ExtResource( 2 ) frames = ExtResource( 2 )
animation = "ledge-grab" animation = "attack-shoot"
script = ExtResource( 5 ) script = ExtResource( 5 )
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
@ -150,6 +150,6 @@ interactable_parent_callback = "touch_the_thing"
[node name="PewMachine" type="Position2D" parent="." index="11"] [node name="PewMachine" type="Position2D" parent="." index="11"]
unique_name_in_owner = true unique_name_in_owner = true
position = Vector2( 10, 1.36422e-12 ) position = Vector2( 21, -7 )
script = ExtResource( 28 ) script = ExtResource( 28 )
scene_path = ExtResource( 29 ) scene_path = ExtResource( 29 )

View File

@ -6,8 +6,8 @@ extends Area2D
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
var velocity_pps :float = 60 export var velocity_pps :float = 1
var direction_normal := Vector2(0,0)
# 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,7 +17,7 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
rotate(delta * 10) rotate(delta * 10)
position += Vector2(velocity_pps * delta, velocity_pps * delta) position += direction_normal * velocity_pps * delta
func _on_body_entered(body): func _on_body_entered(body):

View File

@ -8,6 +8,7 @@ radius = 6.0
height = 2.0 height = 2.0
[node name="MushroomPew" instance=ExtResource( 1 )] [node name="MushroomPew" instance=ExtResource( 1 )]
velocity_pps = 300.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 ) shape = SubResource( 1 )