-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
545 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[gd_scene load_steps=5 format=2] | ||
|
||
[ext_resource path="res://sprites/objects/LaserBox.png" type="Texture" id=1] | ||
[ext_resource path="res://scenes/objects/LaserBoxPart.tscn" type="PackedScene" id=2] | ||
[ext_resource path="res://scripts/objects/LaserBox.gd" type="Script" id=3] | ||
|
||
[sub_resource type="RectangleShape2D" id=1] | ||
extents = Vector2( 32, 32 ) | ||
|
||
[node name="LaserBox" type="StaticBody2D"] | ||
collision_layer = 2 | ||
collision_mask = 0 | ||
script = ExtResource( 3 ) | ||
enableTop = true | ||
enableRight = true | ||
enableBottom = true | ||
enableLeft = true | ||
deactivate = 20 | ||
|
||
[node name="Sprite" type="Sprite" parent="."] | ||
scale = Vector2( 2, 2 ) | ||
texture = ExtResource( 1 ) | ||
|
||
[node name="Collision" type="CollisionShape2D" parent="."] | ||
shape = SubResource( 1 ) | ||
|
||
[node name="TopPart" parent="." instance=ExtResource( 2 )] | ||
position = Vector2( 0, -30 ) | ||
rotation = -1.5708 | ||
|
||
[node name="RightPart" parent="." instance=ExtResource( 2 )] | ||
position = Vector2( 30, 1 ) | ||
|
||
[node name="BottomPart" parent="." instance=ExtResource( 2 )] | ||
position = Vector2( 0, 30 ) | ||
rotation = 1.5708 | ||
|
||
[node name="LeftPart" parent="." instance=ExtResource( 2 )] | ||
position = Vector2( -30, 0 ) | ||
rotation = -3.14159 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[gd_scene load_steps=10 format=2] | ||
|
||
[ext_resource path="res://sprites/objects/LaserBoxPart.png" type="Texture" id=1] | ||
[ext_resource path="res://scripts/objects/LaserBoxPart.gd" type="Script" id=2] | ||
[ext_resource path="res://scripts/enemies/SetDamage.gd" type="Script" id=3] | ||
[ext_resource path="res://sprites/objects/LaserBoxDot2.png" type="Texture" id=4] | ||
[ext_resource path="res://sprites/objects/LaserBoxDot4.png" type="Texture" id=5] | ||
[ext_resource path="res://sprites/objects/LaserBoxDot3.png" type="Texture" id=6] | ||
[ext_resource path="res://sprites/objects/LaserBoxDot1.png" type="Texture" id=7] | ||
|
||
[sub_resource type="AnimatedTexture" id=2] | ||
flags = 2 | ||
frames = 4 | ||
fps = 12.0 | ||
frame_0/texture = ExtResource( 7 ) | ||
frame_1/texture = ExtResource( 4 ) | ||
frame_1/delay_sec = 0.0 | ||
frame_2/texture = ExtResource( 6 ) | ||
frame_2/delay_sec = 0.0 | ||
frame_3/texture = ExtResource( 5 ) | ||
frame_3/delay_sec = 0.0 | ||
|
||
[sub_resource type="RectangleShape2D" id=1] | ||
extents = Vector2( 1, 10 ) | ||
|
||
[node name="LaserBoxPart" type="RayCast2D"] | ||
enabled = true | ||
cast_to = Vector2( 1500, 0 ) | ||
collision_mask = 2 | ||
script = ExtResource( 2 ) | ||
|
||
[node name="Line" type="Line2D" parent="."] | ||
points = PoolVector2Array( 0, 0, 1500, 0 ) | ||
width = 0.0 | ||
default_color = Color( 1, 1, 1, 1 ) | ||
|
||
[node name="DotLine" type="Line2D" parent="."] | ||
self_modulate = Color( 1, 1, 1, 0.121569 ) | ||
points = PoolVector2Array( 0, 0, 1500, 0 ) | ||
width = 4.0 | ||
default_color = Color( 1, 1, 1, 1 ) | ||
texture = SubResource( 2 ) | ||
texture_mode = 1 | ||
|
||
[node name="Sprite" type="Sprite" parent="."] | ||
position = Vector2( 6, 0 ) | ||
scale = Vector2( 2, 2 ) | ||
texture = ExtResource( 1 ) | ||
|
||
[node name="Hitbox" type="Area2D" parent="."] | ||
collision_layer = 16 | ||
collision_mask = 0 | ||
monitoring = false | ||
script = ExtResource( 3 ) | ||
damage = 2 | ||
|
||
[node name="Collision" type="CollisionShape2D" parent="Hitbox"] | ||
position = Vector2( 750, 0 ) | ||
scale = Vector2( 750, 1 ) | ||
shape = SubResource( 1 ) | ||
disabled = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
tool | ||
extends StaticBody2D | ||
|
||
|
||
var timer = -1 | ||
|
||
export var enableTop = false | ||
export var enableRight = false | ||
export var enableBottom = false | ||
export var enableLeft = false | ||
|
||
export var activate = 0 | ||
export var deactivate = 30 | ||
export var loop = 60 | ||
|
||
|
||
onready var _top = $TopPart | ||
onready var _right = $RightPart | ||
onready var _bottom = $BottomPart | ||
onready var _left = $LeftPart | ||
|
||
|
||
func _physics_process(delta): | ||
show_parts() | ||
do_loop() | ||
|
||
|
||
func show_parts(): | ||
_top.visible = enableTop | ||
_bottom.visible = enableBottom | ||
_left.visible = enableLeft | ||
_right.visible = enableRight | ||
|
||
|
||
|
||
func do_loop(): | ||
timer += 1 | ||
if timer >= loop: | ||
timer = 0 | ||
|
||
if timer == activate: | ||
if enableTop: | ||
_top.activate() | ||
if enableRight: | ||
_right.activate() | ||
if enableBottom: | ||
_bottom.activate() | ||
if enableLeft: | ||
_left.activate() | ||
|
||
if timer == deactivate: | ||
if enableTop: | ||
_top.deactivate() | ||
if enableRight: | ||
_right.deactivate() | ||
if enableBottom: | ||
_bottom.deactivate() | ||
if enableLeft: | ||
_left.deactivate() |
Oops, something went wrong.