forked from team-sg/hero-mark-2
player.tscn: scholar of the first bullet casings
This commit is contained in:
parent
79cbd62a69
commit
bc57ba4171
45 changed files with 1429 additions and 113 deletions
|
@ -3,8 +3,11 @@ extends Tree
|
||||||
|
|
||||||
var target: StateChart = null
|
var target: StateChart = null
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
set("custom_styles/bg", StyleBoxEmpty.new())
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if target is StateChart:
|
if target is StateChart and visible:
|
||||||
clear()
|
clear()
|
||||||
var root_state = target.get_child(0)
|
var root_state = target.get_child(0)
|
||||||
if root_state is State:
|
if root_state is State:
|
||||||
|
|
|
@ -36,7 +36,7 @@ func _physics_process(delta):
|
||||||
if Input.is_action_pressed("debug_move_player"):
|
if Input.is_action_pressed("debug_move_player"):
|
||||||
var nodes = get_tree().get_nodes_in_group("player")
|
var nodes = get_tree().get_nodes_in_group("player")
|
||||||
if not nodes.empty():
|
if not nodes.empty():
|
||||||
var player = nodes[0].get_parent()
|
var player = nodes[0]
|
||||||
var mouse_position = SceneManager.viewport.get_mouse_position() / SceneManager.viewport_container.rect_scale
|
var mouse_position = SceneManager.viewport.get_mouse_position() / SceneManager.viewport_container.rect_scale
|
||||||
mouse_position.x = clamp(mouse_position.x, 8.0, Game.resolution.x - 8.0)
|
mouse_position.x = clamp(mouse_position.x, 8.0, Game.resolution.x - 8.0)
|
||||||
mouse_position.y = clamp(mouse_position.y, 8.0, Game.resolution.y - 8.0)
|
mouse_position.y = clamp(mouse_position.y, 8.0, Game.resolution.y - 8.0)
|
||||||
|
|
|
@ -126,3 +126,26 @@ func freeze_frame(time):
|
||||||
#Check if 100%ed
|
#Check if 100%ed
|
||||||
func has_collection_bonus():
|
func has_collection_bonus():
|
||||||
return shards == 5 && golds == 50
|
return shards == 5 && golds == 50
|
||||||
|
|
||||||
|
# called when player dies
|
||||||
|
func _on_player_died() -> void:
|
||||||
|
if lives <= 0 and use_lives:
|
||||||
|
Audio.play_sound(Audio.a_gover, Audio.ac_die)
|
||||||
|
get_tree().get_nodes_in_group("player")[0].queue_free()
|
||||||
|
var time_tween = create_tween()
|
||||||
|
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
||||||
|
Audio.ac_music.stream_paused = true
|
||||||
|
yield(time_tween, "finished")
|
||||||
|
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
||||||
|
call_deferred("restart_level")
|
||||||
|
else:
|
||||||
|
# count death
|
||||||
|
lives -= 1
|
||||||
|
deaths += 1
|
||||||
|
# play death sound
|
||||||
|
Audio.play_sound(Audio.a_die, Audio.ac_die)
|
||||||
|
# death score penalty
|
||||||
|
if use_lives == false && lives < 0:
|
||||||
|
score = max(0, score - 500)
|
||||||
|
# freezeframe
|
||||||
|
Game.freeze_frame(0.3)
|
||||||
|
|
BIN
graphics/particles/bullet_casing.png
Normal file
BIN
graphics/particles/bullet_casing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 551 B |
35
graphics/particles/bullet_casing.png.import
Normal file
35
graphics/particles/bullet_casing.png.import
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/bullet_casing.png-8bc5e58567bcb82b42eb851699be796d.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://graphics/particles/bullet_casing.png"
|
||||||
|
dest_files=[ "res://.import/bullet_casing.png-8bc5e58567bcb82b42eb851699be796d.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
|
|
@ -7,7 +7,7 @@
|
||||||
[ext_resource path="res://audio/music/moon_trail.mp3" type="AudioStream" id=5]
|
[ext_resource path="res://audio/music/moon_trail.mp3" type="AudioStream" id=5]
|
||||||
[ext_resource path="res://graphics/tiles/abyss.png" type="Texture" id=6]
|
[ext_resource path="res://graphics/tiles/abyss.png" type="Texture" id=6]
|
||||||
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://objects/player/player_scholar.tscn" type="PackedScene" id=8]
|
||||||
[ext_resource path="res://objects/environment/ladder/ladder.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://objects/environment/ladder/ladder.tscn" type="PackedScene" id=9]
|
||||||
[ext_resource path="res://graphics/particles/bubble.png" type="Texture" id=10]
|
[ext_resource path="res://graphics/particles/bubble.png" type="Texture" id=10]
|
||||||
[ext_resource path="res://objects/enemy/mine.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://objects/enemy/mine.tscn" type="PackedScene" id=11]
|
||||||
|
@ -190,11 +190,7 @@ color_initial_ramp = SubResource( 11 )
|
||||||
song_name = "@Moon Trail"
|
song_name = "@Moon Trail"
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 8 )]
|
[node name="Player" parent="." instance=ExtResource( 8 )]
|
||||||
position = Vector2( 16, 48 )
|
position = Vector2( 16, 56 )
|
||||||
gravity = 2
|
|
||||||
max_fall_speed = 60.0
|
|
||||||
jump_force = 80
|
|
||||||
doublejump_force = 60
|
|
||||||
|
|
||||||
[node name="LevelBorders" type="StaticBody2D" parent="."]
|
[node name="LevelBorders" type="StaticBody2D" parent="."]
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource path="res://maps/map.gd" type="Script" id=1]
|
[ext_resource path="res://maps/map.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://graphics/backgrounds/factory.png" type="Texture" id=3]
|
[ext_resource path="res://graphics/backgrounds/factory.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://objects/player/player_scholar.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://tilesets/t_factory.tres" type="TileSet" id=5]
|
[ext_resource path="res://tilesets/t_factory.tres" type="TileSet" id=5]
|
||||||
[ext_resource path="res://objects/environment/tube/tube_entrance.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://objects/environment/tube/tube_entrance.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://objects/environment/tube/tube_exit.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://objects/environment/tube/tube_exit.tscn" type="PackedScene" id=7]
|
||||||
|
@ -63,18 +63,15 @@ centered = false
|
||||||
[node name="Camera2D" parent="." instance=ExtResource( 2 )]
|
[node name="Camera2D" parent="." instance=ExtResource( 2 )]
|
||||||
scroll_v = true
|
scroll_v = true
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 24, 136 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_group_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Ground" type="TileMap" parent="."]
|
[node name="Ground" type="TileMap" parent="."]
|
||||||
tile_set = ExtResource( 5 )
|
tile_set = ExtResource( 5 )
|
||||||
cell_size = Vector2( 8, 8 )
|
cell_size = Vector2( 8, 8 )
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( -65523, 1610612739, 0, -65512, 1610612738, 0, -65509, 1610612737, 0, -65508, 1610612737, 0, -65507, 1610612737, 0, -65506, 1610612737, 0, -65505, 1610612737, 0, -65504, 1610612737, 0, -65503, 1610612737, 0, -65502, 1610612737, 0, 13, 1610612739, 0, 65549, 1610612739, 0, 65554, 0, 0, 65555, 0, 2, 65556, 0, 0, 131085, 1610612739, 0, 131090, -1073741824, 2, 131091, 0, 65536, 131092, -1073741824, 2, 131096, 3, 0, 196621, 1610612739, 0, 196626, 0, 0, 196627, 0, 2, 196628, 0, 0, 196632, 3, 0, 262145, 1610612738, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262168, 3, 0, 327696, 1610612738, 0, 327699, 1, 0, 327700, 1, 0, 327701, 1, 0, 327702, 1, 0, 327703, 1, 0, 327704, 2, 0, 393233, 0, 65536, 393241, 0, 0, 458753, 1610612739, 0, 524289, 1610612739, 0, 524292, 1610612738, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 1, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 1, 0, 524308, 1, 0, 524309, -1073741822, 0, 589825, 1610612739, 0, 655361, 1610612739, 0, 720897, 1610612739, 0, 720900, 3, 0, 720917, 3, 0, 786433, 1610612739, 0, 786436, 3, 0, 786453, 3, 0, 851969, 1610612739, 0, 851989, 3, 0, 917517, 1, 0, 917518, 1, 0, 917519, 1, 0, 917520, 1, 0, 917521, 1, 0, 917522, 1, 0, 917523, 1, 0, 917524, 1, 0, 917525, 2, 0, 1114122, 0, 0, 1114123, 0, 2, 1114124, 0, 2, 1114125, 0, 0, 1179658, -1073741824, 2, 1179659, 0, 65536, 1179660, 0, 65536, 1179661, -1073741824, 2, 1245194, 0, 0, 1245195, 0, 2, 1245196, 0, 2, 1245197, 0, 0, 1310721, 0, 1, 1310722, 0, 2, 1310723, 0, 2, 1310724, 0, 2, 1310725, 0, 2, 1310726, 0, 2, 1310727, 0, 2, 1310728, 0, 2, 1310729, 0, 3 )
|
tile_data = PoolIntArray( -65523, 1610612739, 0, -65512, 1610612738, 0, -65509, 1610612737, 0, -65508, 1610612737, 0, -65507, 1610612737, 0, -65506, 1610612737, 0, -65505, 1610612737, 0, -65504, 1610612737, 0, -65503, 1610612737, 0, -65502, 1610612737, 0, 13, 1610612739, 0, 65549, 1610612739, 0, 65554, 0, 0, 65555, 0, 2, 65556, 0, 0, 131085, 1610612739, 0, 131090, -1073741824, 2, 131091, 0, 65536, 131092, -1073741824, 2, 131096, 3, 0, 196621, 1610612739, 0, 196626, 0, 0, 196627, 0, 2, 196628, 0, 0, 196632, 3, 0, 262145, 1610612738, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262168, 3, 0, 327696, 1610612738, 0, 327699, 1, 0, 327700, 1, 0, 327701, 1, 0, 327702, 1, 0, 327703, 1, 0, 327704, 2, 0, 393233, 0, 65536, 393241, 0, 0, 458753, 1610612739, 0, 524289, 1610612739, 0, 524292, 1610612738, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 1, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 1, 0, 524308, 1, 0, 524309, -1073741822, 0, 589825, 1610612739, 0, 655361, 1610612739, 0, 720897, 1610612739, 0, 720900, 3, 0, 720917, 3, 0, 786433, 1610612739, 0, 786436, 3, 0, 786453, 3, 0, 851969, 1610612739, 0, 851989, 3, 0, 917517, 1, 0, 917518, 1, 0, 917519, 1, 0, 917520, 1, 0, 917521, 1, 0, 917522, 1, 0, 917523, 1, 0, 917524, 1, 0, 917525, 2, 0, 1114122, 0, 0, 1114123, 0, 2, 1114124, 0, 2, 1114125, 0, 0, 1179658, -1073741824, 2, 1179659, 0, 65536, 1179660, 0, 65536, 1179661, -1073741824, 2, 1245194, 0, 0, 1245195, 0, 2, 1245196, 0, 2, 1245197, 0, 0, 1310721, 0, 1, 1310722, 0, 2, 1310723, 0, 2, 1310724, 0, 2, 1310725, 0, 2, 1310726, 0, 2, 1310727, 0, 2, 1310728, 0, 2, 1310729, 0, 3 )
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 40, 160 )
|
||||||
|
|
||||||
[node name="Ladder2" type="TileMap" parent="."]
|
[node name="Ladder2" type="TileMap" parent="."]
|
||||||
tile_set = ExtResource( 8 )
|
tile_set = ExtResource( 8 )
|
||||||
cell_size = Vector2( 8, 8 )
|
cell_size = Vector2( 8, 8 )
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,7 @@ onready var levelarrow_up = $LevelArrowUp
|
||||||
onready var levelarrow_down = $LevelArrowDown
|
onready var levelarrow_down = $LevelArrowDown
|
||||||
onready var lives_mode_text = $LivesModeText
|
onready var lives_mode_text = $LivesModeText
|
||||||
onready var easy_mode_text = $EasyModeText
|
onready var easy_mode_text = $EasyModeText
|
||||||
#Shards
|
#Shards
|
||||||
onready var shards = [
|
onready var shards = [
|
||||||
$ShardGraphics/Shard,
|
$ShardGraphics/Shard,
|
||||||
$ShardGraphics/Shard2,
|
$ShardGraphics/Shard2,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[ext_resource path="res://graphics/backgrounds/mountain_mountain.png" type="Texture" id=3]
|
[ext_resource path="res://graphics/backgrounds/mountain_mountain.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://graphics/backgrounds/mountain_clouds.png" type="Texture" id=4]
|
[ext_resource path="res://graphics/backgrounds/mountain_clouds.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://graphics/backgrounds/mountain_sunset.png" type="Texture" id=5]
|
[ext_resource path="res://graphics/backgrounds/mountain_sunset.png" type="Texture" id=5]
|
||||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://objects/player/player_scholar.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://tilesets/t_mountain.tres" type="TileSet" id=7]
|
[ext_resource path="res://tilesets/t_mountain.tres" type="TileSet" id=7]
|
||||||
[ext_resource path="res://objects/enemy/rolling_fiend.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://objects/enemy/rolling_fiend.tscn" type="PackedScene" id=8]
|
||||||
[ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=9]
|
||||||
|
@ -125,7 +125,7 @@ scroll_v = true
|
||||||
respawn_h = false
|
respawn_h = false
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 6 )]
|
[node name="Player" parent="." instance=ExtResource( 6 )]
|
||||||
position = Vector2( 28, 166 )
|
position = Vector2( 24, 176 )
|
||||||
|
|
||||||
[node name="Ladder" type="TileMap" parent="."]
|
[node name="Ladder" type="TileMap" parent="."]
|
||||||
tile_set = ExtResource( 23 )
|
tile_set = ExtResource( 23 )
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=32 format=2]
|
[gd_scene load_steps=33 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]
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
[ext_resource path="res://objects/enemy/laser_wall.tscn" type="PackedScene" id=24]
|
[ext_resource path="res://objects/enemy/laser_wall.tscn" type="PackedScene" id=24]
|
||||||
[ext_resource path="res://objects/enemy/cop.tscn" type="PackedScene" id=25]
|
[ext_resource path="res://objects/enemy/cop.tscn" type="PackedScene" id=25]
|
||||||
[ext_resource path="res://objects/environment/turret/turret_bullet.tscn" type="PackedScene" id=26]
|
[ext_resource path="res://objects/environment/turret/turret_bullet.tscn" type="PackedScene" id=26]
|
||||||
|
[ext_resource path="res://objects/player/player_scholar.tscn" type="PackedScene" id=27]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 16, 20 )
|
extents = Vector2( 16, 20 )
|
||||||
|
@ -179,7 +180,6 @@ position = Vector2( 48, 120 )
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="RollingFiend" index="0"]
|
[node name="AnimatedSprite" parent="RollingFiend" index="0"]
|
||||||
visible = false
|
visible = false
|
||||||
frame = 1
|
|
||||||
|
|
||||||
[node name="SawTest2" type="AnimatedSprite" parent="RollingFiend"]
|
[node name="SawTest2" type="AnimatedSprite" parent="RollingFiend"]
|
||||||
material = SubResource( 4 )
|
material = SubResource( 4 )
|
||||||
|
@ -222,4 +222,7 @@ turn_time = inf
|
||||||
[node name="TurretBullet" parent="." instance=ExtResource( 26 )]
|
[node name="TurretBullet" parent="." instance=ExtResource( 26 )]
|
||||||
position = Vector2( 152, 72 )
|
position = Vector2( 152, 72 )
|
||||||
|
|
||||||
|
[node name="Player2" parent="." instance=ExtResource( 27 )]
|
||||||
|
position = Vector2( 136, 160 )
|
||||||
|
|
||||||
[editable path="RollingFiend"]
|
[editable path="RollingFiend"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends Camera2D
|
extends Camera2D
|
||||||
|
|
||||||
onready var player = get_parent().get_node("Player")
|
onready var player = get_tree().get_nodes_in_group("player").front()
|
||||||
onready var last_sector = Game.get_sector(player.position)
|
onready var last_sector = Game.get_sector(player.global_position)
|
||||||
#Scroll direction
|
#Scroll direction
|
||||||
export var scroll_h = true
|
export var scroll_h = true
|
||||||
export var scroll_v = false
|
export var scroll_v = false
|
||||||
|
@ -12,14 +12,18 @@ func _ready():
|
||||||
Game.current_sector = last_sector
|
Game.current_sector = last_sector
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var current_sector = Game.get_sector(player.position)
|
# use pop_front() instead of [0] so that will not crash without player
|
||||||
if scroll_h && current_sector.x != last_sector.x:
|
if not is_instance_valid(player):
|
||||||
position.x = current_sector.x * Game.resolution.x
|
player = get_tree().get_nodes_in_group("player").pop_front()
|
||||||
if respawn_h:
|
else:
|
||||||
var offset = Vector2(8.0 * sign(current_sector.x - last_sector.x), 0.0)
|
var current_sector = Game.get_sector(player.global_position)
|
||||||
Game.respawn_point = player.global_position
|
if scroll_h && current_sector.x != last_sector.x:
|
||||||
last_sector.x = current_sector.x
|
position.x = current_sector.x * Game.resolution.x
|
||||||
if scroll_v && current_sector.y != last_sector.y:
|
if respawn_h:
|
||||||
position.y = current_sector.y * Game.resolution.y
|
var offset = Vector2(8.0 * sign(current_sector.x - last_sector.x), 0.0)
|
||||||
last_sector.y = current_sector.y
|
Game.respawn_point = player.global_position
|
||||||
Game.current_sector = last_sector
|
last_sector.x = current_sector.x
|
||||||
|
if scroll_v && current_sector.y != last_sector.y:
|
||||||
|
position.y = current_sector.y * Game.resolution.y
|
||||||
|
last_sector.y = current_sector.y
|
||||||
|
Game.current_sector = last_sector
|
||||||
|
|
|
@ -4,7 +4,7 @@ export var value = 1
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Collect
|
#Collect
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
Game.arrows += value
|
Game.arrows += value
|
||||||
Game.score += 25
|
Game.score += 25
|
||||||
Audio.play_sound(Audio.a_arrow,Audio.ac_collectible)
|
Audio.play_sound(Audio.a_arrow,Audio.ac_collectible)
|
||||||
|
|
|
@ -8,7 +8,7 @@ func _ready():
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Collect
|
#Collect
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
Game.golds += value
|
Game.golds += value
|
||||||
Game.score += 5
|
Game.score += 5
|
||||||
Audio.play_sound(Audio.a_gold,Audio.ac_collectible)
|
Audio.play_sound(Audio.a_gold,Audio.ac_collectible)
|
||||||
|
|
|
@ -8,7 +8,7 @@ func _ready():
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Collect
|
#Collect
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
Audio.play_shard_sound()
|
Audio.play_shard_sound()
|
||||||
Game.score += 500
|
Game.score += 500
|
||||||
Game.shards += value
|
Game.shards += value
|
||||||
|
|
|
@ -28,7 +28,7 @@ func _set_color(value):
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Collect
|
#Collect
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
Audio.play_sound(Audio.a_star,Audio.ac_collectible)
|
Audio.play_sound(Audio.a_star,Audio.ac_collectible)
|
||||||
Game.score += 100
|
Game.score += 100
|
||||||
Game.stars[color] = true
|
Game.stars[color] = true
|
||||||
|
|
|
@ -4,7 +4,7 @@ onready var raycast = $Rotation/RayCast2D
|
||||||
onready var anims = $AnimationPlayer
|
onready var anims = $AnimationPlayer
|
||||||
|
|
||||||
func _on_Sight_area_entered(area):
|
func _on_Sight_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
anims.play("lunge")
|
anims.play("lunge")
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||||
|
|
23
objects/enemy/bullet_casing.tscn
Normal file
23
objects/enemy/bullet_casing.tscn
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://graphics/particles/bullet_casing.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="PhysicsMaterial" id=4]
|
||||||
|
bounce = 0.75
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 1, 1.5 )
|
||||||
|
|
||||||
|
[node name="BoneParticle" type="RigidBody2D"]
|
||||||
|
collision_layer = 16
|
||||||
|
physics_material_override = SubResource( 4 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 0, 0.5 )
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_group_": true
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ var turns = 0
|
||||||
|
|
||||||
const BoneParticle = preload("res://objects/enemy/bone_particle.tscn")
|
const BoneParticle = preload("res://objects/enemy/bone_particle.tscn")
|
||||||
const EasyBullet = preload("res://objects/enemy/roboturret_proj.tscn")
|
const EasyBullet = preload("res://objects/enemy/roboturret_proj.tscn")
|
||||||
|
const BulletCasing = preload("res://objects/enemy/bullet_casing.tscn")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if Engine.editor_hint:
|
if Engine.editor_hint:
|
||||||
|
@ -44,7 +45,7 @@ func _physics_process(delta):
|
||||||
if !shooting:
|
if !shooting:
|
||||||
# check for player in raycast
|
# check for player in raycast
|
||||||
var collider = shoot_cast.get_collider()
|
var collider = shoot_cast.get_collider()
|
||||||
if collider != null && (collider.is_in_group("player") or collider.is_in_group("msx")):
|
if collider != null && (collider.is_in_group("player_hitbox") or collider.is_in_group("msx")):
|
||||||
if Game.get_sector(global_position) == Game.get_sector(collider.global_position):
|
if Game.get_sector(global_position) == Game.get_sector(collider.global_position):
|
||||||
if Game.is_easy_mode:
|
if Game.is_easy_mode:
|
||||||
var easy_bullet = EasyBullet.instance()
|
var easy_bullet = EasyBullet.instance()
|
||||||
|
@ -56,13 +57,16 @@ func _physics_process(delta):
|
||||||
else:
|
else:
|
||||||
# kill player and enter shooting state temporarily
|
# kill player and enter shooting state temporarily
|
||||||
collider.get_parent().die()
|
collider.get_parent().die()
|
||||||
|
|
||||||
# play sound
|
# play sound
|
||||||
Audio.play_sound(Audio.a_die_robot, Audio.ac_boss)
|
Audio.play_sound(Audio.a_die_robot, Audio.ac_boss)
|
||||||
|
|
||||||
# muzzle flash
|
# muzzle flash
|
||||||
muzzle_flash.emitting = true
|
muzzle_flash.emitting = true
|
||||||
shooting = true
|
shooting = true
|
||||||
get_tree().create_timer(0.5, false).connect("timeout", self, "_stop_shoot")
|
get_tree().create_timer(0.5, false).connect("timeout", self, "_stop_shoot")
|
||||||
sprite.play("shoot")
|
sprite.play("shoot")
|
||||||
|
|
||||||
# check other raycast to find collision passing through player
|
# check other raycast to find collision passing through player
|
||||||
graphics_cast.force_raycast_update()
|
graphics_cast.force_raycast_update()
|
||||||
var hit_position = graphics_cast.to_global(Vector2(256.0, 0.0))
|
var hit_position = graphics_cast.to_global(Vector2(256.0, 0.0))
|
||||||
|
@ -76,6 +80,16 @@ func _physics_process(delta):
|
||||||
# move and play sparks
|
# move and play sparks
|
||||||
sparks.global_position = hit_position
|
sparks.global_position = hit_position
|
||||||
sparks.emitting = true
|
sparks.emitting = true
|
||||||
|
|
||||||
|
# spawn a bullet casing
|
||||||
|
var casing = BulletCasing.instance()
|
||||||
|
casing.rotation = rand_range(0.0, 2.0*PI) # random rotation
|
||||||
|
casing.global_position = shoot_position.global_position
|
||||||
|
casing.linear_velocity = Vector2(45.0 * rand_range(0.5, 1.5), 0.0).rotated(rand_range(-PI, 0.0))
|
||||||
|
casing.angular_velocity = rand_range(-PI*2.0, PI*2.0)
|
||||||
|
var timer = get_tree().create_timer(3.0 + rand_range(0.0, 1.0), false)
|
||||||
|
timer.connect("timeout", casing, "queue_free")
|
||||||
|
get_parent().call_deferred("add_child", casing)
|
||||||
return
|
return
|
||||||
|
|
||||||
# if there aren't turns, walk around
|
# if there aren't turns, walk around
|
||||||
|
|
|
@ -26,7 +26,7 @@ var death_blood_offset = Vector2.ZERO
|
||||||
|
|
||||||
func _on_Hitbox_area_entered(area):
|
func _on_Hitbox_area_entered(area):
|
||||||
#Kill player
|
#Kill player
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
area.get_parent().die()
|
area.get_parent().die()
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
|
|
|
@ -32,7 +32,7 @@ func _physics_process(delta):
|
||||||
else: move_up_and_down(delta)
|
else: move_up_and_down(delta)
|
||||||
#Speed up if in raycast
|
#Speed up if in raycast
|
||||||
if raycast.get_collider() != null:
|
if raycast.get_collider() != null:
|
||||||
if raycast.get_collider().is_in_group("player"):
|
if raycast.get_collider().is_in_group("player_hitbox"):
|
||||||
go_fast = true
|
go_fast = true
|
||||||
timer.set_wait_time(0.5)
|
timer.set_wait_time(0.5)
|
||||||
timer.start()
|
timer.start()
|
||||||
|
|
|
@ -25,7 +25,7 @@ func _physics_process(delta):
|
||||||
sparks.emitting = true
|
sparks.emitting = true
|
||||||
|
|
||||||
var collider = cast.get_collider()
|
var collider = cast.get_collider()
|
||||||
if collider.is_in_group("player") or collider.is_in_group("msx"):
|
if collider.is_in_group("player_hitbox") or collider.is_in_group("msx"):
|
||||||
collider.get_parent().die()
|
collider.get_parent().die()
|
||||||
else:
|
else:
|
||||||
line.visible = false
|
line.visible = false
|
||||||
|
|
|
@ -18,7 +18,7 @@ func _on_Hitbox_area_entered(area):
|
||||||
if area.is_in_group("explosion"):
|
if area.is_in_group("explosion"):
|
||||||
var timer = get_tree().create_timer(0.2, false)
|
var timer = get_tree().create_timer(0.2, false)
|
||||||
timer.connect("timeout", self, "die")
|
timer.connect("timeout", self, "die")
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
die()
|
die()
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
|
|
|
@ -16,7 +16,7 @@ func _physics_process(delta):
|
||||||
position.y -= speed * delta
|
position.y -= speed * delta
|
||||||
|
|
||||||
func _on_area_entered(area):
|
func _on_area_entered(area):
|
||||||
if area.is_in_group("player") or area.is_in_group("arrow"):
|
if area.is_in_group("player_hitbox") or area.is_in_group("arrow"):
|
||||||
sprite.frame_coords.y = 1
|
sprite.frame_coords.y = 1
|
||||||
speed = 0.0
|
speed = 0.0
|
||||||
get_tree().create_timer(0.5, false).connect("timeout", self, "queue_free")
|
get_tree().create_timer(0.5, false).connect("timeout", self, "queue_free")
|
||||||
|
|
|
@ -2,5 +2,5 @@ extends Area2D
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Kill player
|
#Kill player
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
area.get_parent().die()
|
area.get_parent().die()
|
||||||
|
|
|
@ -15,7 +15,7 @@ func _physics_process(delta):
|
||||||
anims.play("open")
|
anims.play("open")
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
if Game.score > Game.high_score: Game.high_score = Game.score
|
if Game.score > Game.high_score: Game.high_score = Game.score
|
||||||
#BONUSES
|
#BONUSES
|
||||||
#Collection bonus
|
#Collection bonus
|
||||||
|
|
|
@ -22,7 +22,7 @@ func _physics_process(delta):
|
||||||
position.y += fall_speed
|
position.y += fall_speed
|
||||||
#Crush the player
|
#Crush the player
|
||||||
for area in crush_area.get_overlapping_areas():
|
for area in crush_area.get_overlapping_areas():
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
var player = area.get_parent()
|
var player = area.get_parent()
|
||||||
if player.is_on_floor():
|
if player.is_on_floor():
|
||||||
player.die()
|
player.die()
|
||||||
|
@ -31,7 +31,7 @@ func _physics_process(delta):
|
||||||
anims.play("disappear")
|
anims.play("disappear")
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
fall_timer.start()
|
fall_timer.start()
|
||||||
sprite.frame = 1
|
sprite.frame = 1
|
||||||
|
|
||||||
|
@ -59,5 +59,5 @@ func _on_FallTimer_timeout():
|
||||||
|
|
||||||
|
|
||||||
#func _on_Area2D_area_exited(area):
|
#func _on_Area2D_area_exited(area):
|
||||||
# if area.is_in_group("player") && graphic == Graphics.GRAVEYARD:
|
# if area.is_in_group("player_hitbox") && graphic == Graphics.GRAVEYARD:
|
||||||
# sprite.frame = 0
|
# sprite.frame = 0
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
extends Node2D
|
extends Area2D
|
||||||
onready var left_snap = $LeftSnap
|
|
||||||
onready var right_snap = $RightSnap
|
onready var left_snap: float = $LeftSnap.global_position.x
|
||||||
onready var middle = position.x + 4
|
onready var right_snap: float = $RightSnap.global_position.x
|
||||||
|
onready var middle: float = global_position.x + 4.0
|
||||||
|
|
|
@ -5,13 +5,11 @@
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 6, 4 )
|
extents = Vector2( 6, 4 )
|
||||||
|
|
||||||
[node name="Ladder" type="Node2D"]
|
[node name="Ladder" type="Area2D" groups=["ladder"]]
|
||||||
|
collision_layer = 64
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
collision_layer = 64
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
|
||||||
position = Vector2( 4, 4 )
|
position = Vector2( 4, 4 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ var sound = load("res://audio/sounds/button.ogg")
|
||||||
|
|
||||||
func _on_ActivationArea_area_entered(area):
|
func _on_ActivationArea_area_entered(area):
|
||||||
if !pressed:
|
if !pressed:
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
activate()
|
activate()
|
||||||
$Sprite.frame = 1
|
$Sprite.frame = 1
|
||||||
pressed = true
|
pressed = true
|
||||||
|
|
|
@ -4,7 +4,7 @@ export var speed = 120.0
|
||||||
export var direction = Vector2.RIGHT
|
export var direction = Vector2.RIGHT
|
||||||
|
|
||||||
func _on_TubeEntrance_area_entered(area):
|
func _on_TubeEntrance_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
var player = area.get_parent()
|
var player = area.get_parent()
|
||||||
player.global_position = global_position + Vector2(4.0, 4.0)
|
player.global_position = global_position + Vector2(4.0, 4.0)
|
||||||
player.enter_transport(speed, direction)
|
player.enter_transport(speed, direction)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
func _on_TubeExit_area_entered(area):
|
func _on_TubeExit_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
area.get_parent().exit_transport()
|
area.get_parent().exit_transport()
|
||||||
|
|
|
@ -35,9 +35,9 @@ func _on_DelayTimer_timeout():
|
||||||
|
|
||||||
|
|
||||||
func _on_DetectPlayer_area_entered(area):
|
func _on_DetectPlayer_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
body.collision_layer = 0
|
body.collision_layer = 0
|
||||||
|
|
||||||
func _on_DetectPlayer_area_exited(area):
|
func _on_DetectPlayer_area_exited(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
body.collision_layer = collision_layer
|
body.collision_layer = collision_layer
|
||||||
|
|
|
@ -9,7 +9,7 @@ func _physics_process(delta):
|
||||||
|
|
||||||
|
|
||||||
func _on_Hitbox_area_entered(area):
|
func _on_Hitbox_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
area.get_parent().die()
|
area.get_parent().die()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ func die():
|
||||||
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
||||||
Audio.ac_music.stream_paused = true
|
Audio.ac_music.stream_paused = true
|
||||||
yield(time_tween, "finished") #Resume from freeze frame
|
yield(time_tween, "finished") #Resume from freeze frame
|
||||||
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
yield(get_tree().create_timer, "timeout")
|
||||||
Game.call_deferred("restart_level")
|
Game.call_deferred("restart_level")
|
||||||
else:
|
else:
|
||||||
#Die
|
#Die
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=35 format=2]
|
[gd_scene load_steps=34 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
|
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://graphics/player/sg_walk.png" type="Texture" id=2]
|
[ext_resource path="res://graphics/player/sg_walk.png" type="Texture" id=2]
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
[ext_resource path="res://graphics/player/sg_shoot_air.png" type="Texture" id=12]
|
[ext_resource path="res://graphics/player/sg_shoot_air.png" type="Texture" id=12]
|
||||||
[ext_resource path="res://shaders/recolor.tres" type="Shader" id=13]
|
[ext_resource path="res://shaders/recolor.tres" type="Shader" id=13]
|
||||||
[ext_resource path="res://graphics/player/sg_doublejump.png" type="Texture" id=14]
|
[ext_resource path="res://graphics/player/sg_doublejump.png" type="Texture" id=14]
|
||||||
[ext_resource path="res://graphics/particles/blood.png" type="Texture" id=15]
|
[ext_resource path="res://objects/player/player_death_particles.tscn" type="PackedScene" id=15]
|
||||||
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=16]
|
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=16]
|
||||||
[ext_resource path="res://scripts/snap_sprite.gd" type="Script" id=17]
|
[ext_resource path="res://scripts/snap_sprite.gd" type="Script" id=17]
|
||||||
|
|
||||||
|
@ -644,9 +644,6 @@ tracks/4/keys = {
|
||||||
[sub_resource type="RectangleShape2D" id=34]
|
[sub_resource type="RectangleShape2D" id=34]
|
||||||
extents = Vector2( 6, 7 )
|
extents = Vector2( 6, 7 )
|
||||||
|
|
||||||
[sub_resource type="Curve" id=41]
|
|
||||||
_data = [ Vector2( 0, 1 ), 0.0, -0.113537, 0, 0, Vector2( 1, 0 ), -3.35032, 0.0, 0, 0 ]
|
|
||||||
|
|
||||||
[sub_resource type="Curve" id=43]
|
[sub_resource type="Curve" id=43]
|
||||||
_data = [ Vector2( 0, 1 ), 0.0, -0.0636948, 0, 0, Vector2( 1, 0 ), -3.43886, 0.0, 0, 0 ]
|
_data = [ Vector2( 0, 1 ), 0.0, -0.0636948, 0, 0, Vector2( 1, 0 ), -3.43886, 0.0, 0, 0 ]
|
||||||
|
|
||||||
|
@ -719,28 +716,7 @@ position = Vector2( 0, 3 )
|
||||||
shape = SubResource( 34 )
|
shape = SubResource( 34 )
|
||||||
disabled = true
|
disabled = true
|
||||||
|
|
||||||
[node name="DeathSplatter" type="CPUParticles2D" parent="."]
|
[node name="DeathSplatter" parent="." instance=ExtResource( 15 )]
|
||||||
pause_mode = 2
|
|
||||||
emitting = false
|
|
||||||
amount = 16
|
|
||||||
lifetime = 0.3
|
|
||||||
one_shot = true
|
|
||||||
explosiveness = 0.9
|
|
||||||
local_coords = false
|
|
||||||
texture = ExtResource( 15 )
|
|
||||||
emission_shape = 2
|
|
||||||
emission_rect_extents = Vector2( 4, 4 )
|
|
||||||
direction = Vector2( 0, -1 )
|
|
||||||
spread = 180.0
|
|
||||||
gravity = Vector2( 0, 50 )
|
|
||||||
initial_velocity = 60.0
|
|
||||||
initial_velocity_random = 0.9
|
|
||||||
damping = 2.0
|
|
||||||
angle = 720.0
|
|
||||||
angle_random = 1.0
|
|
||||||
scale_amount = 0.5
|
|
||||||
scale_amount_random = 1.0
|
|
||||||
scale_amount_curve = SubResource( 41 )
|
|
||||||
|
|
||||||
[node name="DustParticles" type="CPUParticles2D" parent="."]
|
[node name="DustParticles" type="CPUParticles2D" parent="."]
|
||||||
position = Vector2( 0, 12 )
|
position = Vector2( 0, 12 )
|
||||||
|
|
29
objects/player/player_death_particles.tscn
Normal file
29
objects/player/player_death_particles.tscn
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://graphics/particles/blood.png" type="Texture" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id=41]
|
||||||
|
_data = [ Vector2( 0, 1 ), 0.0, -0.113537, 0, 0, Vector2( 1, 0 ), -3.35032, 0.0, 0, 0 ]
|
||||||
|
|
||||||
|
[node name="DeathSplatter" type="CPUParticles2D"]
|
||||||
|
pause_mode = 2
|
||||||
|
emitting = false
|
||||||
|
amount = 16
|
||||||
|
lifetime = 0.3
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 0.9
|
||||||
|
local_coords = false
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
emission_shape = 2
|
||||||
|
emission_rect_extents = Vector2( 4, 4 )
|
||||||
|
direction = Vector2( 0, -1 )
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector2( 0, 50 )
|
||||||
|
initial_velocity = 60.0
|
||||||
|
initial_velocity_random = 0.9
|
||||||
|
damping = 2.0
|
||||||
|
angle = 720.0
|
||||||
|
angle_random = 1.0
|
||||||
|
scale_amount = 0.5
|
||||||
|
scale_amount_random = 1.0
|
||||||
|
scale_amount_curve = SubResource( 41 )
|
265
objects/player/player_scholar.gd
Normal file
265
objects/player/player_scholar.gd
Normal file
|
@ -0,0 +1,265 @@
|
||||||
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
# SIGNALS #
|
||||||
|
signal died()
|
||||||
|
|
||||||
|
# CONSTANTS #
|
||||||
|
const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
|
||||||
|
const DeathSplatter = preload("res://objects/player/player_death_particles.tscn")
|
||||||
|
|
||||||
|
# EXPORTS #
|
||||||
|
## horizontal movement speed
|
||||||
|
export var walk_speed: float = 50.0
|
||||||
|
## climbing speed
|
||||||
|
export var climb_speed: float = 39.0
|
||||||
|
## gravity force
|
||||||
|
export var gravity: float = 720.0
|
||||||
|
## SG's terminal velocity
|
||||||
|
export var max_fall_speed: float = 255.0
|
||||||
|
## upward added by jump
|
||||||
|
export var jump_force: float = 150.0
|
||||||
|
## proportion of remaining force retained when jump is released
|
||||||
|
export var jump_release_force: float = 0.25
|
||||||
|
## impulse added when double jumping
|
||||||
|
export var double_jump_force: float = 122.0
|
||||||
|
|
||||||
|
|
||||||
|
# velocity
|
||||||
|
var velocity: Vector2 = Vector2.ZERO
|
||||||
|
# snap vector
|
||||||
|
var snap: Vector2 = Vector2.ZERO
|
||||||
|
# ladder currently attached to
|
||||||
|
var _attached_ladder: Node2D = null
|
||||||
|
|
||||||
|
|
||||||
|
# NODE REFERENCES #
|
||||||
|
onready var state_chart: StateChart = $StateChart
|
||||||
|
onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||||
|
onready var graphics: Node2D = $Graphics
|
||||||
|
onready var sprite: Sprite = $"%Sprite"
|
||||||
|
onready var arrow_position: Position2D = $"%ArrowPosition"
|
||||||
|
onready var dust_particles: CPUParticles2D = $"%DustParticles"
|
||||||
|
onready var grounded_shape: CollisionShape2D = $"%GroundedShape"
|
||||||
|
onready var airborne_shape: CollisionShape2D = $"%AirborneShape"
|
||||||
|
onready var ladder_detector: RayCast2D = $"%LadderDetector"
|
||||||
|
onready var death_splatter_position: Position2D = $"%DeathSplatterPosition"
|
||||||
|
|
||||||
|
|
||||||
|
# OVERRIDES #
|
||||||
|
func _ready() -> void:
|
||||||
|
Game.respawn_point = global_position
|
||||||
|
connect("died", Game, "_on_player_died")
|
||||||
|
move_and_slide(Vector2(0.0, 1.0), Vector2.UP)
|
||||||
|
state_chart.initialize()
|
||||||
|
state_chart.set_guard_property("can_respawn", true)
|
||||||
|
$StateDebugLayer/StateChartDebug.target = state_chart
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
# update transition guard properties
|
||||||
|
# whether player can currently shoot an arrow
|
||||||
|
var can_shoot = Game.arrows > 0 and get_tree().get_nodes_in_group("player_arrow").size() == 0
|
||||||
|
state_chart.set_guard_property("can_shoot", can_shoot)
|
||||||
|
|
||||||
|
# check for and propagate input events
|
||||||
|
if Input.is_action_just_pressed("jump"): # jumping
|
||||||
|
state_chart.send_event("jump")
|
||||||
|
if Input.is_action_just_pressed("shoot"): # shooting
|
||||||
|
state_chart.send_event("shoot")
|
||||||
|
|
||||||
|
# send relevant events
|
||||||
|
if is_on_floor(): # check on floor status
|
||||||
|
state_chart.send_event("grounded")
|
||||||
|
else:
|
||||||
|
state_chart.send_event("airborne")
|
||||||
|
|
||||||
|
# check if in contact with ladder
|
||||||
|
if ladder_detector.is_colliding():
|
||||||
|
state_chart.send_event("ladder_touched")
|
||||||
|
|
||||||
|
|
||||||
|
# HELPER FUNCTIONS #
|
||||||
|
## spawns an arrow
|
||||||
|
func spawn_arrow() -> void:
|
||||||
|
var arrow = ArrowProjectile.instance()
|
||||||
|
arrow.global_position = arrow_position.global_position
|
||||||
|
arrow.direction = sign(arrow_position.global_position.x - global_position.x)
|
||||||
|
arrow.add_to_group("player_arrow")
|
||||||
|
get_parent().add_child(arrow)
|
||||||
|
Audio.play_sound(Audio.a_shoot, Audio.ac_jump)
|
||||||
|
|
||||||
|
func die() -> void:
|
||||||
|
state_chart.send_event("hurt")
|
||||||
|
|
||||||
|
|
||||||
|
# STATE ENTERS/EXITS #
|
||||||
|
func _on_Grounded_state_entered() -> void:
|
||||||
|
# still jump if pressed frame hit ground
|
||||||
|
if Input.is_action_just_pressed("jump"):
|
||||||
|
print("BOING")
|
||||||
|
state_chart.send_event("jump")
|
||||||
|
# toggle hurtbox shapes
|
||||||
|
grounded_shape.disabled = false
|
||||||
|
airborne_shape.disabled = true
|
||||||
|
snap.y = 2.5 # snap when in grounded state
|
||||||
|
velocity.y = 1.0
|
||||||
|
|
||||||
|
func _on_Airborne_state_entered() -> void:
|
||||||
|
grounded_shape.disabled = true
|
||||||
|
airborne_shape.disabled = false
|
||||||
|
snap.y = 0.0 # do not snap when in air
|
||||||
|
velocity.y = 0.0
|
||||||
|
|
||||||
|
func _on_NormalJump_state_entered() -> void:
|
||||||
|
velocity.y = -jump_force
|
||||||
|
Audio.play_sound(Audio.a_jump, Audio.ac_jump)
|
||||||
|
animation_player.play("jump")
|
||||||
|
dust_particles.restart()
|
||||||
|
|
||||||
|
func _on_NormalJump_state_exited() -> void:
|
||||||
|
# add bit of force proportional to how much of the jump is left
|
||||||
|
if Input.is_action_just_released("jump"):
|
||||||
|
var factor = inverse_lerp(0.0, -jump_force, velocity.y)
|
||||||
|
velocity.y = -jump_force * factor * jump_release_force
|
||||||
|
|
||||||
|
func _on_LadderJump_state_entered() -> void:
|
||||||
|
velocity.y = -jump_force
|
||||||
|
Audio.play_sound(Audio.a_jump, Audio.ac_jump)
|
||||||
|
animation_player.play("jump")
|
||||||
|
|
||||||
|
func _on_DoubleJump_state_entered() -> void:
|
||||||
|
velocity.y = -double_jump_force
|
||||||
|
Audio.play_sound(Audio.a_doublejump, Audio.ac_jump)
|
||||||
|
animation_player.play("double_jump")
|
||||||
|
|
||||||
|
func _on_CoyoteFalling_state_entered() -> void:
|
||||||
|
velocity.x = 0.0
|
||||||
|
animation_player.play("fall")
|
||||||
|
|
||||||
|
func _on_NormalFalling_state_entered() -> void:
|
||||||
|
animation_player.play("fall")
|
||||||
|
|
||||||
|
func _on_ScaredFalling_state_entered() -> void:
|
||||||
|
velocity.x = 0.0
|
||||||
|
animation_player.play("fall_scared")
|
||||||
|
|
||||||
|
func _on_Shooting_state_entered() -> void:
|
||||||
|
velocity.x = 0.0
|
||||||
|
animation_player.play("shoot_grounded")
|
||||||
|
|
||||||
|
func _on_AirShooting_state_entered() -> void:
|
||||||
|
spawn_arrow()
|
||||||
|
animation_player.play("shoot_airborne")
|
||||||
|
|
||||||
|
func _on_Climbing_state_entered() -> void:
|
||||||
|
if ladder_detector.get_collider().is_in_group("ladder"):
|
||||||
|
_attached_ladder = ladder_detector.get_collider()
|
||||||
|
velocity = Vector2.ZERO
|
||||||
|
snap = Vector2.ZERO
|
||||||
|
if global_position.x < _attached_ladder.middle:
|
||||||
|
global_position.x = _attached_ladder.left_snap
|
||||||
|
graphics.scale.x = 1.0
|
||||||
|
else:
|
||||||
|
global_position.x = _attached_ladder.right_snap
|
||||||
|
graphics.scale.x = -1.0
|
||||||
|
animation_player.play("climb")
|
||||||
|
|
||||||
|
func _on_Climbing_state_exited() -> void:
|
||||||
|
_attached_ladder = null
|
||||||
|
animation_player.playback_speed = 1.0 # restore playback speed
|
||||||
|
|
||||||
|
# all the stuff that happens when they DIE
|
||||||
|
func _on_Dead_state_entered() -> void:
|
||||||
|
# send signals
|
||||||
|
emit_signal("died")
|
||||||
|
state_chart.send_event("died")
|
||||||
|
# spawn death particles
|
||||||
|
var particles = DeathSplatter.instance()
|
||||||
|
particles.global_position = death_splatter_position.global_position
|
||||||
|
particles.emitting = true
|
||||||
|
get_parent().add_child(particles)
|
||||||
|
# fade into the ether
|
||||||
|
graphics.visible = false
|
||||||
|
state_chart.send_event("respawn")
|
||||||
|
|
||||||
|
func _on_Respawn_state_entered() -> void:
|
||||||
|
global_position = Game.respawn_point
|
||||||
|
graphics.visible = true
|
||||||
|
state_chart.call_deferred("send_event", "get_real")
|
||||||
|
|
||||||
|
|
||||||
|
# STATE PROCESSING #
|
||||||
|
## when on ground
|
||||||
|
func _process_grounded(delta: float) -> void:
|
||||||
|
# make sure is_on_floor detected still
|
||||||
|
velocity.y = 1.0
|
||||||
|
|
||||||
|
## called when player can move left and rightpass # Repass # Rpass # Replace with function body.eplace with function body.place with function body.
|
||||||
|
func _process_horizontal_movement(delta: float) -> void:
|
||||||
|
var input_dir = sign(Input.get_axis("ui_left", "ui_right")) # sign() to normalize
|
||||||
|
velocity.x = input_dir * walk_speed
|
||||||
|
if input_dir != 0.0:
|
||||||
|
graphics.scale.x = input_dir
|
||||||
|
|
||||||
|
## walk/idle state
|
||||||
|
func _process_can_walk(delta: float) -> void:
|
||||||
|
if sign(Input.get_axis("ui_left", "ui_right")) != 0.0:
|
||||||
|
animation_player.play("walk")
|
||||||
|
else:
|
||||||
|
animation_player.play("idle")
|
||||||
|
|
||||||
|
## climbing on ladders
|
||||||
|
func _process_climbing(delta: float) -> void:
|
||||||
|
# climbing movement
|
||||||
|
var input_dir = sign(Input.get_axis("ui_up", "ui_down"))
|
||||||
|
velocity.y = input_dir * climb_speed # move in input direction
|
||||||
|
animation_player.playback_speed = abs(input_dir) # play/pause animation
|
||||||
|
|
||||||
|
# # switching sides of ladder
|
||||||
|
# if global_position.x < _attached_ladder.middle and Input.is_action_just_pressed("ui_right"):
|
||||||
|
# global_position.x = _attached_ladder.right_snap
|
||||||
|
# graphics.scale.x = -1SimCity.0SimCitySimCity
|
||||||
|
# elif Input.is_action_just_pressed("ui_left"):
|
||||||
|
# global_position.x = _attached_ladder.left_snap
|
||||||
|
# graphics.scale.x = 1.0
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("jump"):
|
||||||
|
global_position.x -= graphics.scale.x * 3.0
|
||||||
|
state_chart.send_event("jump")
|
||||||
|
if Input.is_action_just_pressed("shoot"):
|
||||||
|
global_position.x -= graphics.scale.x * 3.0
|
||||||
|
state_chart.send_event("ladder_detach")
|
||||||
|
|
||||||
|
# check if still on ladder
|
||||||
|
if ladder_detector.get_collider() != _attached_ladder:
|
||||||
|
if input_dir == -1.0:
|
||||||
|
state_chart.send_event("jump")
|
||||||
|
else:
|
||||||
|
state_chart.send_event("ladder_detach")
|
||||||
|
|
||||||
|
func _process_jump(delta: float) -> void:
|
||||||
|
if velocity.y >= 0.0:
|
||||||
|
state_chart.send_event("jump_peak")
|
||||||
|
if not Input.is_action_pressed("jump"):
|
||||||
|
state_chart.send_event("jump_released")
|
||||||
|
|
||||||
|
## called by states SG will fall during
|
||||||
|
func _process_gravity(delta: float) -> void:
|
||||||
|
velocity.y = min(velocity.y + gravity * delta, max_fall_speed)
|
||||||
|
|
||||||
|
## called after all other physics things
|
||||||
|
func _process_movement(delta: float) -> void:
|
||||||
|
# apply velocity and react to collisions
|
||||||
|
velocity = move_and_slide_with_snap(velocity, snap, Vector2.UP)
|
||||||
|
|
||||||
|
# deal with that STUPID landing exactly on corner bug
|
||||||
|
var col = get_last_slide_collision()
|
||||||
|
if col != null:
|
||||||
|
if col.remainder.y >= 1.0 and col.normal.y == 0.0:
|
||||||
|
position.x += col.normal.x * 0.001
|
||||||
|
|
||||||
|
|
||||||
|
# COLLISION CALLBACKS #
|
||||||
|
func _on_Hitbox_body_entered(body: Node) -> void:
|
||||||
|
if body.is_in_group("death"):
|
||||||
|
die()
|
||||||
|
|
956
objects/player/player_scholar.tscn
Normal file
956
objects/player/player_scholar.tscn
Normal file
|
@ -0,0 +1,956 @@
|
||||||
|
[gd_scene load_steps=37 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://objects/player/player_scholar.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://graphics/player/pal_purplearmor.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://shaders/recolor_border.shader" type="Shader" id=3]
|
||||||
|
[ext_resource path="res://graphics/player/sg_idle.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/parallel_state.gd" type="Script" id=5]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/state_chart.gd" type="Script" id=6]
|
||||||
|
[ext_resource path="res://ui/theme.tres" type="Theme" id=7]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/state_chart_debug.gd" type="Script" id=8]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/compound_state.gd" type="Script" id=9]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/transition.gd" type="Script" id=10]
|
||||||
|
[ext_resource path="res://addons/godot_state_charts/atomic_state.gd" type="Script" id=11]
|
||||||
|
[ext_resource path="res://graphics/player/sg_walk.png" type="Texture" id=12]
|
||||||
|
[ext_resource path="res://graphics/player/sg_jump.png" type="Texture" id=13]
|
||||||
|
[ext_resource path="res://graphics/player/sg_climb.png" type="Texture" id=14]
|
||||||
|
[ext_resource path="res://graphics/player/sg_shoot_grounded.png" type="Texture" id=15]
|
||||||
|
[ext_resource path="res://graphics/player/sg_shoot_air.png" type="Texture" id=16]
|
||||||
|
[ext_resource path="res://graphics/player/sg_doublejump.png" type="Texture" id=17]
|
||||||
|
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=18]
|
||||||
|
[ext_resource path="res://graphics/player/sg_fall_scared.png" type="Texture" id=19]
|
||||||
|
[ext_resource path="res://graphics/player/sg_fall.png" type="Texture" id=20]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id=1]
|
||||||
|
shader = ExtResource( 3 )
|
||||||
|
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||||
|
shader_param/border_corners = true
|
||||||
|
shader_param/palette = ExtResource( 2 )
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id=13]
|
||||||
|
_data = [ Vector2( 0, 1 ), 0.0, -0.0636948, 0, 0, Vector2( 1, 0 ), -3.43886, 0.0, 0, 0 ]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
extents = Vector2( 2.5, 5 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 2.5, 5 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=16]
|
||||||
|
extents = Vector2( 2.5, 2.5 )
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=5]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": [ ExtResource( 4 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": [ 1 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ 0 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=9]
|
||||||
|
resource_name = "climb"
|
||||||
|
length = 0.3
|
||||||
|
loop = true
|
||||||
|
step = 0.15
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 14 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 2 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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.15 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0, 1 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=12]
|
||||||
|
resource_name = "double_jump"
|
||||||
|
length = 0.32
|
||||||
|
loop = true
|
||||||
|
step = 0.04
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 17 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 2 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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.04, 0.08, 0.12, 0.16, 0.2, 0.24, 0.28 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0, 1, 0, 1, 0, 1, 0, 1 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.08, 0.16, 0.24 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1, 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0.0, 90.0, 180.0, 270.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=15]
|
||||||
|
resource_name = "fall"
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 20 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 1 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=14]
|
||||||
|
resource_name = "fall_scared"
|
||||||
|
length = 0.2
|
||||||
|
loop = true
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 19 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 2 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0, 1 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PoolRealArray( 0.00238396 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=6]
|
||||||
|
resource_name = "idle"
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 4 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 1 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=8]
|
||||||
|
resource_name = "jump"
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 13 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 1 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=11]
|
||||||
|
resource_name = "shoot_airborne"
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 16 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.001 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 1, 1 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ 0 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=10]
|
||||||
|
resource_name = "shoot_grounded"
|
||||||
|
length = 0.25
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 15 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 6 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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.03, 0.06, 0.12, 0.15, 0.18 ),
|
||||||
|
"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("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
tracks/4/type = "method"
|
||||||
|
tracks/4/path = NodePath(".")
|
||||||
|
tracks/4/interp = 1
|
||||||
|
tracks/4/loop_wrap = true
|
||||||
|
tracks/4/imported = false
|
||||||
|
tracks/4/enabled = true
|
||||||
|
tracks/4/keys = {
|
||||||
|
"times": PoolRealArray( 0.12 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "spawn_arrow"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
tracks/5/type = "method"
|
||||||
|
tracks/5/path = NodePath("StateChart")
|
||||||
|
tracks/5/interp = 1
|
||||||
|
tracks/5/loop_wrap = true
|
||||||
|
tracks/5/imported = false
|
||||||
|
tracks/5/enabled = true
|
||||||
|
tracks/5/keys = {
|
||||||
|
"times": PoolRealArray( 0.25 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ "shoot_end" ],
|
||||||
|
"method": "send_event"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=7]
|
||||||
|
resource_name = "walk"
|
||||||
|
length = 0.4
|
||||||
|
loop = true
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||||
|
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": 1,
|
||||||
|
"values": [ ExtResource( 12 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||||
|
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": 1,
|
||||||
|
"values": [ 4 ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("Graphics/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": [ 0, 1, 2, 3 ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||||
|
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": 0,
|
||||||
|
"values": [ 0.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id=4]
|
||||||
|
|
||||||
|
[node name="Player" type="KinematicBody2D" groups=["player"]]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 7
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
gravity = 700.0
|
||||||
|
jump_force = 140.0
|
||||||
|
double_jump_force = 124.0
|
||||||
|
|
||||||
|
[node name="Graphics" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="Graphics"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
material = SubResource( 1 )
|
||||||
|
position = Vector2( 0, -10 )
|
||||||
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="ArrowPosition" type="Position2D" parent="Graphics"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 5, -7 )
|
||||||
|
__meta__ = {
|
||||||
|
"_gizmo_extents_": 2.0
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="DeathSplatterPosition" type="Position2D" parent="Graphics"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 0, -10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_gizmo_extents_": 2.0
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="DustParticles" type="CPUParticles2D" parent="Graphics"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 0, 2 )
|
||||||
|
z_index = 1
|
||||||
|
emitting = false
|
||||||
|
amount = 5
|
||||||
|
lifetime = 0.3
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 0.9
|
||||||
|
fract_delta = false
|
||||||
|
local_coords = false
|
||||||
|
texture = ExtResource( 18 )
|
||||||
|
emission_shape = 2
|
||||||
|
emission_rect_extents = Vector2( 5, 0 )
|
||||||
|
direction = Vector2( 0, -1 )
|
||||||
|
spread = 60.0
|
||||||
|
gravity = Vector2( 0, 0 )
|
||||||
|
initial_velocity = 10.0
|
||||||
|
initial_velocity_random = 0.8
|
||||||
|
angle = 720.0
|
||||||
|
angle_random = 1.0
|
||||||
|
scale_amount = 0.25
|
||||||
|
scale_amount_random = 0.5
|
||||||
|
scale_amount_curve = SubResource( 13 )
|
||||||
|
|
||||||
|
[node name="BodyShape" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 0.5, -5 )
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="Hitbox" type="Area2D" parent="." groups=["player_hitbox"]]
|
||||||
|
collision_layer = 11
|
||||||
|
collision_mask = 32
|
||||||
|
|
||||||
|
[node name="GroundedShape" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 0.5, -5 )
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="AirborneShape" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 0.5, -7.5 )
|
||||||
|
shape = SubResource( 16 )
|
||||||
|
|
||||||
|
[node name="LadderDetector" type="RayCast2D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2( 0.5, 0 )
|
||||||
|
enabled = true
|
||||||
|
cast_to = Vector2( 0, -10 )
|
||||||
|
collision_mask = 64
|
||||||
|
collide_with_areas = true
|
||||||
|
collide_with_bodies = false
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
anims/RESET = SubResource( 5 )
|
||||||
|
anims/climb = SubResource( 9 )
|
||||||
|
anims/double_jump = SubResource( 12 )
|
||||||
|
anims/fall = SubResource( 15 )
|
||||||
|
anims/fall_scared = SubResource( 14 )
|
||||||
|
anims/idle = SubResource( 6 )
|
||||||
|
anims/jump = SubResource( 8 )
|
||||||
|
anims/shoot_airborne = SubResource( 11 )
|
||||||
|
anims/shoot_grounded = SubResource( 10 )
|
||||||
|
anims/walk = SubResource( 7 )
|
||||||
|
|
||||||
|
[node name="StateChart" type="Node" parent="."]
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
auto_initialize = false
|
||||||
|
|
||||||
|
[node name="Root" type="Node" parent="StateChart"]
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Movement" type="Node" parent="StateChart/Root"]
|
||||||
|
process_priority = 10
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "higher process priority so it can do move_and_slide after everything else"
|
||||||
|
}
|
||||||
|
initial_state = NodePath("Grounded")
|
||||||
|
|
||||||
|
[node name="On Died" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../Inactive")
|
||||||
|
event = "died"
|
||||||
|
|
||||||
|
[node name="Grounded" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "is on the ground"
|
||||||
|
}
|
||||||
|
initial_state = NodePath("CanWalk")
|
||||||
|
|
||||||
|
[node name="On Airborne" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Airborne/Falling/CoyoteFalling")
|
||||||
|
event = "airborne"
|
||||||
|
|
||||||
|
[node name="On Jump" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "enter jump state when the jump button is pressed"
|
||||||
|
}
|
||||||
|
to = NodePath("../../Airborne/Jump/NormalJump")
|
||||||
|
event = "jump"
|
||||||
|
|
||||||
|
[node name="On LadderTouched" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Climbing")
|
||||||
|
event = "ladder_touched"
|
||||||
|
|
||||||
|
[node name="CanWalk" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "can walk by moving left and right"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="On Shoot" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Shooting")
|
||||||
|
event = "shoot"
|
||||||
|
guard_expression = "can_shoot"
|
||||||
|
|
||||||
|
[node name="Shooting" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
consumed_events = [ "jump" ]
|
||||||
|
|
||||||
|
[node name="On ShootEnd" type="Node" parent="StateChart/Root/Movement/Grounded/Shooting"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../CanWalk")
|
||||||
|
event = "shoot_end"
|
||||||
|
|
||||||
|
[node name="Pushing" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Airborne" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
process_priority = 5
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "SG is in the air and falling DOWN, better think fast!"
|
||||||
|
}
|
||||||
|
initial_state = NodePath("Falling")
|
||||||
|
|
||||||
|
[node name="On Grounded" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Grounded")
|
||||||
|
event = "grounded"
|
||||||
|
|
||||||
|
[node name="On Shoot" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../AirShooting")
|
||||||
|
event = "shoot"
|
||||||
|
guard_expression = "can_shoot"
|
||||||
|
|
||||||
|
[node name="On LadderTouched" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Climbing")
|
||||||
|
event = "ladder_touched"
|
||||||
|
|
||||||
|
[node name="Jump" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
initial_state = NodePath("NormalJump")
|
||||||
|
|
||||||
|
[node name="On Jump" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "enter double jump state when the jump button is pressed"
|
||||||
|
}
|
||||||
|
to = NodePath("../../DoubleJump")
|
||||||
|
event = "jump"
|
||||||
|
|
||||||
|
[node name="On JumpPeak" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Falling/NormalFalling")
|
||||||
|
event = "jump_peak"
|
||||||
|
|
||||||
|
[node name="NormalJump" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="On JumpReleased" type="Node" parent="StateChart/Root/Movement/Airborne/Jump/NormalJump"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
to = NodePath("../../../Falling/NormalFalling")
|
||||||
|
event = "jump_released"
|
||||||
|
|
||||||
|
[node name="LadderJump" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Falling" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
initial_state = NodePath("NormalFalling")
|
||||||
|
|
||||||
|
[node name="On Jump" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "enter double jump state when the jump button is pressed"
|
||||||
|
}
|
||||||
|
to = NodePath("../../DoubleJump")
|
||||||
|
event = "jump"
|
||||||
|
|
||||||
|
[node name="CoyoteFalling" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="On Jump" type="Node" parent="StateChart/Root/Movement/Airborne/Falling/CoyoteFalling"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "enter jump state when the jump button is pressed"
|
||||||
|
}
|
||||||
|
to = NodePath("../../../Jump/NormalJump")
|
||||||
|
event = "jump"
|
||||||
|
|
||||||
|
[node name="On CoyoteTimeout" type="Node" parent="StateChart/Root/Movement/Airborne/Falling/CoyoteFalling"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../ScaredFalling")
|
||||||
|
delay = 0.067
|
||||||
|
|
||||||
|
[node name="NormalFalling" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="ScaredFalling" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="DoubleJump" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="AirShooting" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Climbing" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "stuck to ladder"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="On Jump" type="Node" parent="StateChart/Root/Movement/Climbing"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Airborne/Jump/LadderJump")
|
||||||
|
event = "jump"
|
||||||
|
|
||||||
|
[node name="On LadderDetach" type="Node" parent="StateChart/Root/Movement/Climbing"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Airborne/Falling/NormalFalling")
|
||||||
|
event = "ladder_detach"
|
||||||
|
|
||||||
|
[node name="Inactive" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "player can not move or do anything, immobile"
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="On Respawn" type="Node" parent="StateChart/Root/Movement/Inactive"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Grounded")
|
||||||
|
event = "get_real"
|
||||||
|
|
||||||
|
[node name="Health" type="Node" parent="StateChart/Root"]
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
initial_state = NodePath("Vulnerable")
|
||||||
|
|
||||||
|
[node name="Vulnerable" type="Node" parent="StateChart/Root/Health"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="On Hurt" type="Node" parent="StateChart/Root/Health/Vulnerable"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Dead")
|
||||||
|
event = "hurt"
|
||||||
|
|
||||||
|
[node name="Invulnerable" type="Node" parent="StateChart/Root/Health"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Respawn" type="Node" parent="StateChart/Root/Health"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="On Timeout" type="Node" parent="StateChart/Root/Health/Respawn"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Vulnerable")
|
||||||
|
|
||||||
|
[node name="Dead" type="Node" parent="StateChart/Root/Health"]
|
||||||
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="On Respawn" type="Node" parent="StateChart/Root/Health/Dead"]
|
||||||
|
script = ExtResource( 10 )
|
||||||
|
to = NodePath("../../Respawn")
|
||||||
|
event = "respawn"
|
||||||
|
guard_expression = "can_respawn"
|
||||||
|
|
||||||
|
[node name="StateDebugLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = 128
|
||||||
|
|
||||||
|
[node name="StateChartDebug" type="Tree" parent="StateDebugLayer"]
|
||||||
|
visible = false
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
margin_left = -147.0
|
||||||
|
margin_bottom = 137.0
|
||||||
|
theme = ExtResource( 7 )
|
||||||
|
custom_styles/bg = SubResource( 4 )
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/Shooting" to="." method="_on_Shooting_state_entered"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"]
|
||||||
|
[connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Falling/CoyoteFalling" to="." method="_on_CoyoteFalling_state_entered"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Falling/NormalFalling" to="." method="_on_NormalFalling_state_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Falling/NormalFalling" to="." method="_process_horizontal_movement"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Falling/ScaredFalling" to="." method="_on_ScaredFalling_state_entered"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/DoubleJump" to="." method="_on_DoubleJump_state_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/DoubleJump" to="." method="_process_horizontal_movement"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/AirShooting" to="." method="_on_AirShooting_state_entered"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/AirShooting" to="." method="_process_horizontal_movement"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Movement/Climbing" to="." method="_on_Climbing_state_entered"]
|
||||||
|
[connection signal="state_exited" from="StateChart/Root/Movement/Climbing" to="." method="_on_Climbing_state_exited"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Climbing" to="." method="_process_climbing"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Health/Respawn" to="." method="_on_Respawn_state_entered"]
|
||||||
|
[connection signal="state_entered" from="StateChart/Root/Health/Dead" to="." method="_on_Dead_state_entered"]
|
|
@ -4,7 +4,7 @@ export var match_h = false
|
||||||
export var match_v = true
|
export var match_v = true
|
||||||
|
|
||||||
func _on_RespawnPoint_area_entered(area):
|
func _on_RespawnPoint_area_entered(area):
|
||||||
if area.is_in_group("player"):
|
if area.is_in_group("player_hitbox"):
|
||||||
if Game.get_sector(global_position) != Game.get_sector(Game.respawn_point):
|
if Game.get_sector(global_position) != Game.get_sector(Game.respawn_point):
|
||||||
var player = area.get_parent()
|
var player = area.get_parent()
|
||||||
Game.respawn_point = Vector2(
|
Game.respawn_point = Vector2(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue