initial commit

This commit is contained in:
2023-05-04 00:32:54 +02:00
commit 44b4d847e5
34 changed files with 3510 additions and 0 deletions

2
godot/.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
godot/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

BIN
godot/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

34
godot/icon.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1vqk21x7qa8t"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

12
godot/mhjnr.gdextension Normal file
View File

@@ -0,0 +1,12 @@
[configuration]
entry_symbol = "gdext_rust_init"
[libraries]
linux.debug.x86_64 = "res://../rust/target/debug/libmhjnr.so"
linux.release.x86_64 = "res://../rust/target/release/libmhjnr.so"
windows.debug.x86_64 = "res://../rust/target/debug/mhjnr.dll"
windows.release.x86_64 = "res://../rust/target/release/mhjnr.dll"
macos.debug = "res://../rust/target/debug/mhjnr.dylib"
macos.release = "res://../rust/target/release/mhjnr.dylib"
macos.debug.arm64 = "res://../rust/target/aarch64-apple-darwin/debug/mhjnr.dylib"
macos.release.arm64 = "res://../rust/target/aarch64-apple-darwin/release/mhjnr.dylib"

60
godot/mhjnr/Camera2D.gd Normal file
View File

@@ -0,0 +1,60 @@
extends CharacterBody2D
@export var max_jumps: int = 2
@export_range(0, 4000, 1, "suffix:px/s") var speed: float = 400
@export_range(0, 4000, 1, "suffix:px/s") var terminal_velocity: float = 2000
@export_range(0, 4000, 1, "suffix:px/s") var jump_speed: float = 900
@export_range(0, 4000, 1, "suffix:px/s²") var acceleration: float = 800
@export_range(0, 4000, 1, "suffix:px/s²") var deceleration: float = 1000
@onready var state_machine: AnimationNodeStateMachinePlayback = %AnimationTree["parameters/playback"]
@onready var jumps: int = max_jumps
@onready var gravity: float = ProjectSettings.get_setting("physics/2d/default_gravity")
func is_running():
return Input.is_action_pressed("Move Left") or Input.is_action_pressed("Move Right")
func is_on_ledge():
return is_on_floor() and not is_running() and not %Slip.is_colliding()
func did_jump():
return Input.is_action_just_pressed("Move Up") and jumps > 0
func _ready() -> void:
apply_floor_snap()
func clamp_dir(value: float, dir: float):
return clampf(value, min(dir, 0.0), max(dir, 0.0))
func _physics_process(delta: float) -> void:
velocity.y += gravity * delta
velocity.y = minf(velocity.y, terminal_velocity)
var vertical: float = Input.get_axis("Move Down", "Move Up")
var horizontal: float = Input.get_axis("Move Left", "Move Right")
velocity
if is_on_floor():
jumps = max_jumps
if did_jump():
if jumps != max_jumps:
state_machine.start(state_machine.get_current_node(), true)
jumps -= 1
velocity.y = -jump_speed
var max_speed: float = speed * horizontal
velocity.x += acceleration * horizontal * delta
if is_running():
velocity.x = clamp_dir(velocity.x, max_speed)
%animations.flip_h = horizontal > 0.0
else:
velocity.x -= clamp_dir(deceleration * velocity.x * delta, velocity.x)
if is_on_ledge():
jumps = 0
var direction: float = 1.0 if %SlipTestFront.is_colliding() else -1.0
velocity.x += 10_000 * delta * direction
if move_and_slide() and is_on_wall():
velocity.x = 0.0

648
godot/mhjnr/Moorhuhn.tscn Normal file
View File

