Dash dash baby
This commit is contained in:
1 parent
a73609b86b
commit
11e291e867
12 files changed
+222
-30
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 443 B |
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ba4kjeulthw1g"
|
||||
path="res://.godot/imported/dunce1.png-de6f74ebb32d625ad52a8a4b955363f6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/hats/dunce1.png"
|
||||
dest_files=["res://.godot/imported/dunce1.png-de6f74ebb32d625ad52a8a4b955363f6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/high_quality_mode=0
|
||||
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
|
||||
mipmaps/preserve_alpha_test_coverage=false
|
||||
mipmaps/alpha_test_threshold=0.5
|
||||
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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 442 B |
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cp1v5uhvbfws6"
|
||||
path="res://.godot/imported/dunce2.png-37a87f65677f98425ffee71e6bd19029.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/hats/dunce2.png"
|
||||
dest_files=["res://.godot/imported/dunce2.png-37a87f65677f98425ffee71e6bd19029.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/high_quality_mode=0
|
||||
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
|
||||
mipmaps/preserve_alpha_test_coverage=false
|
||||
mipmaps/alpha_test_threshold=0.5
|
||||
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
|
||||
+18
-3
@@ -2,6 +2,7 @@ extends CharacterBody2D
|
||||
|
||||
const SPEED = 380.0
|
||||
const DASH_SPEED = 600
|
||||
const HORIZONTAL_DASH_MULT = 1.8
|
||||
const FRICTION = 100
|
||||
const GRAVITY_MULT = 0.8
|
||||
|
||||
@@ -20,8 +21,14 @@ var coins = 0
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func refresh_dash(new_dashes):
|
||||
if new_dashes:
|
||||
dashes = new_dashes
|
||||
else:
|
||||
dashes = 1
|
||||
|
||||
func refresh_jump(new_jumps):
|
||||
if jumps:
|
||||
if new_jumps:
|
||||
jumps = new_jumps
|
||||
else:
|
||||
jumps = 1
|
||||
@@ -53,13 +60,16 @@ func _process(delta: float) -> void:
|
||||
|
||||
if direction < 0:
|
||||
$Sprite2D.flip_h = true
|
||||
$Sprite2D/HatSprite.flip_h = true
|
||||
elif direction > 0:
|
||||
$Sprite2D.flip_h = false
|
||||
$Sprite2D/HatSprite.flip_h = false
|
||||
|
||||
if Input.is_action_just_pressed("dash"):
|
||||
if Input.is_action_just_pressed("dash") and dashes > 0:
|
||||
dashing = true
|
||||
dashes -= 1
|
||||
velocity = Vector2(
|
||||
Input.get_axis("dash_left","dash_right"),
|
||||
Input.get_axis("dash_left","dash_right") * HORIZONTAL_DASH_MULT,
|
||||
Input.get_axis("dash_up","dash_down")
|
||||
) * DASH_SPEED
|
||||
await get_tree().create_timer(DASH_LENGTH).timeout
|
||||
@@ -68,10 +78,12 @@ func _process(delta: float) -> void:
|
||||
elif direction and !dashing:
|
||||
velocity.x = direction * SPEED
|
||||
$Sprite2D.play("running")
|
||||
$Sprite2D/HatSprite.play("running")
|
||||
|
||||
elif !dashing:
|
||||
velocity.x = move_toward(velocity.x, 0, FRICTION)
|
||||
$Sprite2D.play("idle")
|
||||
$Sprite2D/HatSprite.play("idle")
|
||||
|
||||
#print("PLAYER X POSITION: " + str(position.y))
|
||||
if position.y >= death_threshold:
|
||||
@@ -82,14 +94,17 @@ func _process(delta: float) -> void:
|
||||
if is_on_floor():
|
||||
fall_timer = 0
|
||||
refresh_jump(1)
|
||||
refresh_dash(1)
|
||||
#%Player2D.get_node("Camera2D").position_smoothing_speed = %Player2D.CAMERA_SMOOTHING_SPEED
|
||||
|
||||
if is_on_wall():
|
||||
refresh_jump(1)
|
||||
refresh_dash(1)
|
||||
#%Player2D.get_node("Camera2D").position_smoothing_speed = %Player2D.CAMERA_SMOOTHING_SPEED
|
||||
|
||||
if is_on_ceiling():
|
||||
refresh_jump(1)
|
||||
refresh_dash(1)
|
||||
|
||||
if fall_timer > 3:
|
||||
pass
|
||||
|
||||
+54
-2
@@ -1,12 +1,23 @@
|
||||
[gd_scene format=3 uid="uid://pmnwck5v0ntm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cojhnj15psd2x" path="res://player_2d.gd" id="1_sy00s"]
|
||||
[ext_resource type="Shader" uid="uid://mmf86jusrkrr" path="res://shaders/warp_shader.gdshader" id="3_gt2ls"]
|
||||
[ext_resource type="Texture2D" uid="uid://dpdxs6gjmexgh" path="res://art/background.png" id="3_p3026"]
|
||||
[ext_resource type="Texture2D" uid="uid://biv3f67rqumak" path="res://art/level_start.png" id="4_nj6as"]
|
||||
[ext_resource type="Script" uid="uid://3bqq3mfbby2c" path="res://warp_shader.gd" id="4_pmt5n"]
|
||||
[ext_resource type="Texture2D" uid="uid://lk0f1qyswyxv" path="res://art/player/running/frame1.png" id="5_6jyqn"]
|
||||
[ext_resource type="Texture2D" uid="uid://lmje8plw76e1" path="res://art/player/running/frame2.png" id="6_gt2ls"]
|
||||
[ext_resource type="AudioStream" uid="uid://8iiafankqo4i" path="res://sound/stepping.wav" id="7_cbsa3"]
|
||||
[ext_resource type="Texture2D" uid="uid://dh7a1knyqn5nd" path="res://art/player/running/frame3.png" id="7_pmt5n"]
|
||||
[ext_resource type="Texture2D" uid="uid://yf13nw31k8ua" path="res://art/player/running/frame4.png" id="8_nj6as"]
|
||||
[ext_resource type="Texture2D" uid="uid://ba4kjeulthw1g" path="res://art/hats/dunce1.png" id="10_5s8kx"]
|
||||
[ext_resource type="Texture2D" uid="uid://cp1v5uhvbfws6" path="res://art/hats/dunce2.png" id="11_4apft"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pmt5n"]
|
||||
shader = ExtResource("3_gt2ls")
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_nj6as"]
|
||||
size = Vector2(1280, 720)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_fvyjh"]
|
||||
animations = [{
|
||||
@@ -39,12 +50,45 @@ animations = [{
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_pmt5n"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_5s8kx")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"idle",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("11_4apft")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_5s8kx")
|
||||
}],
|
||||
"loop": 1,
|
||||
"name": &"running",
|
||||
"speed": 6.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fj7yv"]
|
||||
size = Vector2(10, 16)
|
||||
|
||||
[node name="Player2D" type="CharacterBody2D" unique_id=889851478]
|
||||
script = ExtResource("1_sy00s")
|
||||
|
||||
[node name="CanvasLayer2" type="CanvasLayer" parent="." unique_id=1854423107]
|
||||
|
||||
[node name="WarpShader" type="MeshInstance2D" parent="CanvasLayer2" unique_id=88397728]
|
||||
material = SubResource("ShaderMaterial_pmt5n")
|
||||
mesh = SubResource("QuadMesh_nj6as")
|
||||
script = ExtResource("4_pmt5n")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="CanvasLayer2/WarpShader" unique_id=1651549733]
|
||||
visible = false
|
||||
texture = ExtResource("4_nj6as")
|
||||
|
||||
[node name="Parallax2D" type="Parallax2D" parent="." unique_id=270393374]
|
||||
repeat_size = Vector2(1, 1)
|
||||
|
||||
@@ -56,7 +100,6 @@ texture = ExtResource("3_p3026")
|
||||
zoom = Vector2(1.75, 1.75)
|
||||
process_callback = 0
|
||||
position_smoothing_enabled = true
|
||||
position_smoothing_speed = 3.0
|
||||
|
||||
[node name="Sprite2D" type="AnimatedSprite2D" parent="." unique_id=693422376]
|
||||
z_index = 1
|
||||
@@ -65,7 +108,16 @@ position = Vector2(0, 2)
|
||||
sprite_frames = SubResource("SpriteFrames_fvyjh")
|
||||
animation = &"running"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.48246452
|
||||
frame_progress = 0.87170494
|
||||
|
||||
[node name="HatSprite" type="AnimatedSprite2D" parent="Sprite2D" unique_id=1954184475]
|
||||
visible = false
|
||||
position = Vector2(0, -13)
|
||||
scale = Vector2(0.9, 0.9)
|
||||
sprite_frames = SubResource("SpriteFrames_pmt5n")
|
||||
animation = &"running"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.1718222
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1294571021]
|
||||
shape = SubResource("RectangleShape2D_fj7yv")
|
||||
|
||||
+2
-1
@@ -17,8 +17,9 @@ config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1280
|
||||
window/size/viewport_height=720
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[gui]
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Thanks YouTube and DevPoodle
|
||||
// https://www.youtube.com/watch?v=E401x98N6iA
|
||||
|
||||
shader_type canvas_item;
|
||||
render_mode unshaded, skip_vertex_transform;
|
||||
|
||||
const float curvature = 3.2;
|
||||
|
||||
uniform sampler2D screen_texture: hint_screen_texture;
|
||||
|
||||
void fragment() {
|
||||
vec2 centered_uv = SCREEN_UV * 2.0 - 1.0;
|
||||
vec2 uv_offset = centered_uv.yx / curvature;
|
||||
vec2 warped_uv = centered_uv + centered_uv * uv_offset * uv_offset;
|
||||
vec3 cutoff = vec3(step(abs(warped_uv.x), 1.0) * step(abs(warped_uv.y), 1.0));
|
||||
|
||||
vec3 screen_color = texture(screen_texture, (warped_uv + 1.0) / 2.0).rgb;
|
||||
//COLOR = vec4(warped_uv, 0.0, 1.0);
|
||||
COLOR = texture(screen_texture, (warped_uv + 1.0) / 2.0);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://mmf86jusrkrr
|
||||
@@ -0,0 +1,16 @@
|
||||
extends MeshInstance2D
|
||||
|
||||
var crt_shader = preload("res://shaders/warp_shader.gdshader")
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
# Adjust some uniforms
|
||||
#material.set_shader_param("brightness", 1.2)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
print(DisplayServer.window_get_size().x)
|
||||
print(DisplayServer.window_get_size().y)
|
||||
mesh.size.x = DisplayServer.window_get_size().x * 4
|
||||
mesh.size.y = DisplayServer.window_get_size().y * 4
|
||||
@@ -0,0 +1 @@
|
||||
uid://3bqq3mfbby2c
|
||||
+24
-24
@@ -16,30 +16,6 @@
|
||||
process_mode = 3
|
||||
scale = Vector2(1, 1.0155824)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1982310971]
|
||||
|
||||
[node name="RichTextLabel2" type="RichTextLabel" parent="CanvasLayer" unique_id=1423365940]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "FPS:"
|
||||
script = ExtResource("2_dwbse")
|
||||
|
||||
[node name="RichTextLabel3" type="RichTextLabel" parent="CanvasLayer" unique_id=1876455502]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 23.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "COINS:"
|
||||
script = ExtResource("3_wse8f")
|
||||
|
||||
[node name="Player2D" parent="." unique_id=889851478 instance=ExtResource("1_aqk2v")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(55, 59)
|
||||
@@ -100,3 +76,27 @@ position = Vector2(166, 200)
|
||||
|
||||
[node name="VerticalLongBlock" parent="ZoeLevel" unique_id=1984351408 instance=ExtResource("4_pkg7o")]
|
||||
position = Vector2(250, 141)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1637221343]
|
||||
|
||||
[node name="RichTextLabel2" type="RichTextLabel" parent="CanvasLayer" unique_id=1254950785]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "FPS:"
|
||||
script = ExtResource("2_dwbse")
|
||||
|
||||
[node name="RichTextLabel3" type="RichTextLabel" parent="CanvasLayer" unique_id=63830958]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 23.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
bbcode_enabled = true
|
||||
text = "COINS:"
|
||||
script = ExtResource("3_wse8f")
|
||||
Reference in new issue
Block a user