forked from team-sg/hero-mark-2
SUPERSLIMES
This commit is contained in:
parent
3b835b78f1
commit
8f2b42f968
3 changed files with 149 additions and 4 deletions
|
@ -1,12 +1,12 @@
|
||||||
[gd_scene load_steps=32 format=2]
|
[gd_scene load_steps=32 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://objects/enemy/super_slime.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]
|
||||||
[ext_resource path="res://tilesets/t_mountain.tres" type="TileSet" id=3]
|
[ext_resource path="res://tilesets/t_mountain.tres" type="TileSet" id=3]
|
||||||
[ext_resource path="res://objects/hud/hud.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://objects/hud/hud.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://tilesets/t_death.tres" type="TileSet" id=5]
|
[ext_resource path="res://tilesets/t_death.tres" type="TileSet" id=5]
|
||||||
[ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://graphics/backgrounds/canopy.png" type="Texture" id=7]
|
[ext_resource path="res://graphics/backgrounds/canopy.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://objects/environment/turret/turret.tscn" type="PackedScene" id=8]
|
|
||||||
[ext_resource path="res://tilesets/t_laboratory.tres" type="TileSet" id=9]
|
[ext_resource path="res://tilesets/t_laboratory.tres" type="TileSet" id=9]
|
||||||
[ext_resource path="res://objects/enemy/slime.tscn" type="PackedScene" id=10]
|
[ext_resource path="res://objects/enemy/slime.tscn" type="PackedScene" id=10]
|
||||||
[ext_resource path="res://maps/map.gd" type="Script" id=11]
|
[ext_resource path="res://maps/map.gd" type="Script" id=11]
|
||||||
|
@ -288,7 +288,7 @@ cell_size = Vector2( 8, 8 )
|
||||||
collision_layer = 32
|
collision_layer = 32
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( 196623, 1, 1, 196624, 1, 2, 196625, 1, 2, 196626, 1, 3, 262159, 1, 65537, 262160, 1, 65538, 262161, 1, 65538, 262162, 1, 65539, 327695, 1, 131073, 327696, 1, 131074, 327697, 1, 131074, 327698, 1, 131075, 393237, 0, 1, 393238, 0, 2, 393239, 0, 2, 393240, 0, 2, 393241, 0, 3, 458775, 0, 1, 458776, 0, 2, 458777, 0, 2, 458778, 0, 2, 458779, 0, 3, 524308, 0, 1, 524309, 0, 2, 524310, 0, 2, 524311, 0, 2, 524312, 0, 2, 524313, 0, 2, 524314, 0, 2, 524315, 0, 3, 589838, 2, 1, 589839, 2, 2, 589840, 2, 2, 589841, 2, 2, 589842, 2, 3, 655374, 2, 65537, 655375, 2, 65538, 655376, 2, 65538, 655377, 2, 65538, 655378, 2, 65539, 720910, 2, 65537, 720911, 2, 65538, 720912, 2, 65538, 720913, 2, 65538, 720914, 2, 65539, 786446, 2, 131073, 786447, 2, 131074, 786448, 2, 131074, 786449, 2, 131074, 786450, 2, 131075, 1114126, 0, 1, 1114127, 0, 2, 1114128, 0, 2, 1114129, 0, 3, 1245205, 2, 1, 1245206, 2, 2, 1245207, 2, 2, 1245208, 2, 3, 1310738, 2, 1, 1310739, 2, 2, 1310740, 2, 2, 1310741, 2, 65538, 1310742, 2, 65538, 1310743, 2, 65538, 1310744, 2, 65539, 1376272, 2, 196609, 1376273, 2, 196610, 1376274, 2, 131074, 1376275, 2, 131074, 1376276, 2, 131074, 1376277, 2, 131074, 1376278, 2, 131074, 1376279, 2, 131074, 1376280, 2, 131075 )
|
tile_data = PoolIntArray( 196623, 1, 1, 196624, 1, 2, 196625, 1, 2, 196626, 1, 3, 262159, 1, 65537, 262160, 1, 65538, 262161, 1, 65538, 262162, 1, 65539, 327695, 1, 131073, 327696, 1, 131074, 327697, 1, 131074, 327698, 1, 131075, 393237, 0, 1, 393238, 0, 2, 393239, 0, 2, 393240, 0, 2, 393241, 0, 3, 458775, 0, 1, 458776, 0, 2, 458777, 0, 2, 458778, 0, 2, 458779, 0, 3, 524308, 0, 1, 524309, 0, 2, 524310, 0, 2, 524311, 0, 2, 524312, 0, 2, 524313, 0, 2, 524314, 0, 2, 524315, 0, 3, 589838, 2, 1, 589839, 2, 2, 589840, 2, 2, 589841, 2, 2, 589842, 2, 3, 655374, 2, 65537, 655375, 2, 65538, 655376, 2, 65538, 655377, 2, 65538, 655378, 2, 65539, 720910, 2, 65537, 720911, 2, 65538, 720912, 2, 65538, 720913, 2, 65538, 720914, 2, 65539, 786446, 2, 131073, 786447, 2, 131074, 786448, 2, 131074, 786449, 2, 131074, 786450, 2, 131075 )
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="LabTiles"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="LabTiles"]
|
||||||
autoplay = "electricity"
|
autoplay = "electricity"
|
||||||
|
@ -306,7 +306,10 @@ left_up_boundary = 4.0
|
||||||
right_down_boundary = 4.0
|
right_down_boundary = 4.0
|
||||||
move_direction = 1
|
move_direction = 1
|
||||||
|
|
||||||
[node name="Turret" parent="." instance=ExtResource( 8 )]
|
[node name="SuperSlime" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 208, 128 )
|
position = Vector2( 200, 168 )
|
||||||
|
left_boundary = 3.0
|
||||||
|
right_boundary = 4.0
|
||||||
|
jump_distance = 4.0
|
||||||
|
|
||||||
[editable path="RollingFiend"]
|
[editable path="RollingFiend"]
|
||||||
|
|
85
objects/enemy/super_slime.gd
Normal file
85
objects/enemy/super_slime.gd
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
tool
|
||||||
|
extends "res://objects/enemy/enemy.gd"
|
||||||
|
|
||||||
|
|
||||||
|
export var left_boundary: float = 0.0
|
||||||
|
export var right_boundary: float = 0.0
|
||||||
|
export var direction: float = 1.0
|
||||||
|
export var speed: float = 50.0
|
||||||
|
export var jump_distance: float = 0.0
|
||||||
|
export var jump_speed: float = 50.0
|
||||||
|
|
||||||
|
var _jumping: bool = false
|
||||||
|
var _jump_direction: float = -1.0
|
||||||
|
|
||||||
|
onready var hitbox: Area2D = $Hitbox
|
||||||
|
onready var sprite: AnimatedSprite = $Hitbox/Sprite
|
||||||
|
onready var detect_player_cast: RayCast2D = $"%DetectPlayerCast"
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if Engine.editor_hint:
|
||||||
|
return
|
||||||
|
left_boundary *= 8.0
|
||||||
|
right_boundary *= 8.0
|
||||||
|
jump_distance *= 8.0
|
||||||
|
detect_player_cast.cast_to = Vector2(0.0, -jump_distance)
|
||||||
|
speed *= Game.enemy_speed_factor
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if Engine.editor_hint:
|
||||||
|
return
|
||||||
|
# check for player and jump
|
||||||
|
if detect_player_cast.is_colliding():
|
||||||
|
_jumping = true
|
||||||
|
# move if not jumping
|
||||||
|
if _jumping:
|
||||||
|
hitbox.position.y += _jump_direction * jump_speed * delta
|
||||||
|
if hitbox.position.y >= 8.0:
|
||||||
|
hitbox.position.y = 0.0
|
||||||
|
_jump_direction = -1.0
|
||||||
|
hitbox.scale.y = 1.0
|
||||||
|
_jumping = false
|
||||||
|
elif hitbox.position.y <= -jump_distance - 8.0:
|
||||||
|
hitbox.position.y = -jump_distance
|
||||||
|
_jump_direction = 1.0
|
||||||
|
hitbox.scale.y = -1.0
|
||||||
|
_jumping = false
|
||||||
|
else:
|
||||||
|
hitbox.position.x += direction * speed * delta
|
||||||
|
if hitbox.position.x >= right_boundary:
|
||||||
|
hitbox.position.x = right_boundary
|
||||||
|
direction = -1.0
|
||||||
|
sprite.flip_h = true
|
||||||
|
elif hitbox.position.x <= -left_boundary:
|
||||||
|
hitbox.position.x = -left_boundary
|
||||||
|
direction = 1.0
|
||||||
|
sprite.flip_h = false
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if Engine.editor_hint and Engine.get_frames_drawn() % 10 == 0:
|
||||||
|
update()
|
||||||
|
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
if Engine.editor_hint:
|
||||||
|
# bottom travel zone
|
||||||
|
draw_line(
|
||||||
|
Vector2(-left_boundary * 8.0, 4.0),
|
||||||
|
Vector2(right_boundary * 8.0 + 8.0, 4.0),
|
||||||
|
Color(0.4, 0.2, 0.6, 0.75), 1.01, false
|
||||||
|
)
|
||||||
|
# top travel zone
|
||||||
|
draw_line(
|
||||||
|
Vector2(-left_boundary * 8.0, -jump_distance * 8.0 - 4.0),
|
||||||
|
Vector2(right_boundary * 8.0 + 8.0, -jump_distance * 8.0 - 4.0),
|
||||||
|
Color(0.4, 0.2, 0.6, 0.75), 1.01, false
|
||||||
|
)
|
||||||
|
# jump line
|
||||||
|
draw_line(
|
||||||
|
Vector2(4.0, 4.0),
|
||||||
|
Vector2(4.0, -jump_distance * 8.0 - 4.0),
|
||||||
|
Color(0.4, 0.2, 0.6, 0.75), 1.01, false
|
||||||
|
)
|
57
objects/enemy/super_slime.tscn
Normal file
57
objects/enemy/super_slime.tscn
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://objects/enemy/super_slime.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://shaders/recolor_border.shader" type="Shader" id=2]
|
||||||
|
[ext_resource path="res://graphics/enemy/pal_slime_purple.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://graphics/enemy/slime.png" type="Texture" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id=4]
|
||||||
|
shader = ExtResource( 2 )
|
||||||
|
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||||
|
shader_param/border_corners = false
|
||||||
|
shader_param/palette = ExtResource( 3 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 0, 0, 13, 13 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=3]
|
||||||
|
atlas = ExtResource( 4 )
|
||||||
|
region = Rect2( 13, 0, 13, 13 )
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=5]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 7.0
|
||||||
|
} ]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=6]
|
||||||
|
extents = Vector2( 4, 4 )
|
||||||
|
|
||||||
|
[node name="SuperSlime" type="Node2D"]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
blood = false
|
||||||
|
jump_speed = 100.0
|
||||||
|
|
||||||
|
[node name="Hitbox" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Sprite" type="AnimatedSprite" parent="Hitbox"]
|
||||||
|
material = SubResource( 4 )
|
||||||
|
position = Vector2( 4, 3 )
|
||||||
|
frames = SubResource( 5 )
|
||||||
|
playing = true
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
position = Vector2( 4, 4 )
|
||||||
|
shape = SubResource( 6 )
|
||||||
|
|
||||||
|
[node name="DetectPlayerCast" type="RayCast2D" parent="Hitbox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 4, 0 )
|
||||||
|
enabled = true
|
||||||
|
cast_to = Vector2( 0, -16 )
|
||||||
|
collision_mask = 128
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
Loading…
Add table
Add a link
Reference in a new issue