Compare commits
No commits in common. "20f35ab2404f40a72790ecf7cc162136e8af934b" and "031e107f83d5aea1ebc7d1bc2373ebbc27f45707" have entirely different histories.
20f35ab240
...
031e107f83
15 changed files with 196 additions and 356 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 1 KiB |
Binary file not shown.
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_p8vut"]
|
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_p8vut"]
|
||||||
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_hpwyk"]
|
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_hpwyk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="3_edpy5"]
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="3_edpy5"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_onc0l"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_onc0l"]
|
||||||
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_s8gph"]
|
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_s8gph"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_8fhro"]
|
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_8fhro"]
|
||||||
|
@ -85,4 +85,4 @@ scale = Vector2(1.09184, 27.4543)
|
||||||
position = Vector2(96, 176)
|
position = Vector2(96, 176)
|
||||||
|
|
||||||
[node name="Spring2" parent="." instance=ExtResource("9_dtd3x")]
|
[node name="Spring2" parent="." instance=ExtResource("9_dtd3x")]
|
||||||
position = Vector2(96, 88)
|
position = Vector2(80, 88)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_bxdo5"]
|
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_bxdo5"]
|
||||||
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="1_j2mm6"]
|
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="1_j2mm6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="2_kip56"]
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="2_kip56"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="3_4td23"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="3_4td23"]
|
||||||
[ext_resource type="PackedScene" uid="uid://68lav5rke5ag" path="res://objects/spring/spring.tscn" id="4_a3xei"]
|
[ext_resource type="PackedScene" uid="uid://68lav5rke5ag" path="res://objects/spring/spring.tscn" id="4_a3xei"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b5eso40mjhlmv" path="res://objects/ice/ice.tscn" id="5_88a5a"]
|
[ext_resource type="PackedScene" uid="uid://b5eso40mjhlmv" path="res://objects/ice/ice.tscn" id="5_88a5a"]
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://b6a7l24y30iht" path="res://assets/textures/backgrounds/chocomint.png" id="1_h5jcm"]
|
[ext_resource type="Texture2D" uid="uid://b6a7l24y30iht" path="res://assets/textures/backgrounds/chocomint.png" id="1_h5jcm"]
|
||||||
[ext_resource type="Script" uid="uid://d3v13a4er2h1x" path="res://scripts/level/level.gd" id="1_hcs1r"]
|
[ext_resource type="Script" uid="uid://d3v13a4er2h1x" path="res://scripts/level/level.gd" id="1_hcs1r"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="2_dj7w1"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="2_dj7w1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="3_kyrxg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c8r040r4glui4" path="res://objects/enemies/lashy/lashy.tscn" id="4_gykx6"]
|
[ext_resource type="PackedScene" uid="uid://c8r040r4glui4" path="res://objects/enemies/lashy/lashy.tscn" id="4_gykx6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="5_5v7mr"]
|
|
||||||
|
|
||||||
[node name="LevelZ" type="Node2D"]
|
[node name="LevelZ" type="Node2D"]
|
||||||
script = ExtResource("1_hcs1r")
|
script = ExtResource("1_hcs1r")
|
||||||
|
@ -22,8 +22,8 @@ use_parent_material = true
|
||||||
tile_map_data = PackedByteArray("AAAAAAsAAAAAAAAAAAABAAsAAAAAAAAAAAACAAsAAAAAAAAAAAAHAAsAAAAAAAAAAAAIAAsAAAAAAAAAAAAJAAsAAAAAAAAAAAAKAAsAAAAAAAAAAAALAAsAAAAAAAAAAAANAAsAAAAAAAAAAAAOAAsAAAAAAAAAAAAPAAsAAAAAAAAAAAAQAAsAAAAAAAAAAAARAAsAAAAAAAAAAAADAAsAAAAAAAAAAAAEAAsAAAAAAAAAAAAFAAsAAAAAAAAAAAAGAAsAAAAAAAAAAAAMAAsAAAAAAAAAAAAFAAoAAAAAAAAAAAAGAAoAAAAAAAAAAAAGAAkAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAALAAoAAAAAAAAAAAAKAAoAAAAAAAAAAAAJAAoAAAAAAAAAAAAIAAoAAAAAAAAAAAAHAAoAAAAAAAAAAAAMAAoAAAAAAAAAAAANAAoAAAAAAAAAAAAOAAoAAAAAAAAAAAAPAAoAAAAAAAAAAAAPAAkAAAAAAAAAAAAQAAkAAAAAAAAAAAAQAAgAAAAAAAAAAAAQAAcAAAAAAAAAAAAQAAYAAAAAAAAAAAARAAcAAAAAAAAAAAAQAAoAAAAAAAAAAAARAAkAAAAAAAAAAAARAAgAAAAAAAAAAAARAAoAAAAAAAAAAAARAAYAAAAAAAAAAAARAAUAAAAAAAAAAAARAAQAAAAAAAAAAAAQAAQAAAAAAAAAAAAQAAUAAAAAAAAAAAAFAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAADAAkAAAAAAAAAAAACAAkAAAAAAAAAAAABAAkAAAAAAAAAAAABAAoAAAAAAAAAAAACAAoAAAAAAAAAAAADAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAkAAAAAAAAAAAA=")
|
tile_map_data = PackedByteArray("AAAAAAsAAAAAAAAAAAABAAsAAAAAAAAAAAACAAsAAAAAAAAAAAAHAAsAAAAAAAAAAAAIAAsAAAAAAAAAAAAJAAsAAAAAAAAAAAAKAAsAAAAAAAAAAAALAAsAAAAAAAAAAAANAAsAAAAAAAAAAAAOAAsAAAAAAAAAAAAPAAsAAAAAAAAAAAAQAAsAAAAAAAAAAAARAAsAAAAAAAAAAAADAAsAAAAAAAAAAAAEAAsAAAAAAAAAAAAFAAsAAAAAAAAAAAAGAAsAAAAAAAAAAAAMAAsAAAAAAAAAAAAFAAoAAAAAAAAAAAAGAAoAAAAAAAAAAAAGAAkAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAALAAoAAAAAAAAAAAAKAAoAAAAAAAAAAAAJAAoAAAAAAAAAAAAIAAoAAAAAAAAAAAAHAAoAAAAAAAAAAAAMAAoAAAAAAAAAAAANAAoAAAAAAAAAAAAOAAoAAAAAAAAAAAAPAAoAAAAAAAAAAAAPAAkAAAAAAAAAAAAQAAkAAAAAAAAAAAAQAAgAAAAAAAAAAAAQAAcAAAAAAAAAAAAQAAYAAAAAAAAAAAARAAcAAAAAAAAAAAAQAAoAAAAAAAAAAAARAAkAAAAAAAAAAAARAAgAAAAAAAAAAAARAAoAAAAAAAAAAAARAAYAAAAAAAAAAAARAAUAAAAAAAAAAAARAAQAAAAAAAAAAAAQAAQAAAAAAAAAAAAQAAUAAAAAAAAAAAAFAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAADAAkAAAAAAAAAAAACAAkAAAAAAAAAAAABAAkAAAAAAAAAAAABAAoAAAAAAAAAAAACAAoAAAAAAAAAAAADAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAkAAAAAAAAAAAA=")
|
||||||
tile_set = ExtResource("2_dj7w1")
|
tile_set = ExtResource("2_dj7w1")
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("3_kyrxg")]
|
||||||
|
position = Vector2(40, 124)
|
||||||
|
|
||||||
[node name="Lashy" parent="." instance=ExtResource("4_gykx6")]
|
[node name="Lashy" parent="." instance=ExtResource("4_gykx6")]
|
||||||
position = Vector2(141, 99)
|
position = Vector2(141, 99)
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("5_5v7mr")]
|
|
||||||
position = Vector2(40, 144)
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_5dne7"]
|
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_5dne7"]
|
||||||
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_els7d"]
|
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_els7d"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="3_imjpd"]
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="3_imjpd"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_1rmvv"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_1rmvv"]
|
||||||
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_ae2vf"]
|
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_ae2vf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_yywag"]
|
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_yywag"]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_6i0lb"]
|
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_6i0lb"]
|
||||||
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_3dp43"]
|
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_3dp43"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="3_mts2t"]
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="3_mts2t"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_evy0b"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_evy0b"]
|
||||||
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_eo1kb"]
|
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_eo1kb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_vvcgd"]
|
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_vvcgd"]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_588ks"]
|
[ext_resource type="Texture2D" uid="uid://d13tqqx8ygak4" path="res://assets/textures/backgrounds/hell.png" id="1_588ks"]
|
||||||
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_rvhjv"]
|
[ext_resource type="Shader" uid="uid://cwktxks6mchp2" path="res://assets/shaders/noise.gdshader" id="2_rvhjv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwtpsjpe2lf7l" path="res://objects/player/player.tscn" id="3_pdn7u"]
|
[ext_resource type="PackedScene" uid="uid://mh2gfm7iqqsm" path="res://objects/player/player.tscn" id="3_pdn7u"]
|
||||||
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_pcxb3"]
|
[ext_resource type="TileSet" uid="uid://xwfn24if3pxk" path="res://assets/tilesets/chocomint.tres" id="4_pcxb3"]
|
||||||
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_bpruh"]
|
[ext_resource type="FontFile" uid="uid://dets0g4ce7npf" path="res://assets/fonts/Super Mario Bros. NES.ttf" id="5_bpruh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_uyuca"]
|
[ext_resource type="PackedScene" uid="uid://bhnse651bcybm" path="res://objects/end_door/end_door.tscn" id="6_uyuca"]
|
||||||
|
|
|
@ -2,102 +2,70 @@ class_name Player
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
@export_group("Ground Movement")
|
|
||||||
@export var run_acceleration: float
|
|
||||||
@export var max_run_speed: float
|
|
||||||
@export var turn_acceleration: float
|
|
||||||
@export var stopping_force: float
|
|
||||||
|
|
||||||
@export_group("Air Movement")
|
|
||||||
@export var gravity: float
|
@export var gravity: float
|
||||||
@export var jump_power: float
|
@export var run_speed: float
|
||||||
|
@export var jump_force: float
|
||||||
|
|
||||||
@export_group("Internal References")
|
@export_group("Node References")
|
||||||
@export var state_chart: StateChart
|
@export var state_chart: StateChart
|
||||||
@export var graphics: Node2D
|
@export var graphics: Node2D
|
||||||
@export var run_animation: SpritesheetAnimation
|
|
||||||
|
|
||||||
|
@onready var start_position = position
|
||||||
|
@onready var voice = %Voice
|
||||||
|
|
||||||
@onready var start_position: Vector2 = global_position
|
var ices_touched:int = 0:
|
||||||
|
|
||||||
|
|
||||||
var input_dir: Vector2 = Vector2.ZERO:
|
|
||||||
set(value):
|
set(value):
|
||||||
input_dir = value.sign()
|
ices_touched = value
|
||||||
state_chart.set_expression_property(&"input_dir", input_dir)
|
if ices_touched <= 0:
|
||||||
|
ices_touched = 0
|
||||||
|
state_chart.send_event(&"ground_touched")
|
||||||
func _physics_process(delta: float) -> void:
|
else:
|
||||||
move_and_slide()
|
state_chart.send_event(&"ice_touched")
|
||||||
state_chart.set_expression_property(&"velocity", velocity)
|
|
||||||
if velocity.x != 0.0:
|
|
||||||
graphics.scale.x = signf(velocity.x)
|
|
||||||
|
|
||||||
state_chart.set_expression_property(&"on_floor", is_on_floor())
|
|
||||||
|
|
||||||
input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down")
|
|
||||||
|
|
||||||
state_chart.send_event(&"tick")
|
|
||||||
|
|
||||||
|
#region Notifications
|
||||||
|
func _ready() -> void:
|
||||||
|
state_chart.set_expression_property(&"player", self)
|
||||||
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed(&"jump"):
|
if event.is_action_pressed(&"ui_accept"):
|
||||||
state_chart.send_event(&"jump_pressed")
|
state_chart.send_event(&"jump_pressed")
|
||||||
|
|
||||||
|
|
||||||
func kill() -> void:
|
func _process(delta: float) -> void:
|
||||||
state_chart.send_event(&"killed")
|
if is_on_floor():
|
||||||
|
graphics.rotation = get_floor_angle()
|
||||||
|
else:
|
||||||
|
graphics.rotation = 0.0
|
||||||
|
|
||||||
|
|
||||||
func launch(impulse: Vector2) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
velocity = impulse
|
state_chart.set_expression_property(&"on_floor", is_on_floor())
|
||||||
state_chart.send_event(&"launched")
|
|
||||||
|
var h_input = Input.get_axis(&"ui_left", &"ui_right")
|
||||||
|
state_chart.set_expression_property(&"horizontal_input", h_input != 0.0)
|
||||||
#region Idle
|
|
||||||
func _slow_to_stop(delta: float) -> void:
|
move_and_slide()
|
||||||
velocity.x = move_toward(velocity.x, 0.0, stopping_force * delta)
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Running
|
|
||||||
func _apply_run_acceleration(delta: float) -> void:
|
|
||||||
if absf(velocity.x) < max_run_speed:
|
|
||||||
velocity.x += input_dir.x * run_acceleration * delta
|
|
||||||
|
|
||||||
func _scale_run_animation(delta:float) -> void:
|
|
||||||
run_animation.speed_scale = inverse_lerp(0.0, max_run_speed, absf(velocity.x))
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Turning
|
#region State Processing
|
||||||
func _apply_turn_acceleration(delta: float) -> void:
|
func _process_run(delta: float) -> void:
|
||||||
velocity.x += input_dir.x * turn_acceleration * delta
|
var h_input = Input.get_axis(&"ui_left", &"ui_right")
|
||||||
#endregion
|
velocity.x = h_input * run_speed
|
||||||
|
graphics.scale.x = signf(h_input)
|
||||||
|
|
||||||
|
func _process_gravity(delta: float) -> void:
|
||||||
#region Falling
|
|
||||||
func _apply_gravity(delta: float) -> void:
|
|
||||||
velocity.y += gravity * delta
|
velocity.y += gravity * delta
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Jumping
|
#region State One-Shots
|
||||||
func _start_jump() -> void:
|
func _do_jump() -> void:
|
||||||
velocity.y = -jump_power
|
voice.stream = load("res://assets/audio/vox/capri_jump.ogg")
|
||||||
#endregion
|
voice.play()
|
||||||
|
velocity.y = -jump_force
|
||||||
|
position.y -= 1.0
|
||||||
|
|
||||||
|
func _stop_moving() -> void:
|
||||||
#region Missile
|
|
||||||
func _face_towards_velocity(_delta: float) -> void:
|
|
||||||
graphics.rotation = Vector2(graphics.scale.x, 0.0).angle_to(velocity)
|
|
||||||
|
|
||||||
func _restore_graphics_rotation() -> void:
|
|
||||||
graphics.rotation = 0.0
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Death
|
|
||||||
func _reset_position() -> void:
|
|
||||||
global_position = start_position
|
|
||||||
velocity = Vector2.ZERO
|
velocity = Vector2.ZERO
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
uid://dhyi4yn0xleoy
|
uid://b5qkdufeuihlh
|
||||||
|
|
|
@ -1,306 +1,207 @@
|
||||||
[gd_scene load_steps=21 format=3 uid="uid://bwtpsjpe2lf7l"]
|
[gd_scene load_steps=19 format=3 uid="uid://mh2gfm7iqqsm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dhyi4yn0xleoy" path="res://objects/player/player.gd" id="1_xs4s5"]
|
[ext_resource type="Script" uid="uid://b5qkdufeuihlh" path="res://objects/player/player.gd" id="1_jgave"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c71nqfyw4a3v4" path="res://assets/textures/player/capri.png" id="3_trcll"]
|
[ext_resource type="Shader" uid="uid://c3wn7vy5wqvyv" path="res://assets/shaders/clean_edge.gdshader" id="2_cpj48"]
|
||||||
[ext_resource type="Script" uid="uid://cv55s54clajw5" path="res://scripts/spritesheet_animation/spritesheet_animation.gd" id="4_bsdw5"]
|
[ext_resource type="Texture2D" uid="uid://c71nqfyw4a3v4" path="res://assets/textures/player/capri.png" id="3_27a2c"]
|
||||||
[ext_resource type="Script" uid="uid://bhrh1qkv7nlyl" path="res://addons/godot_state_charts/state_chart.gd" id="5_bcjtl"]
|
[ext_resource type="Script" uid="uid://cv55s54clajw5" path="res://scripts/spritesheet_animation/spritesheet_animation.gd" id="4_dldqk"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dfa1ev73rsc7g" path="res://assets/audio/vox/capri_die.ogg" id="5_bi5m7"]
|
[ext_resource type="Script" uid="uid://bhrh1qkv7nlyl" path="res://addons/godot_state_charts/state_chart.gd" id="5_yg0e1"]
|
||||||
[ext_resource type="Script" uid="uid://b11v7h3ny6kh1" path="res://addons/godot_state_charts/compound_state.gd" id="6_jnxnd"]
|
[ext_resource type="Script" uid="uid://b11v7h3ny6kh1" path="res://addons/godot_state_charts/compound_state.gd" id="6_nf3pt"]
|
||||||
[ext_resource type="Script" uid="uid://rrj3six8lu8p" path="res://addons/godot_state_charts/transition.gd" id="7_rgjdc"]
|
[ext_resource type="Script" uid="uid://cyvphy8py4ntr" path="res://addons/godot_state_charts/atomic_state.gd" id="7_56odx"]
|
||||||
[ext_resource type="Script" uid="uid://b6u7unac5srh0" path="res://addons/godot_state_charts/expression_guard.gd" id="8_8i2im"]
|
[ext_resource type="Script" uid="uid://rrj3six8lu8p" path="res://addons/godot_state_charts/transition.gd" id="8_pgje5"]
|
||||||
[ext_resource type="AudioStream" uid="uid://7be7ts3rdegh" path="res://assets/audio/vox/capri_jump.ogg" id="9_8c74o"]
|
[ext_resource type="Script" uid="uid://b6u7unac5srh0" path="res://addons/godot_state_charts/expression_guard.gd" id="9_ht8un"]
|
||||||
[ext_resource type="Script" uid="uid://cyvphy8py4ntr" path="res://addons/godot_state_charts/atomic_state.gd" id="10_mvu25"]
|
[ext_resource type="Script" uid="uid://rgqnolsaywgc" path="res://addons/godot_state_charts/not_guard.gd" id="10_jkoqe"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_tvyy1"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_tvyy1"]
|
||||||
radius = 6.0
|
radius = 6.0208
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_sfpnl"]
|
[sub_resource type="SeparationRayShape2D" id="SeparationRayShape2D_57odn"]
|
||||||
resource_name = "Not On Floor"
|
length = 2.0
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "not on_floor"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_mq184"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_12eq7"]
|
||||||
resource_name = "Horizontal Input"
|
shader = ExtResource("2_cpj48")
|
||||||
script = ExtResource("8_8i2im")
|
shader_parameter/highestColor = Vector3(1, 1, 1)
|
||||||
expression = "input_dir.x != 0.0"
|
shader_parameter/similarThreshold = 0.0
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
shader_parameter/lineWidth = 1.0
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_nye2q"]
|
[sub_resource type="Resource" id="Resource_g8pxc"]
|
||||||
resource_name = "Horizontal Movement"
|
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "velocity.x != 0.0"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_n665q"]
|
|
||||||
resource_name = "No Horizontal Movement"
|
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "velocity.x == 0.0"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_8c74o"]
|
|
||||||
resource_name = "No Horizontal Input"
|
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "input_dir.x == 0.0"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_xs4s5"]
|
|
||||||
resource_name = "Opposite Input"
|
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "input_dir.x != signf(velocity.x)"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_e1cbd"]
|
|
||||||
resource_name = "Aligned Input"
|
|
||||||
script = ExtResource("8_8i2im")
|
|
||||||
expression = "input_dir.x == signf(velocity.x)"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_163ft"]
|
|
||||||
resource_name = "On Floor"
|
resource_name = "On Floor"
|
||||||
script = ExtResource("8_8i2im")
|
script = ExtResource("9_ht8un")
|
||||||
expression = "on_floor"
|
expression = "on_floor"
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_whx0j"]
|
[sub_resource type="Resource" id="Resource_4mj4w"]
|
||||||
resource_name = "Falling Down"
|
script = ExtResource("10_jkoqe")
|
||||||
script = ExtResource("8_8i2im")
|
guard = SubResource("Resource_g8pxc")
|
||||||
expression = "velocity.y > 0.0"
|
|
||||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics", "run_animation")]
|
[sub_resource type="Resource" id="Resource_kdmd2"]
|
||||||
|
resource_name = "Horizontal Input"
|
||||||
|
script = ExtResource("9_ht8un")
|
||||||
|
expression = "horizontal_input"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_p43ft"]
|
||||||
|
script = ExtResource("10_jkoqe")
|
||||||
|
guard = SubResource("Resource_kdmd2")
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_g7rrk"]
|
||||||
|
resource_name = "Downward Velocity"
|
||||||
|
script = ExtResource("9_ht8un")
|
||||||
|
expression = "player.velocity.y >= 0.0"
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics")]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
floor_snap_length = 3.0
|
floor_snap_length = 3.0
|
||||||
script = ExtResource("1_xs4s5")
|
script = ExtResource("1_jgave")
|
||||||
run_acceleration = 200.0
|
|
||||||
max_run_speed = 100.0
|
|
||||||
turn_acceleration = 300.0
|
|
||||||
stopping_force = 200.0
|
|
||||||
gravity = 450.0
|
gravity = 450.0
|
||||||
jump_power = 180.0
|
run_speed = 100.0
|
||||||
|
jump_force = 180.0
|
||||||
state_chart = NodePath("StateChart")
|
state_chart = NodePath("StateChart")
|
||||||
graphics = NodePath("Graphics")
|
graphics = NodePath("Graphics")
|
||||||
run_animation = NodePath("Graphics/Sprite/Run")
|
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, -6)
|
position = Vector2(0, -6)
|
||||||
shape = SubResource("CircleShape2D_tvyy1")
|
shape = SubResource("CircleShape2D_tvyy1")
|
||||||
debug_color = Color(3.32102e-06, 0.648976, 0.161954, 0.42)
|
debug_color = Color(3.32102e-06, 0.648976, 0.161954, 0.42)
|
||||||
|
|
||||||
|
[node name="SeparationShapeRight" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(5, -2)
|
||||||
|
shape = SubResource("SeparationRayShape2D_57odn")
|
||||||
|
debug_color = Color(0.850748, 0.32846, 0.463602, 0.42)
|
||||||
|
|
||||||
[node name="Graphics" type="Node2D" parent="."]
|
[node name="Graphics" type="Node2D" parent="."]
|
||||||
position = Vector2(0, -6)
|
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="Graphics"]
|
[node name="Sprite" type="Sprite2D" parent="Graphics"]
|
||||||
texture = ExtResource("3_trcll")
|
material = SubResource("ShaderMaterial_12eq7")
|
||||||
offset = Vector2(0, -2)
|
texture = ExtResource("3_27a2c")
|
||||||
|
offset = Vector2(0, -8)
|
||||||
hframes = 4
|
hframes = 4
|
||||||
vframes = 4
|
vframes = 4
|
||||||
region_rect = Rect2(0, 0, 64, 64)
|
region_rect = Rect2(0, 0, 64, 64)
|
||||||
|
|
||||||
[node name="Idle" type="Node" parent="Graphics/Sprite"]
|
[node name="Idle" type="Node" parent="Graphics/Sprite"]
|
||||||
script = ExtResource("4_bsdw5")
|
script = ExtResource("4_dldqk")
|
||||||
|
|
||||||
[node name="Bark" type="Node" parent="Graphics/Sprite"]
|
[node name="Bark" type="Node" parent="Graphics/Sprite"]
|
||||||
script = ExtResource("4_bsdw5")
|
script = ExtResource("4_dldqk")
|
||||||
first_frame = Vector2i(1, 0)
|
first_frame = Vector2i(1, 0)
|
||||||
|
|
||||||
[node name="Skid" type="Node" parent="Graphics/Sprite"]
|
|
||||||
script = ExtResource("4_bsdw5")
|
|
||||||
first_frame = Vector2i(2, 0)
|
|
||||||
|
|
||||||
[node name="Run" type="Node" parent="Graphics/Sprite"]
|
[node name="Run" type="Node" parent="Graphics/Sprite"]
|
||||||
script = ExtResource("4_bsdw5")
|
script = ExtResource("4_dldqk")
|
||||||
first_frame = Vector2i(0, 1)
|
first_frame = Vector2i(0, 1)
|
||||||
frames = 4
|
frames = 3
|
||||||
fps = 16.0
|
fps = 8.0
|
||||||
loop = true
|
loop = true
|
||||||
|
|
||||||
[node name="Fall" type="Node" parent="Graphics/Sprite"]
|
|
||||||
script = ExtResource("4_bsdw5")
|
|
||||||
first_frame = Vector2i(0, 2)
|
|
||||||
|
|
||||||
[node name="Jump" type="Node" parent="Graphics/Sprite"]
|
[node name="Jump" type="Node" parent="Graphics/Sprite"]
|
||||||
script = ExtResource("4_bsdw5")
|
script = ExtResource("4_dldqk")
|
||||||
first_frame = Vector2i(1, 2)
|
first_frame = Vector2i(2, 0)
|
||||||
|
|
||||||
[node name="Missile" type="Node" parent="Graphics/Sprite"]
|
[node name="Fall" type="Node" parent="Graphics/Sprite"]
|
||||||
script = ExtResource("4_bsdw5")
|
script = ExtResource("4_dldqk")
|
||||||
first_frame = Vector2i(2, 2)
|
first_frame = Vector2i(3, 0)
|
||||||
|
|
||||||
[node name="Sounds" type="Node" parent="."]
|
|
||||||
|
|
||||||
[node name="Voice" type="AudioStreamPlayer" parent="Sounds"]
|
|
||||||
stream = ExtResource("9_8c74o")
|
|
||||||
bus = &"Capri"
|
|
||||||
|
|
||||||
[node name="Death" type="AudioStreamPlayer" parent="Sounds"]
|
|
||||||
stream = ExtResource("5_bi5m7")
|
|
||||||
bus = &"Capri"
|
|
||||||
|
|
||||||
[node name="StateChart" type="Node" parent="."]
|
[node name="StateChart" type="Node" parent="."]
|
||||||
script = ExtResource("5_bcjtl")
|
script = ExtResource("5_yg0e1")
|
||||||
track_in_editor = true
|
track_in_editor = true
|
||||||
initial_expression_properties = {
|
initial_expression_properties = {
|
||||||
&"input_dir": Vector2(0, 0),
|
"horizontal_input": false,
|
||||||
&"on_floor": false,
|
"on_floor": true,
|
||||||
&"velocity": Vector2(0, 0)
|
"player": null
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Root" type="Node" parent="StateChart"]
|
[node name="Root" type="Node" parent="StateChart"]
|
||||||
script = ExtResource("6_jnxnd")
|
script = ExtResource("6_nf3pt")
|
||||||
initial_state = NodePath("Grounded")
|
initial_state = NodePath("Grounded")
|
||||||
|
|
||||||
[node name="on Killed" type="Node" parent="StateChart/Root"]
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../Grounded")
|
|
||||||
event = &"killed"
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="on Launched" type="Node" parent="StateChart/Root"]
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../Airborne/Missile")
|
|
||||||
event = &"launched"
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="Grounded" type="Node" parent="StateChart/Root"]
|
[node name="Grounded" type="Node" parent="StateChart/Root"]
|
||||||
editor_description = "Player is standing on a floor."
|
script = ExtResource("6_nf3pt")
|
||||||
script = ExtResource("6_jnxnd")
|
|
||||||
initial_state = NodePath("Standing")
|
initial_state = NodePath("Standing")
|
||||||
|
|
||||||
[node name="on JumpPressed" type="Node" parent="StateChart/Root/Grounded"]
|
[node name="When Not On Floor" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
script = ExtResource("7_rgjdc")
|
script = ExtResource("8_pgje5")
|
||||||
|
to = NodePath("../../Airborne")
|
||||||
|
guard = SubResource("Resource_4mj4w")
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="On ice_touched" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
|
script = ExtResource("8_pgje5")
|
||||||
|
to = NodePath("../Sliding")
|
||||||
|
event = &"ice_touched"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="On jump_pressed" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
|
script = ExtResource("8_pgje5")
|
||||||
to = NodePath("../../Airborne/Jumping")
|
to = NodePath("../../Airborne/Jumping")
|
||||||
event = &"jump_pressed"
|
event = &"jump_pressed"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="if NotOnFloor" type="Node" parent="StateChart/Root/Grounded"]
|
|
||||||
editor_description = "Transition to falling state if not touching a floor."
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Airborne/Falling")
|
|
||||||
event = &"tick"
|
|
||||||
guard = SubResource("Resource_sfpnl")
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="Standing" type="Node" parent="StateChart/Root/Grounded"]
|
[node name="Standing" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
editor_description = "Player is standing still or coming to a stop."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("6_jnxnd")
|
|
||||||
initial_state = NodePath("Idle")
|
|
||||||
metadata/_custom_type_script = "uid://b11v7h3ny6kh1"
|
|
||||||
|
|
||||||
[node name="if WalkHeld" type="Node" parent="StateChart/Root/Grounded/Standing"]
|
[node name="If Horizontal Input" type="Node" parent="StateChart/Root/Grounded/Standing"]
|
||||||
editor_description = "Transition to running state if a horizontal direction is being held."
|
script = ExtResource("8_pgje5")
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Running")
|
to = NodePath("../../Running")
|
||||||
guard = SubResource("Resource_mq184")
|
guard = SubResource("Resource_kdmd2")
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Idle" type="Node" parent="StateChart/Root/Grounded/Standing"]
|
[node name="Sliding" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
editor_description = "Player is stopped, standing still."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("10_mvu25")
|
|
||||||
|
|
||||||
[node name="if Moving" type="Node" parent="StateChart/Root/Grounded/Standing/Idle"]
|
[node name="On ground_touched" type="Node" parent="StateChart/Root/Grounded/Sliding"]
|
||||||
editor_description = "Transition to stopping state if the player has horizontal velocity."
|
script = ExtResource("8_pgje5")
|
||||||
script = ExtResource("7_rgjdc")
|
to = NodePath("../../Standing")
|
||||||
to = NodePath("../../Stopping")
|
event = &"ground_touched"
|
||||||
guard = SubResource("Resource_nye2q")
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="Stopping" type="Node" parent="StateChart/Root/Grounded/Standing"]
|
|
||||||
editor_description = "Player is slowing to a stop naturally."
|
|
||||||
script = ExtResource("10_mvu25")
|
|
||||||
|
|
||||||
[node name="if Stopped" type="Node" parent="StateChart/Root/Grounded/Standing/Stopping"]
|
|
||||||
editor_description = "Transition to idle state when the player has come to a full stop."
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Idle")
|
|
||||||
guard = SubResource("Resource_n665q")
|
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Running" type="Node" parent="StateChart/Root/Grounded"]
|
[node name="Running" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
editor_description = "Player is accelerating in the held input direction."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("10_mvu25")
|
|
||||||
|
|
||||||
[node name="if WalkReleased" type="Node" parent="StateChart/Root/Grounded/Running"]
|
[node name="If No Horizontal Input" type="Node" parent="StateChart/Root/Grounded/Running"]
|
||||||
editor_description = "Transition to standing state if no input direction is held."
|
script = ExtResource("8_pgje5")
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Standing")
|
to = NodePath("../../Standing")
|
||||||
guard = SubResource("Resource_8c74o")
|
guard = SubResource("Resource_p43ft")
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="if OppositeInput" type="Node" parent="StateChart/Root/Grounded/Running"]
|
[node name="Barking" type="Node" parent="StateChart/Root/Grounded"]
|
||||||
editor_description = "Transition to turning state if the held input dir is opposite the horizontal velocity."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Turning")
|
|
||||||
guard = SubResource("Resource_xs4s5")
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="Turning" type="Node" parent="StateChart/Root/Grounded"]
|
[node name="On Timeout" type="Node" parent="StateChart/Root/Grounded/Barking"]
|
||||||
editor_description = "Player is more quickly accelerating in the held input direction to slow and turn around."
|
script = ExtResource("8_pgje5")
|
||||||
script = ExtResource("10_mvu25")
|
|
||||||
|
|
||||||
[node name="if WalkReleased" type="Node" parent="StateChart/Root/Grounded/Turning"]
|
|
||||||
editor_description = "Transition to standing state if no input direction is held."
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Standing")
|
to = NodePath("../../Standing")
|
||||||
guard = SubResource("Resource_8c74o")
|
delay_in_seconds = "0.5"
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="if AlignedInput" type="Node" parent="StateChart/Root/Grounded/Turning"]
|
|
||||||
editor_description = "Transition to running state when input direction matches horizontal velocity."
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Running")
|
|
||||||
guard = SubResource("Resource_e1cbd")
|
|
||||||
delay_in_seconds = "0.0"
|
|
||||||
|
|
||||||
[node name="Airborne" type="Node" parent="StateChart/Root"]
|
[node name="Airborne" type="Node" parent="StateChart/Root"]
|
||||||
editor_description = "Player is in the air."
|
script = ExtResource("6_nf3pt")
|
||||||
script = ExtResource("6_jnxnd")
|
|
||||||
initial_state = NodePath("Falling")
|
initial_state = NodePath("Falling")
|
||||||
|
|
||||||
[node name="if OnFloor" type="Node" parent="StateChart/Root/Airborne"]
|
[node name="Jumping" type="Node" parent="StateChart/Root/Airborne"]
|
||||||
editor_description = "Transition to grounded state if touching a floor."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Grounded")
|
[node name="When Jump Peaked" type="Node" parent="StateChart/Root/Airborne/Jumping"]
|
||||||
event = &"tick"
|
script = ExtResource("8_pgje5")
|
||||||
guard = SubResource("Resource_163ft")
|
to = NodePath("../../Falling")
|
||||||
|
guard = SubResource("Resource_g7rrk")
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Falling" type="Node" parent="StateChart/Root/Airborne"]
|
[node name="Falling" type="Node" parent="StateChart/Root/Airborne"]
|
||||||
editor_description = "Player is falling down."
|
script = ExtResource("7_56odx")
|
||||||
script = ExtResource("10_mvu25")
|
|
||||||
|
|
||||||
[node name="Jumping" type="Node" parent="StateChart/Root/Airborne"]
|
[node name="When On Floor" type="Node" parent="StateChart/Root/Airborne/Falling"]
|
||||||
editor_description = "Player has jumped and is rising."
|
script = ExtResource("8_pgje5")
|
||||||
script = ExtResource("10_mvu25")
|
to = NodePath("../../../Grounded")
|
||||||
|
guard = SubResource("Resource_g8pxc")
|
||||||
[node name="if DownVelocity" type="Node" parent="StateChart/Root/Airborne/Jumping"]
|
|
||||||
editor_description = "Transition to the falling state if moving downwards."
|
|
||||||
script = ExtResource("7_rgjdc")
|
|
||||||
to = NodePath("../../Falling")
|
|
||||||
guard = SubResource("Resource_whx0j")
|
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Missile" type="Node" parent="StateChart/Root/Airborne"]
|
[node name="Voice" type="AudioStreamPlayer" parent="."]
|
||||||
editor_description = "Player is hurtling through the air and ricocheting off of surfaces."
|
unique_name_in_owner = true
|
||||||
script = ExtResource("10_mvu25")
|
bus = &"Capri"
|
||||||
|
|
||||||
[connection signal="taken" from="StateChart/Root/on Killed" to="." method="_reset_position"]
|
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing" to="." method="_stop_moving"]
|
||||||
[connection signal="taken" from="StateChart/Root/on Killed" to="Sounds/Death" method="play"]
|
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing" to="Graphics/Sprite/Idle" method="play"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing/Idle" to="Graphics/Sprite/Idle" method="play"]
|
[connection signal="state_entered" from="StateChart/Root/Grounded/Sliding" to="Graphics/Sprite/Idle" method="play"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing/Stopping" to="Graphics/Sprite/Run" method="play"]
|
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Standing/Stopping" to="." method="_scale_run_animation"]
|
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Standing/Stopping" to="." method="_slow_to_stop"]
|
|
||||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Running" to="Graphics/Sprite/Run" method="play"]
|
[connection signal="state_entered" from="StateChart/Root/Grounded/Running" to="Graphics/Sprite/Run" method="play"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_scale_run_animation"]
|
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_process_run"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_apply_run_acceleration"]
|
[connection signal="state_entered" from="StateChart/Root/Grounded/Barking" to="Graphics/Sprite/Bark" method="play"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Turning" to="Graphics/Sprite/Skid" method="play"]
|
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_process_gravity"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Turning" to="." method="_apply_turn_acceleration"]
|
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="." method="_do_jump"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_apply_gravity"]
|
|
||||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Falling" to="Graphics/Sprite/Fall" method="play"]
|
|
||||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="." method="_start_jump"]
|
|
||||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="Graphics/Sprite/Jump" method="play"]
|
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="Graphics/Sprite/Jump" method="play"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="Sounds/Voice" method="play"]
|
[connection signal="state_entered" from="StateChart/Root/Airborne/Falling" to="Graphics/Sprite/Fall" method="play"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Missile" to="Graphics/Sprite/Missile" method="play"]
|
|
||||||
[connection signal="state_exited" from="StateChart/Root/Airborne/Missile" to="." method="_restore_graphics_rotation"]
|
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne/Missile" to="." method="_face_towards_velocity"]
|
|
||||||
|
|
|
@ -13,4 +13,6 @@ func _process(delta: float) -> void:
|
||||||
|
|
||||||
func _on_area_2d_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void:
|
func _on_area_2d_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void:
|
||||||
if body is Player:
|
if body is Player:
|
||||||
body.kill()
|
body.position = body.start_position
|
||||||
|
body.voice.stream = load("res://assets/audio/vox/capri_die.ogg")
|
||||||
|
body.voice.play()
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
@export var bounce_power = 240.0
|
@export var bounce_power = 240.0
|
||||||
@export var horizontal_boost = 20.0
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||||
if body is Player:
|
if body is Player:
|
||||||
var dir = Vector2(
|
if body.velocity.y == 0:
|
||||||
1.0 if body.velocity.x >= 0.0 else -1.0,
|
body.velocity.x = (body.jump_force * 1.5) * sign(-body.velocity.x)
|
||||||
-1.0 if body.velocity.y >= 0.0 else 1.0,
|
else:
|
||||||
)
|
body.velocity.y = (body.jump_force * 1.5) * sign(-body.velocity.y)
|
||||||
|
body.velocity.x += body.graphics.scale.x * 20.0
|
||||||
body.launch(Vector2(
|
|
||||||
body.velocity.x + (dir.x * horizontal_boost),
|
|
||||||
dir.y * bounce_power
|
|
||||||
))
|
|
||||||
|
|
||||||
#body.velocity.y = bounce_power * signf(-body.velocity.y)
|
|
||||||
#body.velocity.x += signf(body.velocity.x) * 20.0
|
|
||||||
##if body.velocity.y == 0:
|
|
||||||
##body.velocity.x = (body.jump_force * 1.5) * sign(-body.velocity.x)
|
|
||||||
##else:
|
|
||||||
##body.velocity.y = (body.jump_force * 1.5) * sign(-body.velocity.y)
|
|
||||||
##body.velocity.x += body.graphics.scale.x * 20.0
|
|
||||||
%AudioStreamPlayer.play()
|
%AudioStreamPlayer.play()
|
||||||
%AnimationPlayer.play("bounce")
|
%AnimationPlayer.play("bounce")
|
||||||
|
|
|
@ -55,7 +55,7 @@ hframes = 4
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
libraries = {
|
libraries = {
|
||||||
&"": SubResource("AnimationLibrary_2p5yk")
|
"": SubResource("AnimationLibrary_2p5yk")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
|
@ -11,7 +11,7 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Capri"
|
config/name="Capri"
|
||||||
run/main_scene="uid://byx8blpt2i8hx"
|
run/main_scene="res://maps/tutorial.tscn"
|
||||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ window/size/viewport_height=216
|
||||||
|
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/godot_state_charts/plugin.cfg")
|
enabled=PackedStringArray("res://addons/YouCanDoIt/plugin.cfg", "res://addons/godot_state_charts/plugin.cfg")
|
||||||
|
|
||||||
[file_customization]
|
[file_customization]
|
||||||
|
|
||||||
|
@ -44,34 +44,6 @@ folder_colors={
|
||||||
|
|
||||||
screen_overlay="Autoload that will be rendered over the game viewport at full resolution."
|
screen_overlay="Autoload that will be rendered over the game viewport at full resolution."
|
||||||
|
|
||||||
[input]
|
|
||||||
|
|
||||||
move_left={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_right={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_up={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_down={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
jump={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
2d_physics/layer_1="solid"
|
2d_physics/layer_1="solid"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue