adding 2d platform example
2
examples/PlatformTemplate/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
2
examples/PlatformTemplate/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
BIN
examples/PlatformTemplate/assets/Basic Tilemap.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
34
examples/PlatformTemplate/assets/Basic Tilemap.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cvq2wqwuubxpi"
|
||||||
|
path="res://.godot/imported/Basic Tilemap.png-1dbb404d7ba49a841d050dea4f83a3be.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Basic Tilemap.png"
|
||||||
|
dest_files=["res://.godot/imported/Basic Tilemap.png-1dbb404d7ba49a841d050dea4f83a3be.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
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dtwdc3k6yby3q"
|
||||||
|
path="res://.godot/imported/Player Idle 48x48.png-337eaa3923585374f89440f00abccec2.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Player Idle/Player Idle 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/Player Idle 48x48.png-337eaa3923585374f89440f00abccec2.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
|
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b2nsy4x6du75k"
|
||||||
|
path="res://.godot/imported/Player Idle2 48x48-sheet.png-2c39850c55f7fa37e138d625a613fe6a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Player Idle/Player Idle2 48x48-sheet.png"
|
||||||
|
dest_files=["res://.godot/imported/Player Idle2 48x48-sheet.png-2c39850c55f7fa37e138d625a613fe6a.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
|
After Width: | Height: | Size: 1021 B |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dwet0pba0buvn"
|
||||||
|
path="res://.godot/imported/player jump 48x48.png-18e43dc1eb2d83ed8bd50579ed79387c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Player Jump/player jump 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/player jump 48x48.png-18e43dc1eb2d83ed8bd50579ed79387c.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
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c6lw8fwtnb42b"
|
||||||
|
path="res://.godot/imported/player land 48x48.png-7730f0c5cb93b7ec543d0e1cb7f45fa8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Player Land/player land 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/player land 48x48.png-7730f0c5cb93b7ec543d0e1cb7f45fa8.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
examples/PlatformTemplate/assets/Player Run/player run 48x48.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://2fx0fypbda7f"
|
||||||
|
path="res://.godot/imported/player run 48x48.png-6f36800eb471b5be57d9851fb3c1e9c7.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Player Run/player run 48x48.png"
|
||||||
|
dest_files=["res://.godot/imported/player run 48x48.png-6f36800eb471b5be57d9851fb3c1e9c7.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
|
1
examples/PlatformTemplate/icon.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><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 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
After Width: | Height: | Size: 950 B |
37
examples/PlatformTemplate/icon.svg.import
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dj56g8261vrog"
|
||||||
|
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
|
68
examples/PlatformTemplate/project.godot
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
; 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="PlatformTemplate"
|
||||||
|
run/main_scene="res://scenes/game.tscn"
|
||||||
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=320
|
||||||
|
window/size/viewport_height=180
|
||||||
|
window/size/window_width_override=800
|
||||||
|
window/size/window_height_override=600
|
||||||
|
window/stretch/mode="viewport"
|
||||||
|
|
||||||
|
[file_customization]
|
||||||
|
|
||||||
|
folder_colors={
|
||||||
|
"res://assets/": "green",
|
||||||
|
"res://scenes/": "purple"
|
||||||
|
}
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
runleft={
|
||||||
|
"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)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
runright={
|
||||||
|
"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)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
jump={
|
||||||
|
"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)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
push={
|
||||||
|
"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":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
blast={
|
||||||
|
"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":88,"key_label":0,"unicode":120,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
BIN
examples/PlatformTemplate/scenes/Player Idle2 48x48-sheet.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dbum1stq6n86b"
|
||||||
|
path="res://.godot/imported/Player Idle2 48x48-sheet.png-cb7e381a11297e7d8bb895bc29d966c9.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://scenes/Player Idle2 48x48-sheet.png"
|
||||||
|
dest_files=["res://.godot/imported/Player Idle2 48x48-sheet.png-cb7e381a11297e7d8bb895bc29d966c9.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
|
11
examples/PlatformTemplate/scenes/areatrigger.tscn
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dt2rusldupc6v"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/areatrigger.gd" id="1_dx3rr"]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D"]
|
||||||
|
script = ExtResource("1_dx3rr")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
[connection signal="area_exited" from="." to="." method="_on_area_exited"]
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
8
examples/PlatformTemplate/scenes/blank.tscn
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://rlf02wnv5qy0"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ceibc"]
|
||||||
|
|
||||||
|
[node name="Node2D" type="StaticBody2D"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_ceibc")
|
21
examples/PlatformTemplate/scenes/bullet.gd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
var speed = 750
|
||||||
|
|
||||||
|
func setSpeed(speedVal):
|
||||||
|
speed = speedVal
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
position += transform.x * speed * delta
|
||||||
|
|
||||||
|
func _on_Bullet_body_entered(body):
|
||||||
|
if body.is_in_group("mobs"):
|
||||||
|
body.queue_free()
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body):
|
||||||
|
# blast the body?
|
||||||
|
if body.is_in_group("boxes"):
|
||||||
|
body.queue_free()
|
||||||
|
queue_free()
|
15
examples/PlatformTemplate/scenes/bullet.tscn
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://xwd8bdam816x"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/bullet.gd" id="1_oo7le"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_cirwx"]
|
||||||
|
radius = 4.12311
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D"]
|
||||||
|
script = ExtResource("1_oo7le")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_cirwx")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
291
examples/PlatformTemplate/scenes/game.tscn
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
[gd_scene load_steps=17 format=3 uid="uid://btr1v6mjh6q7a"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c00dlfcxocli4" path="res://scenes/player.tscn" id="1_7jlej"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_tonux"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cvq2wqwuubxpi" path="res://assets/Basic Tilemap.png" id="2_uv2vm"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://rlf02wnv5qy0" path="res://scenes/blank.tscn" id="3_qlpj2"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dhxfhran2kbej" path="res://scenes/rigidbody.tscn" id="4_kdau4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dt2rusldupc6v" path="res://scenes/areatrigger.tscn" id="5_7b553"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://xwd8bdam816x" path="res://scenes/bullet.tscn" id="7_djmta"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b4ne0ie30580r" path="res://scenes/platform.tscn" id="8_ciwq4"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gwkyc"]
|
||||||
|
texture = ExtResource("2_uv2vm")
|
||||||
|
0:0/0 = 0
|
||||||
|
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:0/0 = 0
|
||||||
|
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:0/0 = 0
|
||||||
|
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:0/0 = 0
|
||||||
|
3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:1/0 = 0
|
||||||
|
1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:2/0 = 0
|
||||||
|
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:2/0 = 0
|
||||||
|
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:2/0 = 0
|
||||||
|
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0 = 0
|
||||||
|
3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:3/0 = 0
|
||||||
|
0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:3/0 = 0
|
||||||
|
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:3/0 = 0
|
||||||
|
2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:3/0 = 0
|
||||||
|
3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:4/0 = 0
|
||||||
|
0:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:4/0 = 0
|
||||||
|
1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:4/0 = 0
|
||||||
|
2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:4/0 = 0
|
||||||
|
3:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:4/0 = 0
|
||||||
|
4:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:4/0 = 0
|
||||||
|
5:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
0:5/0 = 0
|
||||||
|
0:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:5/0 = 0
|
||||||
|
1:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:5/0 = 0
|
||||||
|
2:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:5/0 = 0
|
||||||
|
3:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:5/0 = 0
|
||||||
|
4:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:5/0 = 0
|
||||||
|
5:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:5/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:6/0 = 0
|
||||||
|
0:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:6/0 = 0
|
||||||
|
1:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:6/0 = 0
|
||||||
|
2:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:6/0 = 0
|
||||||
|
3:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:6/0 = 0
|
||||||
|
4:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:6/0 = 0
|
||||||
|
5:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:6/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:7/0 = 0
|
||||||
|
0:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:7/0 = 0
|
||||||
|
1:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:7/0 = 0
|
||||||
|
2:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:7/0 = 0
|
||||||
|
3:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:7/0 = 0
|
||||||
|
4:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:7/0 = 0
|
||||||
|
5:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:7/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:8/0 = 0
|
||||||
|
0:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:8/0 = 0
|
||||||
|
1:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:8/0 = 0
|
||||||
|
2:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:8/0 = 0
|
||||||
|
3:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:8/0 = 0
|
||||||
|
4:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:8/0 = 0
|
||||||
|
5:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:8/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:9/0 = 0
|
||||||
|
0:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:9/0 = 0
|
||||||
|
1:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:9/0 = 0
|
||||||
|
2:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:9/0 = 0
|
||||||
|
3:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:9/0 = 0
|
||||||
|
4:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:9/0 = 0
|
||||||
|
5:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:9/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_66kjy"]
|
||||||
|
physics_layer_0/collision_layer = 1
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_gwkyc")
|
||||||
|
|
||||||
|
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ycvkv"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_7wahi"]
|
||||||
|
radius = 26.1725
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wkkpi"]
|
||||||
|
size = Vector2(47, 20)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_sy75i"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(258, 94)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_dn2lq"]
|
||||||
|
resource_name = "moveplatform"
|
||||||
|
loop_mode = 2
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(258, 94), Vector2(295, 94)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_potwp"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_sy75i"),
|
||||||
|
"moveplatform": SubResource("Animation_dn2lq")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="game" type="Node2D"]
|
||||||
|
script = ExtResource("1_tonux")
|
||||||
|
|
||||||
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
|
position = Vector2(28, -10)
|
||||||
|
tile_set = SubResource("TileSet_66kjy")
|
||||||
|
format = 2
|
||||||
|
layer_0/tile_data = PackedInt32Array(524298, 0, 4, 524299, 0, 4, 524300, 0, 4, 524301, 0, 4, 524302, 0, 4, 524303, 0, 4, 786435, 0, 4, 786436, 0, 4, 786437, 0, 4, 786438, 0, 4, 786439, 0, 4, 786440, 0, 4, 786441, 0, 4, 786442, 0, 4, 786443, 0, 4, 786444, 0, 4, 786445, 0, 4, 786446, 0, 4, 720907, 0, 4, 720908, 0, 4, 720909, 0, 4, 720910, 0, 4, 720902, 0, 4, 720903, 0, 4, 720904, 0, 4, 786447, 65536, 4, 786448, 65536, 4, 786449, 65536, 4, 786450, 65536, 4, 786451, 65536, 4, 786452, 65536, 4, 786453, 65536, 4, 655380, 65536, 4, 655381, 65536, 4, 655382, 65536, 4, 458775, 65536, 4, 655385, 65536, 4, 655386, 65536, 4, 655387, 65536, 4, 655388, 65536, 4, 786456, 65536, 4)
|
||||||
|
|
||||||
|
[node name="player" parent="." instance=ExtResource("1_7jlej")]
|
||||||
|
position = Vector2(166, 144)
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="player"]
|
||||||
|
position = Vector2(0, 8)
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
position = Vector2(7, 11)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
position = Vector2(0, 173)
|
||||||
|
shape = SubResource("WorldBoundaryShape2D_ycvkv")
|
||||||
|
|
||||||
|
[node name="Node2D" parent="." instance=ExtResource("3_qlpj2")]
|
||||||
|
position = Vector2(232, 151)
|
||||||
|
|
||||||
|
[node name="RigidBody2D" parent="." groups=["boxes"] instance=ExtResource("4_kdau4")]
|
||||||
|
position = Vector2(133, 135)
|
||||||
|
|
||||||
|
[node name="RigidBody2D2" parent="." groups=["boxes"] instance=ExtResource("4_kdau4")]
|
||||||
|
position = Vector2(226, 18)
|
||||||
|
rotation = 0.634724
|
||||||
|
|
||||||
|
[node name="TriggerOne" parent="." instance=ExtResource("5_7b553")]
|
||||||
|
position = Vector2(357, 122)
|
||||||
|
effect = "unlock"
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerOne"]
|
||||||
|
shape = SubResource("CircleShape2D_7wahi")
|
||||||
|
debug_color = Color(0.6, 0.384314, 0.972549, 0.419608)
|
||||||
|
|
||||||
|
[node name="TriggerOne2" parent="." instance=ExtResource("5_7b553")]
|
||||||
|
position = Vector2(465, 138)
|
||||||
|
effect = "boxdrop"
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerOne2"]
|
||||||
|
position = Vector2(-0.5, 0)
|
||||||
|
shape = SubResource("RectangleShape2D_wkkpi")
|
||||||
|
debug_color = Color(0.631373, 0.364706, 0.968627, 0.419608)
|
||||||
|
|
||||||
|
[node name="Area2D" parent="." instance=ExtResource("7_djmta")]
|
||||||
|
position = Vector2(88, 153)
|
||||||
|
|
||||||
|
[node name="AnimatableBody2D" parent="." instance=ExtResource("8_ciwq4")]
|
||||||
|
position = Vector2(258, 94)
|
||||||
|
|
||||||
|
[node name="AnimationPlayer2" type="AnimationPlayer" parent="AnimatableBody2D"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_potwp")
|
||||||
|
}
|
||||||
|
autoplay = "moveplatform"
|
||||||
|
|
||||||
|
[connection signal="areatrigger" from="TriggerOne" to="." method="_on_trigger_one_areatrigger"]
|
||||||
|
[connection signal="areatrigger" from="TriggerOne2" to="." method="_on_trigger_one_areatrigger"]
|
11
examples/PlatformTemplate/scenes/platform.tscn
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://b4ne0ie30580r"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ek45w"]
|
||||||
|
size = Vector2(85.5, 13)
|
||||||
|
|
||||||
|
[node name="AnimatableBody2D" type="AnimatableBody2D"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0, 1)
|
||||||
|
shape = SubResource("RectangleShape2D_ek45w")
|
||||||
|
one_way_collision = true
|
206
examples/PlatformTemplate/scenes/player.tscn
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
[gd_scene load_steps=28 format=3 uid="uid://c00dlfcxocli4"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/playermovement.gd" id="1_rrp5c"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b2nsy4x6du75k" path="res://assets/Player Idle/Player Idle2 48x48-sheet.png" id="2_lr1nb"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dwet0pba0buvn" path="res://assets/Player Jump/player jump 48x48.png" id="3_8nqpn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://2fx0fypbda7f" path="res://assets/Player Run/player run 48x48.png" id="3_pduqe"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_v3hls"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3k3pl"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s5bpa"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_y8ggy"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qtbxx"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dtyki"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ffign"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_g2qw3"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_y5klf"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(384, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vka0u"]
|
||||||
|
atlas = ExtResource("2_lr1nb")
|
||||||
|
region = Rect2(432, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_r2358"]
|
||||||
|
atlas = ExtResource("3_8nqpn")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mjgsl"]
|
||||||
|
atlas = ExtResource("3_8nqpn")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lvng6"]
|
||||||
|
atlas = ExtResource("3_8nqpn")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dsono"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(0, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_g1606"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(48, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_g22wv"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(96, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_eolqe"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(144, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0t01r"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(192, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ouhby"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(240, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_a6ukc"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(288, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_d4v3u"]
|
||||||
|
atlas = ExtResource("3_pduqe")
|
||||||
|
region = Rect2(336, 0, 48, 48)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_5iuqe"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_v3hls")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_3k3pl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_s5bpa")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_y8ggy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_qtbxx")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dtyki")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ffign")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_g2qw3")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_y5klf")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vka0u")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 10.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_r2358")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_mjgsl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lvng6")
|
||||||
|
}],
|
||||||
|
"loop": false,
|
||||||
|
"name": &"jump",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dsono")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_g1606")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_g22wv")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_eolqe")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0t01r")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ouhby")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_a6ukc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_d4v3u")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"run",
|
||||||
|
"speed": 10.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_8lwox"]
|
||||||
|
|
||||||
|
[node name="CharacterBody2D" type="CharacterBody2D"]
|
||||||
|
script = ExtResource("1_rrp5c")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
sprite_frames = SubResource("SpriteFrames_5iuqe")
|
||||||
|
animation = &"idle"
|
||||||
|
autoplay = "idle"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0, 7)
|
||||||
|
shape = SubResource("CircleShape2D_8lwox")
|
||||||
|
|
||||||
|
[node name="RightRaycast" type="RayCast2D" parent="."]
|
||||||
|
target_position = Vector2(20, 0)
|
||||||
|
|
||||||
|
[node name="LeftRaycast" type="RayCast2D" parent="."]
|
||||||
|
target_position = Vector2(-20, 0)
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
offset_left = -19.0
|
||||||
|
offset_top = -30.0
|
||||||
|
offset_right = 21.0
|
||||||
|
offset_bottom = -14.0
|
||||||
|
theme_override_font_sizes/font_size = 11
|
||||||
|
text = "Idle"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="MarkerRight" type="Node2D" parent="."]
|
||||||
|
position = Vector2(10, -2)
|
||||||
|
|
||||||
|
[node name="MarkerLeft" type="Node2D" parent="."]
|
||||||
|
position = Vector2(-11, -1)
|
10
examples/PlatformTemplate/scenes/rigidbody.tscn
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dhxfhran2kbej"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3bag"]
|
||||||
|
|
||||||
|
[node name="RigidBody2D" type="RigidBody2D"]
|
||||||
|
mass = 2.0
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_i3bag")
|
||||||
|
debug_color = Color(0.756863, 0.447059, 0.25098, 0.419608)
|
20
examples/PlatformTemplate/scripts/areatrigger.gd
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
@export var effect = "alert"
|
||||||
|
signal areatrigger(effect, Object)
|
||||||
|
|
||||||
|
func _on_area_entered(area):
|
||||||
|
print("area entered")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_exited(area):
|
||||||
|
print("area exited")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body):
|
||||||
|
print("body entered")
|
||||||
|
areatrigger.emit(effect, body)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_exited(body):
|
||||||
|
print("body exited")
|
32
examples/PlatformTemplate/scripts/gamecontroller.gd
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
# call downward, signal upward
|
||||||
|
@onready var block = $Node2D
|
||||||
|
var boxInstance = preload("res://scenes/rigidbody.tscn")
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_trigger_one_areatrigger(effect, body):
|
||||||
|
match effect:
|
||||||
|
"unlock":
|
||||||
|
if !body.is_in_group("boxes"):
|
||||||
|
if is_instance_valid(block):
|
||||||
|
block.queue_free()
|
||||||
|
"boxdrop":
|
||||||
|
# make some boxes
|
||||||
|
# ensure boxes do not trigger trap!
|
||||||
|
if!body.is_in_group("boxes"):
|
||||||
|
for n in 3:
|
||||||
|
var mybox = boxInstance.instantiate()
|
||||||
|
mybox.add_to_group("boxes")
|
||||||
|
mybox.position = Vector2(465,23)
|
||||||
|
add_child(mybox)
|
||||||
|
|
97
examples/PlatformTemplate/scripts/playermovement.gd
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
const SPEED = 200.0
|
||||||
|
const JUMP_VELOCITY = -300.0
|
||||||
|
const PUSH_FORCE = 80.0
|
||||||
|
const BLAST_SPEED = 750
|
||||||
|
|
||||||
|
var pushLeftEnabled = false
|
||||||
|
var pushRightEnabled = false
|
||||||
|
var pushTarget
|
||||||
|
var faceLeft = false
|
||||||
|
|
||||||
|
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||||
|
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
|
@onready var animated_sprite = $AnimatedSprite2D
|
||||||
|
@onready var rightRay = $RightRaycast
|
||||||
|
@onready var leftRay = $LeftRaycast
|
||||||
|
@onready var label = $Label
|
||||||
|
@onready var markerRight = $MarkerRight
|
||||||
|
@onready var markerLeft = $MarkerLeft
|
||||||
|
|
||||||
|
var bullet = preload("res://scenes/bullet.tscn")
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
# Add the gravity.
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity.y += gravity * delta
|
||||||
|
|
||||||
|
# Handle jump.
|
||||||
|
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||||
|
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("runleft", "runright")
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("push") && pushRightEnabled && faceLeft == false:
|
||||||
|
label.text="shove"
|
||||||
|
pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE * 20)
|
||||||
|
pushRightEnabled = false
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("push") && pushLeftEnabled :
|
||||||
|
label.text="shove"
|
||||||
|
pushTarget.apply_central_impulse(Vector2(-1,0) * PUSH_FORCE * 20)
|
||||||
|
pushLeftEnabled = false
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("blast"):
|
||||||
|
var mybullet = bullet.instantiate()
|
||||||
|
mybullet.setSpeed(-BLAST_SPEED if faceLeft else BLAST_SPEED)
|
||||||
|
owner.add_child(mybullet)
|
||||||
|
mybullet.transform = markerLeft.global_transform if faceLeft else markerRight.global_transform
|
||||||
|
|
||||||
|
if direction:
|
||||||
|
velocity.x = direction * SPEED
|
||||||
|
faceLeft = true if direction<0 else false
|
||||||
|
animated_sprite.flip_h = true if direction < 0 else false
|
||||||
|
else:
|
||||||
|
# slow the character to a stop
|
||||||
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
|
if is_on_floor():
|
||||||
|
if direction==0:
|
||||||
|
label.text="idle"
|
||||||
|
animated_sprite.play("idle")
|
||||||
|
else:
|
||||||
|
label.text="run"
|
||||||
|
animated_sprite.play("run")
|
||||||
|
else:
|
||||||
|
label.text="jump"
|
||||||
|
animated_sprite.play("jump")
|
||||||
|
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
|
# Detect colliders in the ray
|
||||||
|
if rightRay.is_colliding():
|
||||||
|
var collider = rightRay.get_collider()
|
||||||
|
if collider is Node:
|
||||||
|
if collider.is_in_group("boxes"):
|
||||||
|
pushRightEnabled = true
|
||||||
|
pushTarget = collider
|
||||||
|
else:
|
||||||
|
pushRightEnabled = false
|
||||||
|
if leftRay.is_colliding():
|
||||||
|
var collider = leftRay.get_collider()
|
||||||
|
if collider is Node:
|
||||||
|
if collider.is_in_group("boxes"):
|
||||||
|
pushLeftEnabled = true
|
||||||
|
pushTarget = collider
|
||||||
|
else:
|
||||||
|
pushLeftEnabled = false
|
||||||
|
|
||||||
|
# This represents the player's inertia
|
||||||
|
# after calling move_and_slide()
|
||||||
|
for i in get_slide_collision_count():
|
||||||
|
var c = get_slide_collision(i)
|
||||||
|
if c.get_collider() is RigidBody2D:
|
||||||
|
c.get_collider().apply_central_impulse(-c.get_normal() * PUSH_FORCE)
|