parent
9eb110b509
commit
7a567d6796
@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b8sq1ket4sycd"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
; 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="Axolotl"
|
||||||
|
run/main_scene="res://scenes/Dojo.tscn"
|
||||||
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
@ -0,0 +1,237 @@
|
|||||||
|
[gd_scene load_steps=13 format=3 uid="uid://d4nb1twqrmebx"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dfh0dpo7iq3eb" path="res://sprites/Axolotl.png" id="1_tbw8a"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/Axolotl.gd" id="1_uo3dg"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cf24ht1sv1yih" path="res://scenes/Camera.tscn" id="2_fge4g"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_np4lk"]
|
||||||
|
radius = 6.0
|
||||||
|
height = 24.0
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_m4cwp"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [0]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(0, 3)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_hwv1x"]
|
||||||
|
resource_name = "idle"
|
||||||
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [0, 1, 2, 3, 4, 5]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_oelbc"]
|
||||||
|
resource_name = "munch"
|
||||||
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(1, 4)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [24, 25, 26, 27, 28, 29]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_7s1x2"]
|
||||||
|
resource_name = "sprint"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(1, 2)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [12, 13, 14, 15, 16]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_rht3k"]
|
||||||
|
resource_name = "swim"
|
||||||
|
length = 0.7
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(0, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [6, 7, 8, 9, 10, 11]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_k4uu0"]
|
||||||
|
resource_name = "turn"
|
||||||
|
length = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(0, 3)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [18, 19, 20, 21, 22]
|
||||||
|
}
|
||||||
|
tracks/2/type = "method"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath(".")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0.4),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"end_turn"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sojmd"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_m4cwp"),
|
||||||
|
"idle": SubResource("Animation_hwv1x"),
|
||||||
|
"munch": SubResource("Animation_oelbc"),
|
||||||
|
"sprint": SubResource("Animation_7s1x2"),
|
||||||
|
"swim": SubResource("Animation_rht3k"),
|
||||||
|
"turn": SubResource("Animation_k4uu0")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationRootNode" id="AnimationRootNode_7r5ga"]
|
||||||
|
|
||||||
|
[node name="Axolotl" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||||
|
script = ExtResource("1_uo3dg")
|
||||||
|
|
||||||
|
[node name="Camera2D" parent="CharacterBody2D" instance=ExtResource("2_fge4g")]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
|
||||||
|
texture_filter = 1
|
||||||
|
texture = ExtResource("1_tbw8a")
|
||||||
|
hframes = 6
|
||||||
|
vframes = 5
|
||||||
|
frame = 18
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||||
|
visible = false
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource("CapsuleShape2D_np4lk")
|
||||||
|
|
||||||
|
[node name="AnimationTree" type="AnimationTree" parent="CharacterBody2D"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_sojmd")
|
||||||
|
}
|
||||||
|
tree_root = SubResource("AnimationRootNode_7r5ga")
|
||||||
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="CharacterBody2D"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_sojmd")
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
[gd_scene format=3 uid="uid://cf24ht1sv1yih"]
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D"]
|
||||||
|
zoom = Vector2(3, 3)
|
||||||
|
limit_smoothed = true
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
editor_draw_limits = true
|
||||||
|
editor_draw_drag_margin = true
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c8s3or2hskj0i"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d4nb1twqrmebx" path="res://scenes/Axolotl.tscn" id="1_eysle"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://pptrf5oq4k1x" path="res://scenes/generic_obstacle.tscn" id="2_q2aw5"]
|
||||||
|
|
||||||
|
[node name="Dojo" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Axolotl" parent="." instance=ExtResource("1_eysle")]
|
||||||
|
|
||||||
|
[node name="GenericObstacle" parent="." instance=ExtResource("2_q2aw5")]
|
||||||
|
|
||||||
|
[node name="GenericObstacle4" parent="." instance=ExtResource("2_q2aw5")]
|
||||||
|
position = Vector2(508, 364)
|
||||||
|
|
||||||
|
[node name="GenericObstacle3" parent="." instance=ExtResource("2_q2aw5")]
|
||||||
|
position = Vector2(631, 128)
|
||||||
|
|
||||||
|
[node name="GenericObstacle2" parent="." instance=ExtResource("2_q2aw5")]
|
||||||
|
position = Vector2(245, 226)
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://pptrf5oq4k1x"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b8sq1ket4sycd" path="res://icon.svg" id="1_dpci1"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6u7yk"]
|
||||||
|
size = Vector2(124, 122)
|
||||||
|
|
||||||
|
[node name="GenericObstacle" type="Sprite2D"]
|
||||||
|
position = Vector2(866, 474)
|
||||||
|
texture = ExtResource("1_dpci1")
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
shape = SubResource("RectangleShape2D_6u7yk")
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
const SPEED = 150.0
|
||||||
|
const SPRINT_MAX = 2
|
||||||
|
|
||||||
|
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||||
|
#var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
|
|
||||||
|
var sprint = 1
|
||||||
|
var gravity = 0
|
||||||
|
var turning = false
|
||||||
|
var anim
|
||||||
|
var sprite
|
||||||
|
var direction = Vector2.ZERO
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
anim = $AnimationPlayer
|
||||||
|
sprite = $Sprite2D
|
||||||
|
|
||||||
|
|
||||||
|
func end_turn():
|
||||||
|
sprite.flip_h = !sprite.flip_h
|
||||||
|
turning = false
|
||||||
|
anim.speed_scale = 1
|
||||||
|
print( "turned" )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func turn():
|
||||||
|
#turning = true
|
||||||
|
anim.speed_scale = 1
|
||||||
|
anim.play("turn")
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
|
||||||
|
# Add the gravity.
|
||||||
|
if gravity !=0 and not is_on_floor():
|
||||||
|
velocity.y += gravity * delta
|
||||||
|
|
||||||
|
# Handle sprint.
|
||||||
|
if Input.is_action_just_pressed("ui_accept"):
|
||||||
|
sprint = SPRINT_MAX
|
||||||
|
else:
|
||||||
|
sprint = move_toward( sprint, 1 , 0.01 )
|
||||||
|
# Get the input direction and handle the movement/deceleration.
|
||||||
|
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||||
|
direction = Vector2 (Input.get_axis("ui_left", "ui_right"),Input.get_axis("ui_up", "ui_down")/2).normalized()
|
||||||
|
|
||||||
|
|
||||||
|
if (Input.is_action_just_pressed("ui_right") and sprite.flip_h) or (Input.is_action_just_pressed("ui_left") and !sprite.flip_h):
|
||||||
|
turn()
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if direction != Vector2.ZERO and !turning:
|
||||||
|
if ( direction.x < 0 and sprite.flip_h ) or ( direction.x > 0 and !sprite.flip_h ):
|
||||||
|
sprite.rotation = 0;
|
||||||
|
velocity.x = direction.x * SPEED * sprint
|
||||||
|
|
||||||
|
if sprint > 1:
|
||||||
|
anim.speed_scale = sprint
|
||||||
|
anim.play("sprint")
|
||||||
|
else:
|
||||||
|
anim.speed_scale = 1
|
||||||
|
anim.play("swim")
|
||||||
|
velocity.y = direction.y * SPEED
|
||||||
|
|
||||||
|
if !sprite.flip_h:
|
||||||
|
sprite.rotation = move_toward(direction.angle(),0, .1)
|
||||||
|
else:
|
||||||
|
sprite.rotation = move_toward(direction.angle() - PI,0, -.1)
|
||||||
|
|
||||||
|
else:
|
||||||
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
|
velocity.y = move_toward(velocity.y, 0, SPEED)
|
||||||
|
anim.speed_scale = .5
|
||||||
|
sprite.rotation = move_toward(sprite.rotation,0, .1)
|
||||||
|
|
||||||
|
$AnimationPlayer.play("idle")
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dfh0dpo7iq3eb"
|
||||||
|
path="res://.godot/imported/Axolotl.png-28ad26bf605b849020409dac18749725.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/Axolotl.png"
|
||||||
|
dest_files=["res://.godot/imported/Axolotl.png-28ad26bf605b849020409dac18749725.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
|
||||||
Loading…
Reference in new issue