Initial commit, added my first prototype

This commit is contained in:
oleg 2023-12-07 21:05:00 +03:00
commit e8a021dd10
28 changed files with 615 additions and 0 deletions

View file

@ -0,0 +1,45 @@
extends CharacterBody2D
# Скорость хождения
@export var base_movement_speed = 300.0
func _ready():
pass
func _physics_process(_delta):
var horizontal_direction = Input.get_axis("ui_left", "ui_right")
var vertical_direction = Input.get_axis("ui_up", "ui_down")
if horizontal_direction:
velocity.x = horizontal_direction * base_movement_speed
if vertical_direction:
velocity.x = velocity.x/2
# иначе будет складываться скорость по вертикали и горизонтали
else:
velocity.x = move_toward(velocity.x, 0, base_movement_speed)
if vertical_direction:
velocity.y = vertical_direction * base_movement_speed
if horizontal_direction:
velocity.x = velocity.x/2
# иначе будет складываться скорость по вертикали и горизонтали
else:
velocity.y = move_toward(velocity.y, 0, base_movement_speed)
# Проверка, куда должен смотреть персонаж
# вертикальная анимация имеет больший приоритет
if horizontal_direction < 0 and !vertical_direction:
$PlayerSprite.animation = "left-go"
if horizontal_direction > 0 and !vertical_direction:
$PlayerSprite.animation = "right-go"
if vertical_direction < 0:
$PlayerSprite.animation = "up-go"
if vertical_direction > 0:
$PlayerSprite.animation = "down-go"
# Проверка, должна ли играть анимация
if (velocity.x == 0) and (velocity.y == 0):
$PlayerSprite.frame = 0 # поставить анимацию на первый кадр
$PlayerSprite.stop() # остановить анимацию
else:
$PlayerSprite.play() # играть анимацию
move_and_slide() # Применяет передедвижение

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b0bmwarkx2fxb"
path="res://.godot/imported/mpv-shot0001.jpg-4c0b1d2bc221c05906c91de8aef5b655.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/mpv-shot0001.jpg"
dest_files=["res://.godot/imported/mpv-shot0001.jpg-4c0b1d2bc221c05906c91de8aef5b655.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bn3ak3pxua6kr"
path="res://.godot/imported/down-go.png-b7ff3c66c87410b5959fd5814fd1e219.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/down-go.png"
dest_files=["res://.godot/imported/down-go.png-b7ff3c66c87410b5959fd5814fd1e219.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://oblvfn4a7jgr"
path="res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/down-stay.png"
dest_files=["res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cr4m035rj17ob"
path="res://.godot/imported/lef-go.png-c2828610ecd9de079e6e07f438a97f58.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/lef-go.png"
dest_files=["res://.godot/imported/lef-go.png-c2828610ecd9de079e6e07f438a97f58.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ryqgr3iw2cna"
path="res://.godot/imported/lef-stay.png-a3c20ee62f036d75022dcd95db3eeec3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/lef-stay.png"
dest_files=["res://.godot/imported/lef-stay.png-a3c20ee62f036d75022dcd95db3eeec3.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bp5p8knf7n06i"
path="res://.godot/imported/right-go.png-cd8d6b25be48ed6058b40787fe95ae2b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/right-go.png"
dest_files=["res://.godot/imported/right-go.png-cd8d6b25be48ed6058b40787fe95ae2b.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d11jduno6wolt"
path="res://.godot/imported/right-stay.png-a18ca84ac15fe311d4b496c1840de0f4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/right-stay.png"
dest_files=["res://.godot/imported/right-stay.png-a18ca84ac15fe311d4b496c1840de0f4.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

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="32"
height="32"
viewBox="0 0 32 32"
version="1.1"
id="svg1"
inkscape:export-filename="right-stay.png"
inkscape:export-xdpi="192"
inkscape:export-ydpi="192"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
sodipodi:docname="svg-source.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="1.4805048"
inkscape:cx="85.106106"
inkscape:cy="115.50114"
inkscape:window-width="1366"
inkscape:window-height="730"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="1"
spacingy="1"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#0d8cb5;stroke-width:0.151181;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:0.907086, 0.907086"
id="rect1"
width="30"
height="30"
x="1"
y="1" />
<g
id="g2"
transform="rotate(90,15.493026,16.08404)">
<path
style="fill:#ffffff;fill-opacity:1;stroke-width:0.151181;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:0.907086, 0.907086"
d="m 12.073584,28.368702 v -16.54841 l -7.092175,0.08443 11.567,-8.7807886 9.456234,8.7807886 -6.163438,0.168861 -0.168861,16.970563 z"
id="path1" />
<path
style="display:none;fill:#88f8ad;fill-opacity:1;stroke-width:0.151181;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:0.907086, 0.907086"
d="m 12.073584,28.368702 v -16.54841 l -7.092175,0.08443 11.567,-8.7807886 9.456234,8.7807886 -6.163438,0.168861 -0.168861,16.970563 z"
id="path2" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c48c2yny83qej"
path="res://.godot/imported/svg-source.svg-bd6db85edfc66789d837fc500bbcfdd2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/svg-source.svg"
dest_files=["res://.godot/imported/svg-source.svg-bd6db85edfc66789d837fc500bbcfdd2.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bup48pdr00h7a"
path="res://.godot/imported/up-go.png-e5f0207e0383e63792b4ff15357b9994.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/up-go.png"
dest_files=["res://.godot/imported/up-go.png-e5f0207e0383e63792b4ff15357b9994.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jduoxes2e4uh"
path="res://.godot/imported/up-stay.png-8e04726b54f9d01d6a6c3d28ba13ea99.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/up-stay.png"
dest_files=["res://.godot/imported/up-stay.png-8e04726b54f9d01d6a6c3d28ba13ea99.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

View file

@ -0,0 +1,80 @@
[gd_scene load_steps=13 format=3 uid="uid://7l1u7y2xvwa6"]
[ext_resource type="Texture2D" path="res://mpv-shot0001.jpg" id="1_ix3x0"]
[ext_resource type="Script" path="res://Player.gd" id="2_fy1jm"]
[ext_resource type="Texture2D" path="res://player/down-go.png" id="3_hrt1y"]
[ext_resource type="Texture2D" path="res://player/down-stay.png" id="4_fjw2y"]
[ext_resource type="Texture2D" path="res://player/lef-go.png" id="5_rxlf0"]
[ext_resource type="Texture2D" path="res://player/lef-stay.png" id="6_rohwl"]
[ext_resource type="Texture2D" path="res://player/right-go.png" id="7_l3vli"]
[ext_resource type="Texture2D" path="res://player/right-stay.png" id="8_ac52e"]
[ext_resource type="Texture2D" path="res://player/up-go.png" id="9_44ip5"]
[ext_resource type="Texture2D" path="res://player/up-stay.png" id="10_ddtxv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ggyph"]
size = Vector2(60, 60)
[sub_resource type="SpriteFrames" id="SpriteFrames_yher1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_fjw2y")
}, {
"duration": 1.0,
"texture": ExtResource("3_hrt1y")
}],
"loop": true,
"name": &"down-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_rohwl")
}, {
"duration": 1.0,
"texture": ExtResource("5_rxlf0")
}],
"loop": true,
"name": &"left-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_ac52e")
}, {
"duration": 1.0,
"texture": ExtResource("7_l3vli")
}],
"loop": true,
"name": &"right-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_ddtxv")
}, {
"duration": 1.0,
"texture": ExtResource("9_44ip5")
}],
"loop": true,
"name": &"up-go",
"speed": 5.0
}]
[node name="Node2D" type="Node2D"]
[node name="Mpv-shot0001" type="Sprite2D" parent="."]
position = Vector2(577.222, 323.75)
scale = Vector2(0.604167, 0.604167)
texture = ExtResource("1_ix3x0")
[node name="Player" type="CharacterBody2D" parent="."]
position = Vector2(162, 125)
script = ExtResource("2_fy1jm")
[node name="PlayerCollision" type="CollisionShape2D" parent="Player"]
shape = SubResource("RectangleShape2D_ggyph")
[node name="PlayerSprite" type="AnimatedSprite2D" parent="Player"]
sprite_frames = SubResource("SpriteFrames_yher1")
animation = &"down-go"