steam barrier enemy

This commit is contained in:
Haze Weathers 2023-02-24 21:52:52 -05:00
parent 8b247304e6
commit 30cfad6e7e
2 changed files with 61 additions and 0 deletions

23
objects/enemy/steam.gd Normal file
View file

@ -0,0 +1,23 @@
extends "res://objects/enemy/enemy.gd"
export var off_time = 1.0
export var on_time = 1.0
export var active = false
onready var particles = $SteamParticles
onready var collision_shape = $Hitbox/CollisionShape2D
var time = 0.0
func _physics_process(delta):
time += delta
if active && time >= on_time:
time -= on_time
active = false
collision_shape.disabled = true
particles.emitting = false
elif !active && time >= off_time:
time -= off_time
active = true
collision_shape.disabled = false
particles.emitting = true

38
objects/enemy/steam.tscn Normal file
View file

@ -0,0 +1,38 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://objects/enemy/steam.gd" type="Script" id=1]
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=2]
[sub_resource type="Curve" id=2]
_data = [ Vector2( 0, 0.291411 ), 0.0, 5.40019, 0, 0, Vector2( 0.263812, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -0.0915322, 0.0, 0, 0 ]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 2, 12 )
[node name="Steam" type="Node2D"]
script = ExtResource( 1 )
blood = false
off_time = 2.0
on_time = 2.0
[node name="SteamParticles" type="CPUParticles2D" parent="."]
position = Vector2( 4, 0 )
amount = 16
texture = ExtResource( 2 )
direction = Vector2( 0, -1 )
spread = 10.0
gravity = Vector2( 0, 0 )
initial_velocity = 51.55
damping = 50.0
angle = 720.0
angle_random = 1.0
scale_amount = 0.75
scale_amount_curve = SubResource( 2 )
[node name="Hitbox" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( 4, -12 )
shape = SubResource( 1 )
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]