@@ -0,0 +1,648 @@
[gd_scene load_steps=61 format=3 uid="uid://ctoj2a102rs6f"]
[ext_resource type="Script" path="res://mhjnr/Camera2D.gd" id="1_nngds"]
[ext_resource type="SpriteFrames" path="datafile://data/player/sprites.txt" id="2_valkm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mob27"]
size = Vector2(96, 85)
[sub_resource type="Animation" id="Animation_7sfno"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"mh_runW"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_v01jo"]
resource_name = "crawl"
length = 1.00001
loop_mode = 1
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_crawlWCycle"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6, 0.666667, 0.733333, 0.8, 0.866667, 0.933333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
}
[sub_resource type="Animation" id="Animation_jmosv"]
resource_name = "crawl_end"
length = 0.400007
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_crawlWEnd"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6]
}
[sub_resource type="Animation" id="Animation_8i52u"]
resource_name = "crawl_start"
length = 0.266673
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_crawlWStart"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4]
}
[sub_resource type="Animation" id="Animation_f4p3b"]
resource_name = "idle"
length = 4.00001
loop_mode = 1
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_stayW_idle"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1, 1.06667, 1.13333, 1.2, 1.26667, 1.33333, 2.26667, 2.33333, 2.4, 2.46667, 2.53333, 2.6, 2.66667, 3.6, 3.66667, 3.73333, 3.8, 3.86667, 3.93333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20]
}
[sub_resource type="Animation" id="Animation_kugay"]
resource_name = "jump"
length = 0.266673
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_stayW_jumpCycle"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4]
}
[sub_resource type="Animation" id="Animation_kbk86"]
resource_name = "jump_end"
length = 0.53334
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_stayW_jumpEnd+particle"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8]
}
[sub_resource type="Animation" id="Animation_0uslx"]
resource_name = "jump_start"
length = 0.33334
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_stayW_jumpStart"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5]
}
[sub_resource type="Animation" id="Animation_bifhq"]
resource_name = "run"
length = 0.600007
loop_mode = 1
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"mh_runW"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
[sub_resource type="Animation" id="Animation_517vc"]
resource_name = "run_end"
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_runW_stop+particle"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6, 0.666667, 0.733333, 0.8, 0.866667, 0.933333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
}
[sub_resource type="Animation" id="Animation_1mxgl"]
resource_name = "run_end_fall"
length = 1.13334
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"mh_fall_down"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6, 0.666667, 0.733333, 0.8, 0.866667, 0.933333, 1, 1.06667, 1.13333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
}
[sub_resource type="Animation" id="Animation_fmxky"]
resource_name = "run_jump"
length = 0.466673
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_runW_jump"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7]
}
[sub_resource type="Animation" id="Animation_l4g2q"]
resource_name = "run_smash_wall"
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"mh_hit_smashedWall"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6, 0.666667, 0.733333, 0.8, 0.866667, 0.933333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15]
}
[sub_resource type="Animation" id="Animation_khe4g"]
resource_name = "run_start"
length = 0.53334
step = 0.0666667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:animation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"MH_runW_1.stepStart"]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jvkhi"]
_data = {
"RESET": SubResource("Animation_7sfno"),
"crawl": SubResource("Animation_v01jo"),
"crawl_end": SubResource("Animation_jmosv"),
"crawl_start": SubResource("Animation_8i52u"),
"idle": SubResource("Animation_f4p3b"),
"jump": SubResource("Animation_kugay"),
"jump_end": SubResource("Animation_kbk86"),
"jump_start": SubResource("Animation_0uslx"),
"run": SubResource("Animation_bifhq"),
"run_end": SubResource("Animation_517vc"),
"run_end_fall": SubResource("Animation_1mxgl"),
"run_jump": SubResource("Animation_fmxky"),
"run_smash_wall": SubResource("Animation_l4g2q"),
"run_start": SubResource("Animation_khe4g")
}
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_u60at"]
animation = &"RESET"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_qt2l3"]
animation = &"run"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ohkqh"]
animation = &"run_end"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_s2hko"]
animation = &"run_smash_wall"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_t7lts"]
animation = &"run_start"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xgmeb"]
advance_mode = 2
advance_expression = "not is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x0rjg"]
advance_mode = 2
advance_expression = "is_on_wall()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_orvkk"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mtp52"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yfk7a"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p4gp5"]
advance_mode = 2
advance_expression = "not is_running() or is_on_wall()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_suygg"]
advance_mode = 2
advance_expression = "is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_750mf"]
advance_mode = 2
advance_expression = "velocity.x != 0"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0ymww"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gi4av"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_h8tv8"]
states/End/position = Vector2(668, 134)
states/RESET/node = SubResource("AnimationNodeAnimation_u60at")
states/RESET/position = Vector2(367, -131)
states/Start/position = Vector2(258, -131)
states/run/node = SubResource("AnimationNodeAnimation_qt2l3")
states/run/position = Vector2(668, -56)
states/run_end/node = SubResource("AnimationNodeAnimation_ohkqh")
states/run_end/position = Vector2(668, 32)
states/run_smash_wall/node = SubResource("AnimationNodeAnimation_s2hko")
states/run_smash_wall/position = Vector2(865, -131)
states/run_start/node = SubResource("AnimationNodeAnimation_t7lts")
states/run_start/position = Vector2(495, -131)
transitions = ["run", "run_end", SubResource("AnimationNodeStateMachineTransition_xgmeb"), "run", "run_smash_wall", SubResource("AnimationNodeStateMachineTransition_x0rjg"), "run_smash_wall", "End", SubResource("AnimationNodeStateMachineTransition_orvkk"), "run_end", "End", SubResource("AnimationNodeStateMachineTransition_mtp52"), "run_start", "run", SubResource("AnimationNodeStateMachineTransition_yfk7a"), "run_start", "End", SubResource("AnimationNodeStateMachineTransition_p4gp5"), "run_end", "run_start", SubResource("AnimationNodeStateMachineTransition_suygg"), "run_smash_wall", "run_start", SubResource("AnimationNodeStateMachineTransition_750mf"), "Start", "RESET", SubResource("AnimationNodeStateMachineTransition_0ymww"), "RESET", "run_start", SubResource("AnimationNodeStateMachineTransition_gi4av")]
graph_offset = Vector2(77, -267)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_wubix"]
animation = &"jump"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1p554"]
animation = &"idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_q376h"]
animation = &"jump_start"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kxajv"]
animation = &"jump_end"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_io5l5"]
animation = &"run_jump"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_mgepe"]
animation = &"run_end_fall"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_khcbs"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_6878b"]
advance_mode = 2
advance_expression = "velocity.y > 0.0"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1lxrg"]
advance_mode = 2
advance_expression = "is_on_floor()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5me5o"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_nrhuk"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_og56a"]
advance_mode = 2
advance_expression = "is_running() and velocity.x != 0.0"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_do5xa"]
advance_mode = 2
advance_expression = "is_on_ledge()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_okk45"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_r33lm"]
advance_mode = 2
advance_expression = "is_on_floor() and not is_on_ledge()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mqs3h"]
advance_mode = 2
advance_expression = "did_jump()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jd8pa"]
advance_mode = 2
advance_expression = "velocity.y > 0.0"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_c8u27"]
advance_mode = 2
advance_expression = "did_jump()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3lran"]
advance_mode = 2
advance_expression = "not is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8e8p2"]
advance_mode = 2
advance_expression = "is_on_floor()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_aivqa"]
advance_mode = 2
advance_expression = "is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_pp0po"]
advance_mode = 2
advance_expression = "is_on_ledge()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rh1ge"]
advance_mode = 2
advance_expression = "did_jump()"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_lv3mp"]
states/End/position = Vector2(893, 119)
states/Run/node = SubResource("AnimationNodeStateMachine_h8tv8")
states/Run/position = Vector2(592, 119)
states/Start/position = Vector2(73, 119)
states/fall/node = SubResource("AnimationNodeAnimation_wubix")
states/fall/position = Vector2(430, -168)
states/idle/node = SubResource("AnimationNodeAnimation_1p554")
states/idle/position = Vector2(235, 119)
states/jump/node = SubResource("AnimationNodeAnimation_q376h")
states/jump/position = Vector2(144, -19)
states/jump_end/node = SubResource("AnimationNodeAnimation_kxajv")
states/jump_end/position = Vector2(235, -168)
states/run_jump/node = SubResource("AnimationNodeAnimation_io5l5")
states/run_jump/position = Vector2(592, -40)
states/slip/node = SubResource("AnimationNodeAnimation_mgepe")
states/slip/position = Vector2(421, 58)
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_khcbs"), "jump", "fall", SubResource("AnimationNodeStateMachineTransition_6878b"), "fall", "jump_end", SubResource("AnimationNodeStateMachineTransition_1lxrg"), "jump_end", "idle", SubResource("AnimationNodeStateMachineTransition_5me5o"), "Run", "idle", SubResource("AnimationNodeStateMachineTransition_nrhuk"), "idle", "Run", SubResource("AnimationNodeStateMachineTransition_og56a"), "idle", "slip", SubResource("AnimationNodeStateMachineTransition_do5xa"), "slip", "fall", SubResource("AnimationNodeStateMachineTransition_okk45"), "slip", "jump_end", SubResource("AnimationNodeStateMachineTransition_r33lm"), "idle", "jump", SubResource("AnimationNodeStateMachineTransition_mqs3h"), "idle", "fall", SubResource("AnimationNodeStateMachineTransition_jd8pa"), "Run", "run_jump", SubResource("AnimationNodeStateMachineTransition_c8u27"), "run_jump", "fall", SubResource("AnimationNodeStateMachineTransition_3lran"), "run_jump", "Run", SubResource("AnimationNodeStateMachineTransition_8e8p2"), "jump_end", "Run", SubResource("AnimationNodeStateMachineTransition_aivqa"), "jump_end", "slip", SubResource("AnimationNodeStateMachineTransition_pp0po"), "jump_end", "jump", SubResource("AnimationNodeStateMachineTransition_rh1ge")]
graph_offset = Vector2(-106, -229)
[sub_resource type="AnimationNodeStateMachinePlayback" id="AnimationNodeStateMachinePlayback_udssx"]
[sub_resource type="AnimationNodeStateMachinePlayback" id="AnimationNodeStateMachinePlayback_n5wvc"]
[node name="Moorhuhn" type="CharacterBody2D"]
script = ExtResource("1_nngds")
jump_speed = 610.0
[node name="Slip" type="RayCast2D" parent="."]
unique_name_in_owner = true
target_position = Vector2(0, 100)
[node name="SlipTestFront" type="RayCast2D" parent="."]
unique_name_in_owner = true
position = Vector2(-55, 0)
target_position = Vector2(0, 100)
[node name="Collision" type="CollisionShape2D" parent="."]
unique_name_in_owner = true
position = Vector2(0, 40)
shape = SubResource("RectangleShape2D_mob27")
[node name="animations" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true
sprite_frames = ExtResource("2_valkm")
animation = &"mh_runW"
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../animations")
playback_process_mode = 0
libraries = {
"": SubResource("AnimationLibrary_jvkhi")
}
[node name="AnimationTree" type="AnimationTree" parent="."]
unique_name_in_owner = true
tree_root = SubResource("AnimationNodeStateMachine_lv3mp")
anim_player = NodePath("../AnimationPlayer")
advance_expression_base_node = NodePath("..")
active = true
process_callback = 0
parameters/playback = SubResource("AnimationNodeStateMachinePlayback_udssx")
parameters/Run/playback = SubResource("AnimationNodeStateMachinePlayback_n5wvc")

7
godot/mhjnr/camera.gd Normal file
View File

@@ -0,0 +1,7 @@
extends Camera2D
var player: CharacterBody2D
func _process(delta: float) -> void:
position = player.position
pass

61
godot/mhjnr/level.gd Normal file
View File

@@ -0,0 +1,61 @@
@tool
extends Node2D
@export var level_id: int = 1
func _ready() -> void:
var player = preload("res://mhjnr/Moorhuhn.tscn").instantiate()
add_child(player)
%Camera.player = player
%HudLevel.text = "Level %d" % level_id
player.position = Vector2(200, 10)
var camera_rect: Rect2i
var level: ObjectScript = load("datafile://data/level%02d/settings/level.txt" % level_id)
for data in level.static_objects:
match data.resource_type:
"LevelSettings":
%LevelTimer.start(data.props["levelTime"])
"TiledLayer":
var scene = load("datafile://data/level%02d/layers/%s.dat" % [level_id, data.name.to_lower()])
var tiles: TileMap = scene.instantiate()
tiles.name = data.name
tiles.visible = data.props["is visible"] == 1
var used = tiles.get_used_rect()
used.position *= tiles.cell_quadrant_size
used.size *= tiles.cell_quadrant_size
camera_rect = used if camera_rect == null else camera_rect.merge(used)
var scroll_speed: Vector2 = data.props["scroll speed"]
if scroll_speed.is_equal_approx(Vector2(1, 1)):
add_child(tiles)
else:
var parallax = ParallaxLayer.new()
parallax.name = data.name
parallax.visible = data.props["is visible"] == 1
parallax.motion_scale = data.props["scroll speed"]
%parallax.add_child(parallax)
parallax.add_child(tiles)
%Camera.limit_left = camera_rect.position.x
%Camera.limit_top = camera_rect.position.y
%Camera.limit_right = camera_rect.position.x + camera_rect.size.x
%Camera.limit_bottom = camera_rect.position.y + camera_rect.size.y
%WorldBoundLeft.position.x = camera_rect.position.x
%WorldBoundTop.position.y = camera_rect.position.y
%WorldBoundRight.position.x = camera_rect.position.x + camera_rect.size.x
%WorldBoundBottom.position.y = camera_rect.position.y + camera_rect.size.y
#var enemies: ObjectScript = load("datafile://data/level%02d/layers/%s.dat" % [level_id, name.to_lower()])
#for object in enemies.dynamic_objects:
# match object.props["subType"]:
## 1: create_movable(object)
# 0: create_enemy(object)
func create_enemy(data: ObjectData):
pass
func create_movable(data: ObjectData):
pass

142
godot/mhjnr/level.tscn Normal file
View File

@@ -0,0 +1,142 @@
[gd_scene load_steps=14 format=3 uid="uid://bgb4avgjexp4t"]
[ext_resource type="Script" path="res://mhjnr/level.gd" id="1_dfqgf"]
[ext_resource type="Theme" uid="uid://ks2uyxqg6u4k" path="res://mhjnr/theme.tres" id="3_a2fmg"]
[ext_resource type="Script" path="res://mhjnr/camera.gd" id="3_e6xoo"]
[ext_resource type="Texture2D" path="datafile://data/set1/sprites/hud_live.bmp" id="4_4bu8b"]
[ext_resource type="Texture2D" path="datafile://data/set1/sprites/hud_shield.bmp" id="5_6bu8b"]
[ext_resource type="Texture2D" path="datafile://data/set1/sprites/hud_bullet.bmp" id="5_rxbck"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_j78b3"]
normal = Vector2(0, 1)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_3mxdl"]
normal = Vector2(-1, 0)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_p4tp1"]
normal = Vector2(1, 0)
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ixcvh"]
[sub_resource type="GDScript" id="GDScript_nmpfh"]
resource_name = "TimeLabel"
script/source = "extends Label
func _process(delta: float) -> void:
var time_left = %LevelTimer.time_left
text = \"%02d:%02d\" % [int(time_left / 60), int(time_left) % 60]
"
[sub_resource type="AtlasTexture" id="AtlasTexture_glgkj"]
atlas = ExtResource("5_6bu8b")
region = Rect2(0, 0, 136, 42)
filter_clip = true
[sub_resource type="AtlasTexture" id="AtlasTexture_2nrpq"]
atlas = ExtResource("4_4bu8b")
region = Rect2(0, 0, 36, 32)
filter_clip = true
[node name="level" type="Node2D"]
script = ExtResource("1_dfqgf")
level_id = 2
[node name="Camera" type="Camera2D" parent="."]
unique_name_in_owner = true
process_callback = 0
limit_smoothed = true
position_smoothing_enabled = true
position_smoothing_speed = 10.0
drag_horizontal_enabled = true
drag_vertical_enabled = true
script = ExtResource("3_e6xoo")
[node name="parallax" type="ParallaxBackground" parent="."]
unique_name_in_owner = true
[node name="WorldBounds" type="StaticBody2D" parent="."]
[node name="WorldBoundTop" type="CollisionShape2D" parent="WorldBounds"]
unique_name_in_owner = true
shape = SubResource("WorldBoundaryShape2D_j78b3")
[node name="WorldBoundRight" type="CollisionShape2D" parent="WorldBounds"]
unique_name_in_owner = true
shape = SubResource("WorldBoundaryShape2D_3mxdl")
[node name="WorldBoundLeft" type="CollisionShape2D" parent="WorldBounds"]
unique_name_in_owner = true
shape = SubResource("WorldBoundaryShape2D_p4tp1")
[node name="KillFloor" type="Area2D" parent="."]
[node name="WorldBoundBottom" type="CollisionShape2D" parent="KillFloor"]
unique_name_in_owner = true
shape = SubResource("WorldBoundaryShape2D_ixcvh")
[node name="LevelTimer" type="Timer" parent="."]
unique_name_in_owner = true
[node name="HUD" type="CanvasLayer" parent="."]
[node name="MarginContainer" type="MarginContainer" parent="HUD"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="GridContainer" type="GridContainer" parent="HUD/MarginContainer"]
layout_mode = 2
columns = 3
[node name="VBoxContainer" type="VBoxContainer" parent="HUD/MarginContainer/GridContainer"]
layout_mode = 2
[node name="Score" type="Label" parent="HUD/MarginContainer/GridContainer/VBoxContainer"]
layout_mode = 2
text = "0035570"
[node name="Time" type="Label" parent="HUD/MarginContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 6
theme = ExtResource("3_a2fmg")
text = "04:36"
horizontal_alignment = 1
vertical_alignment = 1
script = SubResource("GDScript_nmpfh")
[node name="HudLevel" type="Label" parent="HUD/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Level 4"
[node name="shield" type="TextureRect" parent="HUD/MarginContainer/GridContainer"]
layout_mode = 2
size_flags_vertical = 10
texture = SubResource("AtlasTexture_glgkj")
[node name="Lives" type="HBoxContainer" parent="HUD/MarginContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 6
size_flags_vertical = 8
[node name="Label" type="Label" parent="HUD/MarginContainer/GridContainer/Lives"]
layout_mode = 2
text = "4"
[node name="TextureRect" type="TextureRect" parent="HUD/MarginContainer/GridContainer/Lives"]
layout_mode = 2
texture = SubResource("AtlasTexture_2nrpq")
[node name="HBoxContainer" type="HBoxContainer" parent="HUD/MarginContainer/GridContainer"]
layout_mode = 2
size_flags_vertical = 8
[node name="TextureRect" type="TextureRect" parent="HUD/MarginContainer/GridContainer/HBoxContainer"]
layout_mode = 2
texture = ExtResource("5_rxbck")

6
godot/mhjnr/theme.tres Normal file
View File

@@ -0,0 +1,6 @@
[gd_resource type="Theme" format=3 uid="uid://ks2uyxqg6u4k"]
[ext_resource type="FontFile" path="datafile://data/fonts/menufont.bmp" id="9_6bx8b"]
[resource]
/fonts/menufont = ExtResource("9_6bx8b")

50
godot/project.godot Normal file
View File

@@ -0,0 +1,50 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="MHJNR"
run/main_scene="res://mhjnr/level.tscn"
config/features=PackedStringArray("4.0", "GL Compatibility")
boot_splash/bg_color=Color(0, 0, 0, 1)
boot_splash/image="res://icon.png"
boot_splash/fullsize=false
[input]
"Move Up"={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}
"Move Down"={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}
"Move Right"={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}
"Move Left"={
"deadzone": 0.5,
"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,"echo":false,"script":null)
]
}
[physics]
2d/default_gravity=2000.0
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"