forked from team-sg/hero-mark-2
laser wall enemy
This commit is contained in:
parent
c2d473a993
commit
95da126f17
5 changed files with 105 additions and 2 deletions
BIN
graphics/enemy/laser_wall.png
Normal file
BIN
graphics/enemy/laser_wall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 625 B |
35
graphics/enemy/laser_wall.png.import
Normal file
35
graphics/enemy/laser_wall.png.import
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/laser_wall.png-4fb7af6c3027dd56a2c4a083903f0911.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://graphics/enemy/laser_wall.png"
|
||||||
|
dest_files=[ "res://.import/laser_wall.png-4fb7af6c3027dd56a2c4a083903f0911.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=true
|
||||||
|
svg/scale=1.0
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=28 format=2]
|
[gd_scene load_steps=29 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://tilesets/t_cave.tres" type="TileSet" id=2]
|
[ext_resource path="res://tilesets/t_cave.tres" type="TileSet" id=2]
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
[ext_resource path="res://objects/enemy/tin.tscn" type="PackedScene" id=20]
|
[ext_resource path="res://objects/enemy/tin.tscn" type="PackedScene" id=20]
|
||||||
[ext_resource path="res://graphics/enemy/sawblade.png" type="Texture" id=21]
|
[ext_resource path="res://graphics/enemy/sawblade.png" type="Texture" id=21]
|
||||||
[ext_resource path="res://objects/enemy/rolling_fiend.tscn" type="PackedScene" id=22]
|
[ext_resource path="res://objects/enemy/rolling_fiend.tscn" type="PackedScene" id=22]
|
||||||
|
[ext_resource path="res://objects/enemy/laser_wall.tscn" type="PackedScene" id=23]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 16, 20 )
|
extents = Vector2( 16, 20 )
|
||||||
|
@ -68,7 +69,7 @@ tile_set = ExtResource( 3 )
|
||||||
cell_size = Vector2( 8, 8 )
|
cell_size = Vector2( 8, 8 )
|
||||||
collision_layer = 9
|
collision_layer = 9
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( 393234, 0, 65537, 393235, 0, 65537, 393240, 0, 65537, 393241, 0, 65537, 983064, 0, 65537, 1048579, 0, 65537, 1048580, 0, 65537, 1048581, 0, 65537, 1048582, 0, 65537, 1048583, 0, 65537, 1114125, 0, 0, 1114126, 0, 0, 1310734, 0, 0, 1310735, 0, 0, 1310736, 0, 0, 1310738, 0, 0, 1310739, 0, 0, 1310740, 0, 0, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 1, 1507329, 0, 1, 1507330, 0, 1, 1507331, 0, 1, 1507332, 0, 1, 1507333, 0, 1, 1507334, 0, 1, 1507335, 0, 1, 1507336, 0, 1, 1507337, 0, 1, 1507338, 0, 1, 1507339, 0, 1, 1507340, 0, 1, 1507341, 0, 1, 1507342, 0, 1, 1507343, 0, 1, 1507344, 0, 1, 1507345, 0, 1, 1507346, 0, 1, 1507347, 0, 1, 1507348, 0, 1, 1507349, 0, 1, 1507350, 0, 1, 1507351, 0, 1, 1507352, 0, 1, 1507353, 0, 1, 1507354, 0, 1, 1507355, 0, 1, 1507356, 0, 1, 1507357, 0, 1, 1507358, 0, 1, 1507359, 0, 1 )
|
tile_data = PoolIntArray( 393234, 0, 65537, 393235, 0, 65537, 393240, 0, 65537, 393241, 0, 65537, 851986, 0, 0, 851987, 0, 0, 851988, 0, 0, 851989, 0, 0, 851990, 0, 0, 983064, 0, 65537, 1048579, 0, 65537, 1048580, 0, 65537, 1048581, 0, 65537, 1048582, 0, 65537, 1048583, 0, 65537, 1114125, 0, 0, 1114126, 0, 0, 1310734, 0, 0, 1310735, 0, 0, 1310736, 0, 0, 1310738, 0, 0, 1310739, 0, 0, 1310740, 0, 0, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 1, 1507329, 0, 1, 1507330, 0, 1, 1507331, 0, 1, 1507332, 0, 1, 1507333, 0, 1, 1507334, 0, 1, 1507335, 0, 1, 1507336, 0, 1, 1507337, 0, 1, 1507338, 0, 1, 1507339, 0, 1, 1507340, 0, 1, 1507341, 0, 1, 1507342, 0, 1, 1507343, 0, 1, 1507344, 0, 1, 1507345, 0, 1, 1507346, 0, 1, 1507347, 0, 1, 1507348, 0, 1, 1507349, 0, 1, 1507350, 0, 1, 1507351, 0, 1, 1507352, 0, 1, 1507353, 0, 1, 1507354, 0, 1, 1507355, 0, 1, 1507356, 0, 1, 1507357, 0, 1, 1507358, 0, 1, 1507359, 0, 1 )
|
||||||
|
|
||||||
[node name="Rock" parent="." instance=ExtResource( 9 )]
|
[node name="Rock" parent="." instance=ExtResource( 9 )]
|
||||||
position = Vector2( 144, 152 )
|
position = Vector2( 144, 152 )
|
||||||
|
@ -200,4 +201,9 @@ z_index = -3
|
||||||
frames = SubResource( 5 )
|
frames = SubResource( 5 )
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
|
[node name="LaserWall" parent="." instance=ExtResource( 23 )]
|
||||||
|
position = Vector2( 152, 112 )
|
||||||
|
left_up_boundry = 1.0
|
||||||
|
right_down_boundry = 3.0
|
||||||
|
|
||||||
[editable path="RollingFiend"]
|
[editable path="RollingFiend"]
|
||||||
|
|
33
objects/enemy/laser_wall.gd
Normal file
33
objects/enemy/laser_wall.gd
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
extends "res://objects/enemy/enemy_move_sidesideupdown.gd"
|
||||||
|
|
||||||
|
export var laser_rate = 1.0
|
||||||
|
export var laser_time = 0.5
|
||||||
|
|
||||||
|
onready var line = $Laser
|
||||||
|
onready var cast = $RayCast2D
|
||||||
|
onready var timer = $Timer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
_disable_laser()
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
if cast.is_colliding():
|
||||||
|
line.points[1].y = line.to_local(cast.get_collision_point()).y
|
||||||
|
line.visible = true
|
||||||
|
var collider = cast.get_collider()
|
||||||
|
if collider.is_in_group("player"):
|
||||||
|
collider.get_parent().die()
|
||||||
|
else:
|
||||||
|
line.visible = false
|
||||||
|
|
||||||
|
func _enable_laser():
|
||||||
|
cast.enabled = true
|
||||||
|
timer.wait_time = laser_time
|
||||||
|
timer.connect("timeout", self, "_disable_laser", [], CONNECT_ONESHOT)
|
||||||
|
timer.start()
|
||||||
|
|
||||||
|
func _disable_laser():
|
||||||
|
cast.enabled = false
|
||||||
|
timer.wait_time = laser_rate
|
||||||
|
timer.connect("timeout", self, "_enable_laser", [], CONNECT_ONESHOT)
|
||||||
|
timer.start()
|
29
objects/enemy/laser_wall.tscn
Normal file
29
objects/enemy/laser_wall.tscn
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://graphics/enemy/laser_wall.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://objects/enemy/laser_wall.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[node name="LaserWall" type="Node2D"]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
blood = false
|
||||||
|
flip_sprite = false
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="Laser" type="Line2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2( 4, 2 )
|
||||||
|
points = PoolVector2Array( 0, 0, 0, 8 )
|
||||||
|
width = 2.0
|
||||||
|
default_color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||||
|
|
||||||
|
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||||
|
position = Vector2( 4, 2 )
|
||||||
|
cast_to = Vector2( 0, 192 )
|
||||||
|
collide_with_areas = true
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
process_mode = 0
|
||||||
|
one_shot = true
|
Loading…
Add table
Add a link
Reference in a new issue