Player movement tweaks and a Goblin

- Player now has an attack move
 - Player wall jump more refined
 - New Enemy superclass for patrol type enemies
 - Goblin enemy.
 - Player abilty toggles. Can turn on/off wall_jump/attack/dash [WIP]
This commit is contained in:
Sagi Dayan 2020-09-26 23:18:34 -04:00
parent 2019f5dec5
commit 08cf3e1462
14 changed files with 1585 additions and 65 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/goblin_spritesheet.png-71d0e8bc6008d2b40c71d876667145e0.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Enemies/goblin_spritesheet.png"
dest_files=[ "res://.import/goblin_spritesheet.png-71d0e8bc6008d2b40c71d876667145e0.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Title.png-e5d8b3493cbb2b8c9dc1248efbf14375.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/SplashScreen/Title.png"
dest_files=[ "res://.import/Title.png-e5d8b3493cbb2b8c9dc1248efbf14375.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=true
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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -19,6 +19,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/Items/Coin.gd"
}, {
"base": "KinematicBody2D",
"class": "Enemy",
"language": "GDScript",
"path": "res://src/Actors/Enemy.gd"
}, {
"base": "CanvasLayer",
"class": "HUD",
"language": "GDScript",
@ -37,6 +42,7 @@ _global_script_classes=[ {
_global_script_class_icons={
"CheckPoint": "",
"Coin": "",
"Enemy": "",
"HUD": "",
"Player": "",
"Spike": ""
@ -105,6 +111,7 @@ jump={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
]
}
pause={
@ -118,6 +125,13 @@ dash={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777238,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
]
}
attack={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":67,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
]
}

114
src/Actors/Enemy.gd Normal file
View file

@ -0,0 +1,114 @@
tool
extends KinematicBody2D
class_name Enemy
signal died
signal got_damage
export var num_of_hits := 3
export var walking_speed := 20.0
export var attack_cool_down := .1
export var patroler = true
export var idle_interval := .5
export var idle_time := .2
export var dont_fall_patrol = true
export var gravity = 500.0
var _velocity := Vector2.ZERO
var _is_idle := false
var _is_alive := true
var _triggerd := false
var _damage_enabled := true
var _player_ref:Player = null;
var _genesis_position:Vector2;
func _get_configuration_warning() -> String:
var warnings = PoolStringArray()
var children = get_children()
var warning_sections := {
"animation_player": true,
"collision_shape": true,
"sprite": true,
"raycast_left": dont_fall_patrol,
"raycast_right": dont_fall_patrol,
"area_2d": true
}
for child in children:
if child.name == 'CollisionShape2D': warning_sections.collision_shape = false;
elif child.name == 'Sprite': warning_sections.sprite = false;
elif child.name == 'Area2D': warning_sections.area_2d = false;
elif child.name == 'RayCastLeft': warning_sections.raycast_left = false;
elif child.name == 'RayCastRight': warning_sections.raycast_right = false;
elif child.name == 'AnimationPlayer':
warning_sections.animation_player = not (
$AnimationPlayer.has_animation("walk") and
$AnimationPlayer.has_animation("die") and
$AnimationPlayer.has_animation("idle") and
$AnimationPlayer.has_animation("hit")
)
if warning_sections.collision_shape:
warnings.append(name + " Needs to have a CollisionShape2D Child")
if warning_sections.area_2d:
warnings.append(name + " Needs to have an Area2D Child")
if warning_sections.raycast_left:
warnings.append(name + " With dont-fall mode Needs to have a RayCastLeft Child")
if warning_sections.raycast_right:
warnings.append(name + " With dont-fall mode Needs to have a RayCastRight Child")
if warning_sections.sprite:
warnings.append(name + " Needs to have aa Sprite Child")
if warning_sections.animation_player:
warnings.append(name + " Needs to have an AnimationPlayer Child witt 'walk', 'idle', 'die', 'hit' animations")
return warnings.join('\n')
func _ready() -> void:
add_to_group("Enemies")
_genesis_position = position
func _physics_process(delta: float) -> void:
if Engine.editor_hint: return
if not _is_alive: return
if not _damage_enabled:
_velocity.y += gravity * delta
_velocity = move_and_slide(_velocity, Vector2.UP)
return
if not _is_idle and not _triggerd:
if patroler:
if is_on_wall():
$Sprite.scale = Vector2($Sprite.scale.x * -1, 1)
elif dont_fall_patrol and is_on_floor():
var pit_direction = _get_pit_direction()
if not pit_direction == 0:
$Sprite.scale = Vector2(pit_direction * -1, 1)
$AnimationPlayer.play("walk")
_velocity.y += gravity * delta
_velocity.x = $Sprite.scale.x * walking_speed
_velocity = move_and_slide(_velocity, Vector2.UP)
pass
func take_damage(from_direction:int, damage: int = 1)->void:
num_of_hits -= 1
if num_of_hits <= 0:
_is_alive = false
_damage_enabled = false
$AnimationPlayer.play("die")
else:
_damage_enabled = false
$AnimationPlayer.play("hit")
$Sprite.scale = Vector2(from_direction * -1, 1)
_velocity.x = 100 * from_direction
_velocity.y = -50
func on_animation_hit_ended():
_damage_enabled = true
func _get_pit_direction()->int:
if not $RayCastLeft.is_colliding():
return -1
elif not $RayCastRight.is_colliding():
return 1
return 0
func _alerted()->bool:
return false

37
src/Actors/Goblin.gd Normal file
View file

@ -0,0 +1,37 @@
tool
extends Enemy
func _on_Area2D_body_entered(body: Node) -> void:
if not _damage_enabled: return
if body.name == 'Player':
var player:Player = body
player.die()
func _physics_process(delta: float) -> void:
if not _is_alive: return
if _triggerd and _damage_enabled:
var player_direction = (_player_ref.position - position).normalized()
$Sprite.scale = Vector2(-1 if player_direction.x < 0 else 1, 1)
if _get_pit_direction() == 0 and dont_fall_patrol:
_velocity.x = $Sprite.scale.x * walking_speed * 2
else:
_velocity.x = 0
_velocity.y += gravity * delta
$AnimationPlayer.play("attack")
_velocity = move_and_slide(_velocity, Vector2.UP)
pass
func _on_TriggerZone_body_entered(body: Node) -> void:
if body.name == 'Player':
_triggerd = true
_player_ref = body
func _on_TriggerZone_body_exited(body: Node) -> void:
if body.name == 'Player':
_triggerd = false
_player_ref = null

562
src/Actors/Goblin.tscn Normal file
View file

@ -0,0 +1,562 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://assets/Enemies/goblin_spritesheet.png" type="Texture" id=1]
[ext_resource path="res://src/Actors/Goblin.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 6, 8 )
[sub_resource type="RectangleShape2D" id=5]
extents = Vector2( 7, 9 )
[sub_resource type="RectangleShape2D" id=6]
extents = Vector2( 35, 10 )
[sub_resource type="Animation" id=8]
resource_name = "attack"
length = 0.3
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("CollisionShape2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:vframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 5 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:hframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 4 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("CollisionShape2D:shape:extents")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 6, 8 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("CollisionShape2D:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=2]
resource_name = "die"
length = 0.5
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("CollisionShape2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 6, 7, 8, 9, 10, 11 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:vframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 5 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:hframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 6 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("CollisionShape2D:shape:extents")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 6, 8 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("CollisionShape2D:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/7/type = "method"
tracks/7/path = NodePath(".")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "queue_free"
} ]
}
[sub_resource type="Animation" id=7]
resource_name = "hit"
length = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("CollisionShape2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 0.1, 0.2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ 24, 25, 26 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:vframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 5 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:hframes")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 6 ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("CollisionShape2D:shape:extents")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 6, 8 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("CollisionShape2D:disabled")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/8/type = "method"
tracks/8/path = NodePath(".")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0.2 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "on_animation_hit_ended"
} ]
}
[sub_resource type="Animation" id=3]
resource_name = "idle"
length = 0.3
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("CollisionShape2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 18, 19, 20, 21 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:vframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 5 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:hframes")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 6 ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("CollisionShape2D:shape:extents")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 6, 8 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("CollisionShape2D:disabled")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
resource_name = "walk"
length = 0.5
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("CollisionShape2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 4, 5 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:vframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 5 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:hframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 6 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("CollisionShape2D:shape:extents")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 6, 8 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("CollisionShape2D:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[node name="Goblin" type="KinematicBody2D"]
collision_layer = 2147483650
collision_mask = 15
script = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -8 )
shape = SubResource( 1 )
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 2
[node name="DamageArea" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 0, -8 )
shape = SubResource( 5 )
[node name="TriggerZone" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerZone"]
position = Vector2( 0, -6 )
shape = SubResource( 6 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0, -8 )
texture = ExtResource( 1 )
vframes = 5
hframes = 4
frame = 8
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "idle"
anims/attack = SubResource( 8 )
anims/die = SubResource( 2 )
anims/hit = SubResource( 7 )
anims/idle = SubResource( 3 )
anims/walk = SubResource( 4 )
[node name="RayCastLeft" type="RayCast2D" parent="."]
position = Vector2( -6, 0 )
enabled = true
cast_to = Vector2( 0, 1 )
collision_mask = 8
[node name="RayCastRight" type="RayCast2D" parent="."]
position = Vector2( 6, 0 )
enabled = true
cast_to = Vector2( 0, 1 )
collision_mask = 12
collide_with_areas = true
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
[connection signal="body_entered" from="TriggerZone" to="." method="_on_TriggerZone_body_entered"]
[connection signal="body_exited" from="TriggerZone" to="." method="_on_TriggerZone_body_exited"]

View file

@ -1,6 +1,8 @@
extends KinematicBody2D
class_name Player
export var run_speed := 100.0
export var jump_power := 180.0
export var gravity: = 500.0
@ -27,6 +29,18 @@ var _alive := false;
var _is_wall_sliding := false;
var _is_dashing := false;
var _can_dash := true;
var _is_attaking := false;
enum Direction{
RIGHT = 1,
LEFT = -1
}
export var abilities:= {
"dash": false,
"wall_jump": false,
"attack": false
}
func _ready() -> void:
$AnimationPlayer.play("fade_in")
respawn_position = position
@ -36,7 +50,7 @@ func _physics_process(delta: float) -> void:
var is_jump_canceled: = Input.is_action_just_released("jump") and !_is_wall_jumping and _velocity.y < 0.0
var direction: = get_direction()
var prev_wall_slide_state = _is_wall_sliding
_is_wall_sliding = _velocity.y >=0 and _is_next_to_wall() and _in_air
_is_wall_sliding = _velocity.y >=0 and is_on_wall() and _in_air
_velocity = calculate_move_velocity(direction,is_jump_canceled, delta)
if _is_wall_sliding and not prev_wall_slide_state:
_velocity.y=0
@ -54,10 +68,10 @@ func _physics_process(delta: float) -> void:
_is_wall_jumping = false
func get_direction() -> Vector2:
var right_strength = min(Input.get_action_strength("direction_right") * 2, 1)
var left_strength = min(Input.get_action_strength("direction_left") * 2, 1)
var right_strength = min(Input.get_action_strength("direction_right") , 1)
var left_strength = min(Input.get_action_strength("direction_left"), 1)
return Vector2(
right_strength - left_strength,
right_strength - left_strength if _in_air or not _is_attaking else 0,
-1.0 if Input.is_action_just_pressed("jump") and (is_on_floor() or _is_wall_sliding) else 1.0
)
@ -74,9 +88,9 @@ func calculate_move_velocity(direction:Vector2, is_jump_canceled:bool, delta:fl
_in_air = true
if _is_wall_sliding:
# wall jump
var walljump__x_direction = 1 if _is_next_to_wall_right() else -1
var walljump__x_direction = -1 * direction.x
_is_wall_jumping = true
var desired = -(run_speed * wall_jump_speed_factor.x * walljump__x_direction)
var desired = (run_speed * wall_jump_speed_factor.x * walljump__x_direction)
output.x = desired
output.y = jump_power * wall_jump_speed_factor.y * direction.y
else:
@ -101,7 +115,7 @@ func calculate_move_velocity(direction:Vector2, is_jump_canceled:bool, delta:fl
output.y = max_wall_slide_gravity
var dash_velocity := Vector2(
(-1 if $Sprite.flip_h else 1) * dash_thrust,
$Sprite.scale.x * dash_thrust,
0
)
@ -111,7 +125,7 @@ func calculate_move_velocity(direction:Vector2, is_jump_canceled:bool, delta:fl
_is_dashing = true # turn off gravity while dashing
# Wall dash first
if _is_wall_sliding:
dash_velocity.x = (-1 if _is_next_to_wall_right() else 1) * dash_thrust
dash_velocity.x = $Sprite.scale.x * dash_thrust * -1
if dash_velocity.x < 0 :
$DashParticlesLeft.emitting = true;
@ -130,34 +144,33 @@ func _respawn():
func _revive():
_alive = true
func _is_next_to_wall():
return _is_next_to_wall_right() || _is_next_to_wall_left()
func _is_next_to_wall_right():
if $RayCastWallRight.is_colliding():
var colider = $RayCastWallRight.get_collider();
return colider.name == "SolidsTileMap"
return false
func _is_next_to_wall_left():
if $RayCastWallLeft.is_colliding():
var colider = $RayCastWallLeft.get_collider();
return colider.name == "SolidsTileMap"
return false
func update_sprite(_direction:Vector2) -> void:
var air_animation = "jump" if _velocity.y <= 0 else "fall"
if _is_attaking: return
var attack = Input.is_action_just_pressed("attack") and abilities.attack
if _velocity.x > .5 and not _is_wall_sliding:
$Sprite.scale = Vector2(1,1)
$AnimationPlayer.play("run" if is_on_floor() else air_animation)
$Sprite.flip_h = false
elif _velocity.x < -.5 and not _is_wall_sliding:
$Sprite.scale = Vector2(-1,1)
$AnimationPlayer.play("run" if is_on_floor() else air_animation)
$Sprite.flip_h = true
else:
if not _in_air: $AnimationPlayer.play("idle")
if _is_wall_sliding:
$AnimationPlayer.play("wall_slide")
return
if attack:
_is_attaking = true
var attack_animation = "attack_right" if $Sprite.scale.x > 0 else "attack_left"
$AnimationPlayer.play(attack_animation)
$AnimationPlayer.playback_speed = 2.5
$AnimationPlayer.seek(0)
yield($AnimationPlayer, "animation_finished")
$AnimationPlayer.playback_speed = 1
_is_attaking = false
return
if _in_air:
$AnimationPlayer.play(air_animation)
return
@ -166,6 +179,8 @@ func update_sprite(_direction:Vector2) -> void:
$AnimationPlayer.play("jump")
return
func _on_die_animation_done():
emit_signal("died")
_respawn()
@ -174,9 +189,25 @@ func die():
_alive = false
$AnimationPlayer.play("die")
func setAbility(ability:String, enabled:bool=false):
if ability == 'dash':
abilities.dash = enabled
elif ability == 'wall_jump':
abilities.wall_jump = enabled
elif ability == 'attack':
abilities.attack = enabled
else:
pass
func _on_DashTimeout_timeout() -> void:
$DashParticlesLeft.emitting = false
$DashParticlesRight.emitting = false
_velocity.x = run_speed * _velocity.normalized().x;
_is_dashing = false
pass # Replace with function body.
func _on_SordRange_body_entered(body: Node) -> void:
if body.is_in_group("Enemies"):
body.take_damage($Sprite.scale.x)
pass # Replace with function body.

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://src/Actors/DashParticles_right.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Actors/Player.gd" type="Script" id=2]
@ -9,8 +9,162 @@
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 5, 7 )
[sub_resource type="Animation" id=2]
resource_name = "die"
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 9, 5 )
[sub_resource type="Animation" id=3]
resource_name = "attack_left"
length = 0.3
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("ScreenOverlay/CanvasModulate:color")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 4 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( -8, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
resource_name = "attack_right"
length = 0.3
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("ScreenOverlay/CanvasModulate:color")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 4 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 8, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=5]
length = 0.9
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
@ -50,9 +204,56 @@ tracks/2/keys = {
"method": "_on_die_animation_done"
} ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:vframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:hframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=3]
resource_name = "fade_in"
[sub_resource type="Animation" id=6]
length = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
@ -92,9 +293,56 @@ tracks/2/keys = {
"method": "_revive"
} ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:vframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:hframes")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=4]
resource_name = "fall"
[sub_resource type="Animation" id=7]
length = 0.2
loop = true
tracks/0/type = "value"
@ -121,9 +369,56 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=5]
resource_name = "idle"
[sub_resource type="Animation" id=8]
length = 0.3
loop = true
tracks/0/type = "value"
@ -150,9 +445,56 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=6]
resource_name = "jump"
[sub_resource type="Animation" id=9]
length = 0.2
loop = true
tracks/0/type = "value"
@ -179,9 +521,56 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=7]
resource_name = "pre_jump"
[sub_resource type="Animation" id=10]
length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
@ -207,9 +596,56 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=8]
resource_name = "run"
[sub_resource type="Animation" id=11]
length = 0.5
loop = true
tracks/0/type = "value"
@ -236,9 +672,56 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=9]
resource_name = "wall_slide"
[sub_resource type="Animation" id=12]
length = 0.3
loop = true
tracks/0/type = "value"
@ -265,6 +748,54 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 13 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:hframes")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[node name="Player" type="KinematicBody2D"]
collision_mask = 30
@ -291,22 +822,32 @@ shadow_item_cull_mask = 15
[node name="Sprite" type="Sprite" parent="."]
self_modulate = Color( 0.482353, 0.694118, 0.819608, 1 )
position = Vector2( 0, -8 )
position = Vector2( 8, -8 )
texture = ExtResource( 8 )
vframes = 13
hframes = 8
frame = 32
hframes = 4
frame = 12
[node name="SordRange" type="Area2D" parent="Sprite"]
position = Vector2( -8, 8 )
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite/SordRange"]
position = Vector2( 14, -6 )
shape = SubResource( 2 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "idle"
anims/die = SubResource( 2 )
anims/fade_in = SubResource( 3 )
anims/fall = SubResource( 4 )
anims/idle = SubResource( 5 )
anims/jump = SubResource( 6 )
anims/pre_jump = SubResource( 7 )
anims/run = SubResource( 8 )
anims/wall_slide = SubResource( 9 )
anims/attack_left = SubResource( 3 )
anims/attack_right = SubResource( 4 )
anims/die = SubResource( 5 )
anims/fade_in = SubResource( 6 )
anims/fall = SubResource( 7 )
anims/idle = SubResource( 8 )
anims/jump = SubResource( 9 )
anims/pre_jump = SubResource( 10 )
anims/run = SubResource( 11 )
anims/wall_slide = SubResource( 12 )
[node name="ScreenOverlay" type="CanvasLayer" parent="."]
layer = 128
@ -328,14 +869,17 @@ one_shot = true
[node name="DashParticlesRight" parent="." instance=ExtResource( 1 )]
[node name="RayCastWallRight" type="RayCast2D" parent="."]
visible = false
position = Vector2( 0, -8.09363 )
enabled = true
cast_to = Vector2( 5.2, 0 )
collision_mask = 8
[node name="RayCastWallLeft" type="RayCast2D" parent="."]
visible = false
position = Vector2( 0, -8.04107 )
enabled = true
cast_to = Vector2( -5.2, 0 )
collision_mask = 8
[connection signal="body_entered" from="Sprite/SordRange" to="." method="_on_SordRange_body_entered"]
[connection signal="timeout" from="DashTimeout" to="." method="_on_DashTimeout_timeout"]

View file

@ -4,9 +4,12 @@ extends Node2D
export var next_scene:PackedScene
func _ready() -> void:
$AudioStreamPlayer.seek(1.5)
$SplashVoice.seek(1.5)
func load_next_scene():
# var next_scene = load("res://src/Levels/LevelTemplate/LevelTemplate.tscn")
get_tree().change_scene_to(next_scene)
queue_free()
func stop_splash_voice():
$SplashVoice.stop()

View file

@ -1,14 +1,17 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://assets/SplashScreen/BLANK.png" type="Texture" id=1]
[ext_resource path="res://src/Intro/Intro.gd" type="Script" id=2]
[ext_resource path="res://assets/SplashScreen/SAGI.png" type="Texture" id=3]
[ext_resource path="res://sound/SAGI.ogg" type="AudioStream" id=4]
[ext_resource path="res://src/Levels/LevelTemplate/LevelTemplate.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Tiles/background_0.png" type="Texture" id=6]
[ext_resource path="res://assets/SplashScreen/Title.png" type="Texture" id=7]
[ext_resource path="res://assets/Items/torch_ligt_texture.png" type="Texture" id=8]
[sub_resource type="Animation" id=1]
resource_name = "intro"
length = 2.0
length = 8.0
tracks/0/type = "value"
tracks/0/path = NodePath("SAGI:self_modulate")
tracks/0/interp = 1
@ -40,13 +43,100 @@ tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 2 ),
"transitions": PoolRealArray( 1 ),
"times": PoolRealArray( 1.8, 8 ),
"transitions": PoolRealArray( 1, 1 ),
"values": [ {
"args": [ ],
"method": "stop_splash_voice"
}, {
"args": [ ],
"method": "load_next_scene"
} ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("SAGI/Light2D:enabled")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 1.8 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Title/BG:self_modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0, 1.8, 2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Title/Sprite2:self_modulate")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0, 2, 2.2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Title/BG:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0, 1.8, 8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 229, -35 ), Vector2( 229, -35 ), Vector2( 229, 294 ) ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Title/Sprite2/Light2D:enabled")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0, 1.8 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ false, true ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("Title/Sprite2/Light2D:position")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0, 1.8, 2.3, 3.2, 3.5, 3.6, 3.8, 4.3, 5.4, 5.6, 5.7, 5.8, 6.5, 6.7, 8 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 42, 68.4516 ), Vector2( 42, 68.4516 ), Vector2( 262, 36 ), Vector2( 407, 109 ), Vector2( 419, 136 ), Vector2( 419, 136 ), Vector2( 375, 117 ), Vector2( 263, 71 ), Vector2( 268, 163 ), Vector2( 268, 163 ), Vector2( 234, 170 ), Vector2( 344, 151 ), Vector2( 285, 175 ), Vector2( 243, 113 ), Vector2( 243, 113 ) ]
}
tracks/9/type = "value"
tracks/9/path = NodePath("Title/Sprite2/Light2D:scale")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/keys = {
"times": PoolRealArray( 0, 6.7, 8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 3.50556, 3.50556 ), Vector2( 3.50556, 3.50556 ), Vector2( 512.534, 512.534 ) ]
}
[node name="Intro" type="Node2D"]
script = ExtResource( 2 )
@ -61,14 +151,36 @@ texture = ExtResource( 1 )
centered = false
[node name="SAGI" type="Sprite" parent="."]
self_modulate = Color( 1, 1, 1, 0 )
position = Vector2( 2, 0 )
texture = ExtResource( 3 )
centered = false
[node name="Light2D" type="Light2D" parent="SAGI"]
position = Vector2( 239, 136 )
enabled = false
texture = ExtResource( 3 )
texture_scale = 3.0
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
[node name="SplashVoice" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
autoplay = true
[node name="Title" type="Node2D" parent="."]
self_modulate = Color( 1, 1, 1, 0 )
[node name="BG" type="Sprite" parent="Title"]
self_modulate = Color( 1, 1, 1, 0 )
position = Vector2( 229, -35 )
scale = Vector2( 3.50556, 3.50556 )
texture = ExtResource( 6 )
[node name="Sprite2" type="Sprite" parent="Title"]
self_modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 7 )
centered = false
[node name="Light2D" type="Light2D" parent="Title/Sprite2"]
position = Vector2( 42, 68.4516 )
scale = Vector2( 3.50556, 3.50556 )
texture = ExtResource( 8 )

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long