Initial commit
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
||||
1
assets/icon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||
|
After Width: | Height: | Size: 994 B |
37
assets/icon.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ddd236iwmyh0r"
|
||||
path="res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.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
|
||||
BIN
assets/sprites/coin.png
Normal file
|
After Width: | Height: | Size: 500 B |
34
assets/sprites/coin.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7ih10d2jkw4j"
|
||||
path="res://.godot/imported/coin.png-c8309bf0f8fb5f3a7d1e96a4eb3f02ce.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/coin.png"
|
||||
dest_files=["res://.godot/imported/coin.png-c8309bf0f8fb5f3a7d1e96a4eb3f02ce.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
|
||||
BIN
assets/sprites/fruit.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
34
assets/sprites/fruit.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxef30sq7ss80"
|
||||
path="res://.godot/imported/fruit.png-3735163b668af10c2b35b52cba81b68a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/fruit.png"
|
||||
dest_files=["res://.godot/imported/fruit.png-3735163b668af10c2b35b52cba81b68a.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
|
||||
BIN
assets/sprites/knight.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
34
assets/sprites/knight.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bhtcgxo1b0g5p"
|
||||
path="res://.godot/imported/knight.png-7c67c83d34932624952797d9e971a644.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/knight.png"
|
||||
dest_files=["res://.godot/imported/knight.png-7c67c83d34932624952797d9e971a644.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
|
||||
BIN
assets/sprites/platforms.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
34
assets/sprites/platforms.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bjl7pb5j1sf53"
|
||||
path="res://.godot/imported/platforms.png-3869606db457611ed4193d705dc364e4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/platforms.png"
|
||||
dest_files=["res://.godot/imported/platforms.png-3869606db457611ed4193d705dc364e4.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
|
||||
BIN
assets/sprites/slime_green.png
Normal file
|
After Width: | Height: | Size: 908 B |
34
assets/sprites/slime_green.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bk0e7mjynbqvp"
|
||||
path="res://.godot/imported/slime_green.png-f6349164bf3a0f5189bb927b97af9c58.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/slime_green.png"
|
||||
dest_files=["res://.godot/imported/slime_green.png-f6349164bf3a0f5189bb927b97af9c58.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
|
||||
BIN
assets/sprites/slime_purple.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
34
assets/sprites/slime_purple.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://rnvuj4biex3x"
|
||||
path="res://.godot/imported/slime_purple.png-26dc5ddef235ce6a400e78e0d532b050.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/slime_purple.png"
|
||||
dest_files=["res://.godot/imported/slime_purple.png-26dc5ddef235ce6a400e78e0d532b050.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
|
||||
BIN
assets/sprites/world_tileset.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
34
assets/sprites/world_tileset.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dlbpt0qh2p20n"
|
||||
path="res://.godot/imported/world_tileset.png-61a32465f33c3d9d3bfecb75b6485009.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/world_tileset.png"
|
||||
dest_files=["res://.godot/imported/world_tileset.png-61a32465f33c3d9d3bfecb75b6485009.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
|
||||
25
project.godot
Normal file
@@ -0,0 +1,25 @@
|
||||
; 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="schmudel_jump"
|
||||
run/main_scene="uid://df7ey4cfprjit"
|
||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
||||
config/icon="res://assets/icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=720
|
||||
window/size/viewport_height=1080
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
8
scenes/killzone.tscn
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bvnjq1jbeabd4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dlx37dl8br661" path="res://scripts/killzone.gd" id="1_xlapc"]
|
||||
|
||||
[node name="Killzone" type="Area2D"]
|
||||
script = ExtResource("1_xlapc")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
27
scenes/level.tscn
Normal file
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://df7ey4cfprjit"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://07yvalnsoex7" path="res://scenes/player.tscn" id="1_2q6dc"]
|
||||
[ext_resource type="Script" uid="uid://bpuudy2mj7fjd" path="res://scripts/platform_handler.gd" id="1_w7c3h"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvnjq1jbeabd4" path="res://scenes/killzone.tscn" id="3_w8frs"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mx8sn"]
|
||||
size = Vector2(877, 113)
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
|
||||
[node name="PlatformHandler" type="Node" parent="."]
|
||||
script = ExtResource("1_w7c3h")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
anchor_mode = 0
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_2q6dc")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(215, 854)
|
||||
|
||||
[node name="Killzone" parent="." instance=ExtResource("3_w8frs")]
|
||||
position = Vector2(228, 1267)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Killzone"]
|
||||
position = Vector2(154, -5)
|
||||
shape = SubResource("RectangleShape2D_mx8sn")
|
||||
15
scenes/level.tscn4204592114.tmp
Normal file
@@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://df7ey4cfprjit"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://07yvalnsoex7" path="res://scenes/player.tscn" id="1_2q6dc"]
|
||||
[ext_resource type="Script" uid="uid://bpuudy2mj7fjd" path="res://scripts/platform_handler.gd" id="1_w7c3h"]
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
|
||||
[node name="PlatformHandler" type="Node" parent="."]
|
||||
script = ExtResource("1_w7c3h")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
anchor_mode = 0
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_2q6dc")]
|
||||
position = Vector2(354, 464)
|
||||
15
scenes/level.tscn4212059997.tmp
Normal file
@@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://df7ey4cfprjit"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://07yvalnsoex7" path="res://scenes/player.tscn" id="1_2q6dc"]
|
||||
[ext_resource type="Script" uid="uid://bpuudy2mj7fjd" path="res://scripts/platform_handler.gd" id="1_w7c3h"]
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
|
||||
[node name="PlatformHandler" type="Node" parent="."]
|
||||
script = ExtResource("1_w7c3h")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
anchor_mode = 0
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_2q6dc")]
|
||||
position = Vector2(354, 464)
|
||||
11
scenes/platform.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends AnimatableBody2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
scenes/platform.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7trtklxye7up
|
||||
22
scenes/platform.tscn
Normal file
@@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://0851lly0y3wb"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bjl7pb5j1sf53" path="res://assets/sprites/platforms.png" id="1_ba0x2"]
|
||||
[ext_resource type="Script" uid="uid://7trtklxye7up" path="res://scenes/platform.gd" id="1_nlgqw"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ba0x2"]
|
||||
size = Vector2(32, 9.05475)
|
||||
|
||||
[node name="Platform" type="AnimatableBody2D"]
|
||||
scale = Vector2(2, 2)
|
||||
script = ExtResource("1_nlgqw")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -4.5)
|
||||
texture = ExtResource("1_ba0x2")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(16, 0, 32, 9)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4.44167)
|
||||
shape = SubResource("RectangleShape2D_ba0x2")
|
||||
one_way_collision = true
|
||||
18
scenes/player.tscn
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://07yvalnsoex7"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ddd236iwmyh0r" path="res://assets/icon.svg" id="1_3vyb7"]
|
||||
[ext_resource type="Script" uid="uid://bgahsyy7gxau4" path="res://scripts/player.gd" id="1_g2els"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_g2els"]
|
||||
size = Vector2(128, 128)
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
z_index = 5
|
||||
scale = Vector2(0.2, 0.2)
|
||||
script = ExtResource("1_g2els")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_3vyb7")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_g2els")
|
||||
15
scripts/killzone.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
get_tree().reload_current_scene()
|
||||
1
scripts/killzone.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dlx37dl8br661
|
||||
49
scripts/platform_handler.gd
Normal file
@@ -0,0 +1,49 @@
|
||||
extends Node
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var PlatformScene := preload("res://scenes/platform.tscn")
|
||||
var platforms := []
|
||||
var dead = false
|
||||
@onready var height: float = get_viewport().size.y
|
||||
@onready var width: float = get_viewport().size.x
|
||||
@onready var player: CharacterBody2D = %Player
|
||||
const N = 10
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
for i in range(N):
|
||||
var y = i * height / N
|
||||
# TODO: don't place platforms where others exist already
|
||||
place_platform(y)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var move = 0
|
||||
if player.position.y < height/2 and not dead:
|
||||
move = height/2 - player.position.y
|
||||
player.position.y = height/2
|
||||
elif player.position.y > height or dead:
|
||||
dead = true
|
||||
move = -40
|
||||
player.position.y -= 100/2.87
|
||||
|
||||
|
||||
|
||||
for platform in platforms:
|
||||
platform.position.y += move
|
||||
if platform.position.y > height + platform.get_node("Sprite2D").texture.get_height():
|
||||
platform.position = Vector2(rng.randf_range(0, width), 0)
|
||||
|
||||
|
||||
|
||||
|
||||
func place_platform(y: float = 0) -> void:
|
||||
var platform_instance = PlatformScene.instantiate()
|
||||
var x = rng.randf_range(0, width)
|
||||
platform_instance.position = Vector2(x, y)
|
||||
add_child(platform_instance)
|
||||
platforms.append(platform_instance)
|
||||
1
scripts/platform_handler.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bpuudy2mj7fjd
|
||||
33
scripts/player.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -800.0
|
||||
|
||||
var width
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
width = get_viewport().size.x
|
||||
velocity.y = JUMP_VELOCITY * 2
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
else:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var direction := Input.get_axis("ui_left", "ui_right")
|
||||
if direction:
|
||||
velocity.x = direction * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
if position.x > width:
|
||||
position.x -= width
|
||||
elif position.x < 0:
|
||||
position.x += width
|
||||
move_and_slide()
|
||||
1
scripts/player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgahsyy7gxau4
|
||||