Compare commits
11 commits
37127c2257
...
5e46d72790
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e46d72790 | |||
| 0c62d0c0ed | |||
| 5e429d6635 | |||
| d11f7e2362 | |||
| 65dc3e6667 | |||
| 817398aafe | |||
| cf7eb89c9c | |||
| 4c27c688a1 | |||
| 5d3baf89a2 | |||
| c9d89ccd7d | |||
| 9418c8229c |
18 changed files with 25845 additions and 1 deletions
BIN
assets/yuki.png
Normal file
BIN
assets/yuki.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
40
assets/yuki.png.import
Normal file
40
assets/yuki.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cl3pdverm8pok"
|
||||
path="res://.godot/imported/yuki.png-a3dab686a5ef1655b0f6b4655317889c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/yuki.png"
|
||||
dest_files=["res://.godot/imported/yuki.png-a3dab686a5ef1655b0f6b4655317889c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
58
classes/state/state.gd
Normal file
58
classes/state/state.gd
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
## Virtual base class for all states.
|
||||
## Extend this class and override its methods to implement a state.
|
||||
@abstract class_name State extends Node
|
||||
|
||||
## Emitted when the state finishes and wants to transition to another state.
|
||||
@warning_ignore("unused_signal")
|
||||
signal finished(next_state_path: String, data: Dictionary)
|
||||
|
||||
|
||||
## For 'ghost frame' update fix
|
||||
var is_active: bool = false:
|
||||
set(value):
|
||||
is_active = value
|
||||
get:
|
||||
return is_active
|
||||
|
||||
|
||||
## Called by the state machine when receiving unhandled input events.
|
||||
@abstract func _handle_input(event: InputEvent) -> void
|
||||
|
||||
## Called by the state machine on the engine's main loop tick.
|
||||
@abstract func _state_update(delta: float) -> void
|
||||
|
||||
## Called by the state machine on the engine's physics update tick.
|
||||
@abstract func _state_physics_update(delta: float) -> void
|
||||
|
||||
## Called by the state machine upon changing the active state. The `data` parameter
|
||||
## is a dictionary with arbitrary data the state can use to initialize itself.
|
||||
@abstract func _enter(previous_state_path: String, data: Dictionary = {}) -> void
|
||||
|
||||
## Called by the state machine before changing the active state. Use this function
|
||||
## to clean up the state.
|
||||
@abstract func _exit() -> void
|
||||
|
||||
|
||||
func handle_input(event: InputEvent) -> void:
|
||||
if not is_active: return
|
||||
_handle_input(event)
|
||||
|
||||
|
||||
func state_update(delta: float) -> void:
|
||||
if not is_active: return
|
||||
_state_update(delta)
|
||||
|
||||
|
||||
func state_physics_update(delta: float) -> void:
|
||||
if not is_active: return
|
||||
_state_physics_update(delta)
|
||||
|
||||
|
||||
func enter(previous_state_path: String, data: Dictionary = {}) -> void:
|
||||
is_active = true
|
||||
_enter(previous_state_path, data)
|
||||
|
||||
|
||||
func exit() -> void:
|
||||
is_active = false
|
||||
_exit()
|
||||
1
classes/state/state.gd.uid
Normal file
1
classes/state/state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c204s7yw0rmoa
|
||||
57
classes/state_machine/state_machine.gd
Normal file
57
classes/state_machine/state_machine.gd
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
## Virtual base class for all nodes that deal directly with states.
|
||||
## Extend this class and override its methods to implement a state machine.
|
||||
class_name StateMachine extends Node
|
||||
|
||||
|
||||
## The initial state of the state machine. If not set, the first child node is used.
|
||||
@export var initial_state: State
|
||||
|
||||
## The state machine's current loaded state
|
||||
@onready var state: State = _get_initial_state()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
assert(state != null, "initial state is null")
|
||||
for state_node: State in find_children("*", "State"):
|
||||
# fixes duplicate connections (not sure why)
|
||||
if not state_node.finished.is_connected(_transition_to_next_state):
|
||||
state_node.finished.connect(_transition_to_next_state)
|
||||
await owner.ready
|
||||
state.enter("")
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
state.handle_input(event)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
state.state_update(delta)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
state.state_physics_update(delta)
|
||||
|
||||
|
||||
## Called when initial state is not specified.
|
||||
## Returns the first child node by default.
|
||||
## Override if necessary, but don't call it directly.
|
||||
func _get_initial_state() -> State:
|
||||
return initial_state if initial_state != null else get_child(0)
|
||||
|
||||
|
||||
## Transitions the active state out after receiving a finished signal.
|
||||
func _transition_to_next_state(target_state_path: String, data: Dictionary[StringName, Variant] = {}) -> void:
|
||||
print("+++ TRANSITION CALLED: ", target_state_path)
|
||||
print("+++ has node? ", has_node(target_state_path))
|
||||
print("+++ all children: ", get_children().map(func(c: Node) -> StringName: return c.name))
|
||||
|
||||
assert(has_node(target_state_path), owner.name + ": Trying to transition to state " + target_state_path + " but it does not exist.")
|
||||
|
||||
if not has_node(target_state_path):
|
||||
printerr(owner.name + ": Trying to transition to state " + target_state_path + " but it does not exist.")
|
||||
return
|
||||
|
||||
var previous_state_path: StringName = state.name
|
||||
state.exit()
|
||||
state = get_node(target_state_path)
|
||||
state.enter(previous_state_path, data)
|
||||
1
classes/state_machine/state_machine.gd.uid
Normal file
1
classes/state_machine/state_machine.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://diths5s8vd7lr
|
||||
7
default_env.tres
Normal file
7
default_env.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="Sky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
|
|
@ -10,16 +10,79 @@ config_version=5
|
|||
|
||||
[application]
|
||||
|
||||
config/name="yumeyuki"
|
||||
config/name="girl will never sing again"
|
||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[debug]
|
||||
|
||||
gdscript/warnings/untyped_declaration=2
|
||||
gdscript/warnings/unsafe_property_access=2
|
||||
gdscript/warnings/unsafe_method_access=2
|
||||
gdscript/warnings/unsafe_cast=1
|
||||
gdscript/warnings/unsafe_call_argument=2
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=320
|
||||
window/size/viewport_height=240
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
[editor]
|
||||
|
||||
version_control/plugin_name="GitPlugin"
|
||||
version_control/autoload_on_startup=true
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PackedStringArray("res://addons/AsepriteWizard/plugin.cfg", "res://addons/ridiculous_coding/plugin.cfg")
|
||||
|
||||
[input]
|
||||
|
||||
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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
, 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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
, 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)
|
||||
]
|
||||
}
|
||||
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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
, 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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
, 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)
|
||||
]
|
||||
}
|
||||
interact={
|
||||
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, 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)
|
||||
]
|
||||
}
|
||||
pause={
|
||||
"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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="player"
|
||||
2d_physics/layer_2="walls"
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
|
|
|
|||
BIN
readme-example.gif
Normal file
BIN
readme-example.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5 MiB |
BIN
ridiculous.png
Normal file
BIN
ridiculous.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 MiB |
40
ridiculous.png.import
Normal file
40
ridiculous.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4l26243kuxr"
|
||||
path="res://.godot/imported/ridiculous.png-a64a78ecb1ff54430110261923f7dd4f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ridiculous.png"
|
||||
dest_files=["res://.godot/imported/ridiculous.png-a64a78ecb1ff54430110261923f7dd4f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
25481
ridiculous.svg
Normal file
25481
ridiculous.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 3.4 MiB |
43
ridiculous.svg.import
Normal file
43
ridiculous.svg.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://drvdsuliqetsx"
|
||||
path="res://.godot/imported/ridiculous.svg-e21db04d9320e3effae5aa7f8ec5a426.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ridiculous.svg"
|
||||
dest_files=["res://.godot/imported/ridiculous.svg-e21db04d9320e3effae5aa7f8ec5a426.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
BIN
scenes/player/assets/yukotsuki.aseprite
Normal file
BIN
scenes/player/assets/yukotsuki.aseprite
Normal file
Binary file not shown.
21
scenes/player/assets/yukotsuki.aseprite.import
Normal file
21
scenes/player/assets/yukotsuki.aseprite.import
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="aseprite_wizard.plugin.spriteframes"
|
||||
type="SpriteFrames"
|
||||
uid="uid://6v5nyv2wo47g"
|
||||
path="res://.godot/imported/yukotsuki.aseprite-2775b59c70c8f83084c0d1500320409d.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/player/assets/yukotsuki.aseprite"
|
||||
dest_files=["res://.godot/imported/yukotsuki.aseprite-2775b59c70c8f83084c0d1500320409d.res"]
|
||||
|
||||
[params]
|
||||
|
||||
layer/exclude_layers_pattern=""
|
||||
layer/only_visible_layers=false
|
||||
sheet/sheet_type="packed"
|
||||
sheet/sheet_columns=12
|
||||
sheet/frame_padding=0
|
||||
sheet/scale=1
|
||||
animation/round_fps=true
|
||||
10
scenes/player/player.gd
Normal file
10
scenes/player/player.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class_name Player extends CharacterBody2D
|
||||
|
||||
|
||||
@export var max_speed: float = 300.0
|
||||
|
||||
|
||||
func get_movement_vector() -> Vector2:
|
||||
var x_mov: float = Input.get_action_strength('move_right') - Input.get_action_strength('move_left')
|
||||
var y_mov: float = Input.get_action_strength('move_down') - Input.get_action_strength('move_up')
|
||||
return Vector2(x_mov, y_mov)
|
||||
1
scenes/player/player.gd.uid
Normal file
1
scenes/player/player.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dpsocqnk0e6le
|
||||
21
scenes/player/player.tscn
Normal file
21
scenes/player/player.tscn
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cqm5besqgsb7x"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dpsocqnk0e6le" path="res://scenes/player/player.gd" id="1_dovo2"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://6v5nyv2wo47g" path="res://scenes/player/assets/yukotsuki.aseprite" id="2_dovo2"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_gmlin"]
|
||||
radius = 6.0
|
||||
height = 14.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_dovo2")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -16)
|
||||
sprite_frames = ExtResource("2_dovo2")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
shape = SubResource("CapsuleShape2D_gmlin")
|
||||
debug_color = Color(0.28459275, 0.61933166, 0.3529686, 0.41960785)
|
||||
Loading…
Add table
Reference in a new issue