Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
023845b0dd | ||
|
|
c0180d20d1 | ||
|
|
edee4413e3 | ||
|
|
3a23fdbe6a | ||
|
|
c8bb3b874a | ||
|
|
c8f0706055 | ||
|
|
ccc4354331 | ||
|
|
1849640ff8 | ||
|
|
3ae7f01a23 | ||
|
|
690dd395fd | ||
|
|
f85f8b2b4d | ||
|
|
7ddaf29f8d | ||
|
|
b626d3e628 | ||
|
|
a39928fc55 | ||
|
|
9e68af38d9 | ||
|
|
4357b5b620 | ||
|
|
24519e58a8 | ||
|
|
219e37b592 | ||
|
|
fe6f646c9d | ||
|
|
06bdeb97dc | ||
|
|
b1f9f2da48 | ||
|
|
d7c7e4ede3 | ||
|
|
0550497e60 | ||
|
|
5c13d21260 | ||
|
|
2f60828e6e | ||
|
|
61d9e0f1ab | ||
|
|
cd72b05a7d | ||
|
|
69758f2523 |
@@ -9,7 +9,7 @@ in the documentation for more information.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Vulkan Mobile
|
||||
Renderer: GLES 2
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/887
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bcoiuym4nw1ua"
|
||||
path="res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://bullet.png"
|
||||
dest_files=["res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.ctex"]
|
||||
dest_files=[ "res://.import/bullet.png-ff1424653e10246c11e3724e402c519e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -10,7 +10,7 @@ const SPEED_MAX = 80
|
||||
|
||||
const bullet_image = preload("res://bullet.png")
|
||||
|
||||
var bullets := []
|
||||
var bullets = []
|
||||
var shape
|
||||
|
||||
|
||||
@@ -24,37 +24,41 @@ class Bullet:
|
||||
|
||||
|
||||
func _ready():
|
||||
shape = PhysicsServer2D.circle_shape_create()
|
||||
randomize()
|
||||
|
||||
shape = Physics2DServer.circle_shape_create()
|
||||
# Set the collision shape's radius for each bullet in pixels.
|
||||
PhysicsServer2D.shape_set_data(shape, 8)
|
||||
Physics2DServer.shape_set_data(shape, 8)
|
||||
|
||||
for _i in BULLET_COUNT:
|
||||
var bullet = Bullet.new()
|
||||
# Give each bullet its own random speed.
|
||||
bullet.speed = randf_range(SPEED_MIN, SPEED_MAX)
|
||||
bullet.body = PhysicsServer2D.body_create()
|
||||
# Give each bullet its own speed.
|
||||
bullet.speed = rand_range(SPEED_MIN, SPEED_MAX)
|
||||
bullet.body = Physics2DServer.body_create()
|
||||
|
||||
PhysicsServer2D.body_set_space(bullet.body, get_world_2d().get_space())
|
||||
PhysicsServer2D.body_add_shape(bullet.body, shape)
|
||||
Physics2DServer.body_set_space(bullet.body, get_world_2d().get_space())
|
||||
Physics2DServer.body_add_shape(bullet.body, shape)
|
||||
# Don't make bullets check collision with other bullets to improve performance.
|
||||
PhysicsServer2D.body_set_collision_mask(bullet.body, 0)
|
||||
# Their collision mask is still configured to the default value, which allows
|
||||
# bullets to detect collisions with the player.
|
||||
Physics2DServer.body_set_collision_layer(bullet.body, 0)
|
||||
|
||||
# Place bullets randomly on the viewport and move bullets outside the
|
||||
# play area so that they fade in nicely.
|
||||
bullet.position = Vector2(
|
||||
randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
|
||||
randf_range(0, get_viewport_rect().size.y)
|
||||
rand_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
|
||||
rand_range(0, get_viewport_rect().size.y)
|
||||
)
|
||||
var transform2d = Transform2D()
|
||||
transform2d.origin = bullet.position
|
||||
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
|
||||
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
|
||||
|
||||
bullets.push_back(bullet)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
# Order the CanvasItem to update every frame.
|
||||
queue_redraw()
|
||||
update()
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
@@ -64,11 +68,12 @@ func _physics_process(delta):
|
||||
bullet.position.x -= bullet.speed * delta
|
||||
|
||||
if bullet.position.x < -16:
|
||||
# Move the bullet back to the right when it left the screen.
|
||||
# The bullet has left the screen; move it back to the right.
|
||||
bullet.position.x = offset
|
||||
|
||||
transform2d.origin = bullet.position
|
||||
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
|
||||
|
||||
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
|
||||
|
||||
|
||||
# Instead of drawing each bullet individually in a script attached to each bullet,
|
||||
@@ -82,7 +87,7 @@ func _draw():
|
||||
# Perform cleanup operations (required to exit without error messages in the console).
|
||||
func _exit_tree():
|
||||
for bullet in bullets:
|
||||
PhysicsServer2D.free_rid(bullet.body)
|
||||
Physics2DServer.free_rid(bullet.body)
|
||||
|
||||
PhysicsServer2D.free_rid(shape)
|
||||
Physics2DServer.free_rid(shape)
|
||||
bullets.clear()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d3u7k0742d5ug"
|
||||
path="res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d80.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://face_happy.png"
|
||||
dest_files=["res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d80.ctex"]
|
||||
dest_files=[ "res://.import/face_happy.png-38d387d31ec13459f749c93ce3d75d80.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8j32onnr4qo3"
|
||||
path="res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://face_sad.png"
|
||||
dest_files=["res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550.ctex"]
|
||||
dest_files=[ "res://.import/face_sad.png-0ac7165eab24f595aba17a746a66c550.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c8w03v671qh3y"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -7,7 +7,7 @@ extends Node2D
|
||||
# The number of bullets currently touched by the player.
|
||||
var touching = 0
|
||||
|
||||
@onready var sprite = $AnimatedSprite2D
|
||||
onready var sprite = $AnimatedSprite
|
||||
|
||||
|
||||
func _ready():
|
||||
@@ -17,13 +17,11 @@ func _ready():
|
||||
|
||||
|
||||
func _input(event):
|
||||
# Getting the movement of the mouse so the sprite can follow its position.
|
||||
if event is InputEventMouseMotion:
|
||||
position = event.position - Vector2(0, 16)
|
||||
|
||||
|
||||
func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
|
||||
# Player got touched by a bullet so sprite changes to sad face.
|
||||
touching += 1
|
||||
if touching >= 1:
|
||||
sprite.frame = 1
|
||||
@@ -31,7 +29,5 @@ func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
|
||||
|
||||
func _on_body_shape_exited(_body_id, _body, _body_shape, _local_shape):
|
||||
touching -= 1
|
||||
# When non of the bullets are touching the player,
|
||||
# sprite changes to happy face.
|
||||
if touching == 0:
|
||||
sprite.frame = 0
|
||||
|
||||
@@ -6,32 +6,35 @@
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[]
|
||||
_global_script_class_icons={}
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Bullet Shower"
|
||||
config/description="Demonstrates how to manage large amounts of objects efficiently using low-level Servers."
|
||||
run/main_scene="res://shower.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/stretch/mode="canvas_items"
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="Player"
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
2d/cell_size=64
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="mobile"
|
||||
quality/driver/driver_name="GLES2"
|
||||
quality/intended_usage/framebuffer_allocation=0
|
||||
quality/intended_usage/framebuffer_allocation.mobile=0
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
environment/default_clear_color=Color( 0.133333, 0.133333, 0.2, 1 )
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c78by7hc4fmwx"]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://bullets.gd" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3u7k0742d5ug" path="res://face_happy.png" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://8j32onnr4qo3" path="res://face_sad.png" id="4"]
|
||||
[ext_resource type="Script" path="res://player.gd" id="5"]
|
||||
[ext_resource path="res://bullets.gd" type="Script" id=2]
|
||||
[ext_resource path="res://face_happy.png" type="Texture" id=3]
|
||||
[ext_resource path="res://face_sad.png" type="Texture" id=4]
|
||||
[ext_resource path="res://player.gd" type="Script" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="1"]
|
||||
animations = [{
|
||||
"frames": [ExtResource("3"), ExtResource("4")],
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
} ]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="2"]
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 27.0
|
||||
|
||||
[node name="Shower" type="Node2D"]
|
||||
|
||||
[node name="Bullets" type="Node2D" parent="."]
|
||||
script = ExtResource("2")
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Player" type="Area2D" parent="."]
|
||||
script = ExtResource("5")
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Player"]
|
||||
frames = SubResource("1")
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
|
||||
frames = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
||||
shape = SubResource("2")
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="body_shape_entered" from="Player" to="Player" method="_on_body_shape_entered"]
|
||||
[connection signal="body_shape_exited" from="Player" to="Player" method="_on_body_shape_exited"]
|
||||
|
||||
@@ -2,6 +2,7 @@ extends CanvasLayer
|
||||
|
||||
signal start_game
|
||||
|
||||
|
||||
func show_message(text):
|
||||
$MessageLabel.text = text
|
||||
$MessageLabel.show()
|
||||
@@ -10,10 +11,10 @@ func show_message(text):
|
||||
|
||||
func show_game_over():
|
||||
show_message("Game Over")
|
||||
await $MessageTimer.timeout
|
||||
yield($MessageTimer, "timeout")
|
||||
$MessageLabel.text = "Dodge the\nCreeps"
|
||||
$MessageLabel.show()
|
||||
await get_tree().create_timer(1).timeout
|
||||
yield(get_tree().create_timer(1), "timeout")
|
||||
$StartButton.show()
|
||||
|
||||
|
||||
@@ -23,7 +24,7 @@ func update_score(score):
|
||||
|
||||
func _on_StartButton_pressed():
|
||||
$StartButton.hide()
|
||||
start_game.emit()
|
||||
emit_signal("start_game")
|
||||
|
||||
|
||||
func _on_MessageTimer_timeout():
|
||||
|
||||
@@ -1,54 +1,58 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ccqoreueuxdb7"]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://HUD.gd" id="1"]
|
||||
[ext_resource path="res://HUD.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="InputEventAction" id="InputEventAction_fopy7"]
|
||||
action = &"start_game"
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="Shortcut" id="4"]
|
||||
events = [SubResource("InputEventAction_fopy7")]
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="InputEventAction" id=3]
|
||||
action = "start_game"
|
||||
|
||||
[sub_resource type="ShortCut" id=4]
|
||||
shortcut = SubResource( 3 )
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource("1")
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_bottom = 78.0
|
||||
grow_horizontal = 2
|
||||
theme_override_font_sizes/font_size = 60
|
||||
margin_bottom = 78.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
align = 1
|
||||
|
||||
[node name="MessageLabel" type="Label" parent="."]
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -79.5
|
||||
offset_bottom = 79.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 60
|
||||
margin_top = -79.5
|
||||
margin_bottom = 79.5
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Dodge the
|
||||
Creeps"
|
||||
horizontal_alignment = 1
|
||||
align = 1
|
||||
|
||||
[node name="StartButton" type="Button" parent="."]
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -90.0
|
||||
offset_top = -200.0
|
||||
offset_right = 90.0
|
||||
offset_bottom = -100.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_font_sizes/font_size = 60
|
||||
shortcut = SubResource("4")
|
||||
margin_left = -90.0
|
||||
margin_top = -200.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = -100.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
shortcut = SubResource( 4 )
|
||||
text = "Start"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MessageTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
extends Node
|
||||
|
||||
@export var mob_scene: PackedScene
|
||||
export(PackedScene) var mob_scene
|
||||
var score
|
||||
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
|
||||
|
||||
func game_over():
|
||||
$ScoreTimer.stop()
|
||||
$MobTimer.stop()
|
||||
@@ -12,7 +17,7 @@ func game_over():
|
||||
|
||||
|
||||
func new_game():
|
||||
get_tree().call_group(&"mobs", &"queue_free")
|
||||
get_tree().call_group("mobs", "queue_free")
|
||||
score = 0
|
||||
$Player.start($StartPosition.position)
|
||||
$StartTimer.start()
|
||||
@@ -23,11 +28,11 @@ func new_game():
|
||||
|
||||
func _on_MobTimer_timeout():
|
||||
# Create a new instance of the Mob scene.
|
||||
var mob = mob_scene.instantiate()
|
||||
var mob = mob_scene.instance()
|
||||
|
||||
# Choose a random location on Path2D.
|
||||
var mob_spawn_location = get_node(^"MobPath/MobSpawnLocation")
|
||||
mob_spawn_location.progress = randi()
|
||||
var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
|
||||
mob_spawn_location.offset = randi()
|
||||
|
||||
# Set the mob's direction perpendicular to the path direction.
|
||||
var direction = mob_spawn_location.rotation + PI / 2
|
||||
@@ -36,16 +41,17 @@ func _on_MobTimer_timeout():
|
||||
mob.position = mob_spawn_location.position
|
||||
|
||||
# Add some randomness to the direction.
|
||||
direction += randf_range(-PI / 4, PI / 4)
|
||||
direction += rand_range(-PI / 4, PI / 4)
|
||||
mob.rotation = direction
|
||||
|
||||
# Choose the velocity for the mob.
|
||||
var velocity = Vector2(randf_range(150.0, 250.0), 0.0)
|
||||
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
|
||||
mob.linear_velocity = velocity.rotated(direction)
|
||||
|
||||
# Spawn the mob by adding it to the Main scene.
|
||||
add_child(mob)
|
||||
|
||||
|
||||
func _on_ScoreTimer_timeout():
|
||||
score += 1
|
||||
$HUD.update_score(score)
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cyfwty2q3rdse"]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://Main.gd" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://rkdnhqgf2hpj" path="res://Mob.tscn" id="2"]
|
||||
[ext_resource type="PackedScene" uid="uid://4vwrqjegqwpj" path="res://Player.tscn" id="3"]
|
||||
[ext_resource type="PackedScene" uid="uid://ccqoreueuxdb7" path="res://HUD.tscn" id="4"]
|
||||
[ext_resource type="AudioStream" uid="uid://q2pf4fr8d0ks" path="res://art/House In a Forest Loop.ogg" id="5"]
|
||||
[ext_resource type="AudioStream" uid="uid://dw26fpygeag8o" path="res://art/gameover.wav" id="6"]
|
||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://art/House In a Forest Loop.ogg" type="AudioStream" id=5]
|
||||
[ext_resource path="res://art/gameover.wav" type="AudioStream" id=6]
|
||||
|
||||
[sub_resource type="Curve2D" id="1"]
|
||||
[sub_resource type="Curve2D" id=1]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0)
|
||||
"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0 )
|
||||
}
|
||||
point_count = 5
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource("1")
|
||||
mob_scene = ExtResource("2")
|
||||
script = ExtResource( 1 )
|
||||
mob_scene = ExtResource( 2 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.219608, 0.372549, 0.380392, 1)
|
||||
color = Color( 0.219608, 0.372549, 0.380392, 1 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("3")]
|
||||
[node name="Player" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="MobTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
@@ -36,21 +32,21 @@ wait_time = 0.5
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
|
||||
[node name="StartPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(240, 450)
|
||||
[node name="StartPosition" type="Position2D" parent="."]
|
||||
position = Vector2( 240, 450 )
|
||||
|
||||
[node name="MobPath" type="Path2D" parent="."]
|
||||
curve = SubResource("1")
|
||||
curve = SubResource( 1 )
|
||||
|
||||
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("4")]
|
||||
[node name="HUD" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Music" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5")
|
||||
stream = ExtResource( 5 )
|
||||
|
||||
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6")
|
||||
stream = ExtResource( 6 )
|
||||
|
||||
[connection signal="hit" from="Player" to="." method="game_over"]
|
||||
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
extends RigidBody2D
|
||||
|
||||
|
||||
func _ready():
|
||||
$AnimatedSprite2D.play()
|
||||
var mob_types = Array($AnimatedSprite2D.sprite_frames.get_animation_names())
|
||||
$AnimatedSprite2D.animation = mob_types.pick_random()
|
||||
$AnimatedSprite.playing = true
|
||||
var mob_types = $AnimatedSprite.frames.get_animation_names()
|
||||
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
|
||||
@@ -1,49 +1,52 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://rkdnhqgf2hpj"]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://Mob.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://yqglrrsx7j1f" path="res://art/enemyFlyingAlt_1.png" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpot8awhdn6ph" path="res://art/enemyFlyingAlt_2.png" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu4221t7qpa7d" path="res://art/enemyWalking_1.png" id="4"]
|
||||
[ext_resource type="Texture2D" uid="uid://booij5t7h4efb" path="res://art/enemyWalking_2.png" id="5"]
|
||||
[ext_resource type="Texture2D" uid="uid://5lvm88ij4jqn" path="res://art/enemySwimming_1.png" id="6"]
|
||||
[ext_resource type="Texture2D" uid="uid://bng45cvsgufqc" path="res://art/enemySwimming_2.png" id="7"]
|
||||
[ext_resource path="res://Mob.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/enemyFlyingAlt_1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://art/enemyFlyingAlt_2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/enemyWalking_1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://art/enemyWalking_2.png" type="Texture" id=5]
|
||||
[ext_resource path="res://art/enemySwimming_1.png" type="Texture" id=6]
|
||||
[ext_resource path="res://art/enemySwimming_2.png" type="Texture" id=7]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="1"]
|
||||
animations = [{
|
||||
"frames": [ExtResource( "6" ), ExtResource( "7" )],
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": &"swim",
|
||||
"speed": 4.0
|
||||
}, {
|
||||
"frames": [ExtResource( "2" ), ExtResource( "3" )],
|
||||
"loop": true,
|
||||
"name": &"fly",
|
||||
"name": "fly",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [ExtResource( "4" ), ExtResource( "5" )],
|
||||
"frames": [ ExtResource( 6 ), ExtResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"name": "swim",
|
||||
"speed": 4.0
|
||||
}]
|
||||
}, {
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "walk",
|
||||
"speed": 4.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="2"]
|
||||
radius = 37.0
|
||||
height = 100.0
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 35.2706
|
||||
height = 23.3281
|
||||
|
||||
[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]]
|
||||
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( "1" )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(0.75, 0.75)
|
||||
frames = SubResource( "1" )
|
||||
animation = &"walk"
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.75, 0.75 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "walk"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
rotation = 1.5708
|
||||
shape = SubResource( "2" )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||
|
||||
@@ -2,9 +2,10 @@ extends Area2D
|
||||
|
||||
signal hit
|
||||
|
||||
@export var speed = 400 # How fast the player will move (pixels/sec).
|
||||
export var speed = 400 # How fast the player will move (pixels/sec).
|
||||
var screen_size # Size of the game window.
|
||||
|
||||
|
||||
func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
hide()
|
||||
@@ -12,31 +13,32 @@ func _ready():
|
||||
|
||||
func _process(delta):
|
||||
var velocity = Vector2.ZERO # The player's movement vector.
|
||||
if Input.is_action_pressed(&"move_right"):
|
||||
if Input.is_action_pressed("move_right"):
|
||||
velocity.x += 1
|
||||
if Input.is_action_pressed(&"move_left"):
|
||||
if Input.is_action_pressed("move_left"):
|
||||
velocity.x -= 1
|
||||
if Input.is_action_pressed(&"move_down"):
|
||||
if Input.is_action_pressed("move_down"):
|
||||
velocity.y += 1
|
||||
if Input.is_action_pressed(&"move_up"):
|
||||
if Input.is_action_pressed("move_up"):
|
||||
velocity.y -= 1
|
||||
|
||||
if velocity.length() > 0:
|
||||
velocity = velocity.normalized() * speed
|
||||
$AnimatedSprite2D.play()
|
||||
$AnimatedSprite.play()
|
||||
else:
|
||||
$AnimatedSprite2D.stop()
|
||||
$AnimatedSprite.stop()
|
||||
|
||||
position += velocity * delta
|
||||
position = position.clamp(Vector2.ZERO, screen_size)
|
||||
position.x = clamp(position.x, 0, screen_size.x)
|
||||
position.y = clamp(position.y, 0, screen_size.y)
|
||||
|
||||
if velocity.x != 0:
|
||||
$AnimatedSprite2D.animation = &"right"
|
||||
$AnimatedSprite2D.flip_v = false
|
||||
$AnimatedSprite2D.flip_h = velocity.x < 0
|
||||
$AnimatedSprite.animation = "right"
|
||||
$AnimatedSprite.flip_v = false
|
||||
$AnimatedSprite.flip_h = velocity.x < 0
|
||||
elif velocity.y != 0:
|
||||
$AnimatedSprite2D.animation = &"up"
|
||||
$AnimatedSprite2D.flip_v = velocity.y > 0
|
||||
$AnimatedSprite.animation = "up"
|
||||
$AnimatedSprite.flip_v = velocity.y > 0
|
||||
|
||||
|
||||
func start(pos):
|
||||
@@ -47,6 +49,6 @@ func start(pos):
|
||||
|
||||
func _on_Player_body_entered(_body):
|
||||
hide() # Player disappears after being hit.
|
||||
hit.emit()
|
||||
emit_signal("hit")
|
||||
# Must be deferred as we can't change physics properties on a physics callback.
|
||||
$CollisionShape2D.set_deferred(&"disabled", true)
|
||||
$CollisionShape2D.set_deferred("disabled", true)
|
||||
|
||||
@@ -1,63 +1,71 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://4vwrqjegqwpj"]
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://Player.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://ftkxr8r4qghp" path="res://art/playerGrey_walk1.png" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://couyhcegeihme" path="res://art/playerGrey_walk2.png" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4yyoafu8bi0q" path="res://art/playerGrey_up1.png" id="4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bko65a0nd66st" path="res://art/playerGrey_up2.png" id="5"]
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://art/playerGrey_walk1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://art/playerGrey_walk2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://art/playerGrey_up1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://art/playerGrey_up2.png" type="Texture" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="1"]
|
||||
animations = [{
|
||||
"frames": [ExtResource( "2" ), ExtResource( "3" )],
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": &"right",
|
||||
"name": "right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ExtResource( "4" ), ExtResource( "5" )],
|
||||
"frames": [ ExtResource( 4 ), ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": &"up",
|
||||
"name": "up",
|
||||
"speed": 5.0
|
||||
}]
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="2"]
|
||||
radius = 27.0
|
||||
height = 68.0
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 26.1701
|
||||
height = 14.822
|
||||
|
||||
[sub_resource type="Gradient" id="3"]
|
||||
colors = PackedColorArray(1, 1, 1, 0.501961, 1, 1, 1, 0)
|
||||
[sub_resource type="Gradient" id=3]
|
||||
colors = PoolColorArray( 1, 1, 1, 0.501961, 1, 1, 1, 0 )
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="4"]
|
||||
gradient = SubResource( "3" )
|
||||
[sub_resource type="GradientTexture" id=4]
|
||||
gradient = SubResource( 3 )
|
||||
|
||||
[sub_resource type="Curve" id="5"]
|
||||
_data = [Vector2(0.00501098, 0.5), 0.0, 0.0, 0, 0, Vector2(0.994989, 0.324), 0.0, 0.0, 0, 0]
|
||||
[sub_resource type="Curve" id=5]
|
||||
_data = [ Vector2( 0.00501098, 0.5 ), 0.0, 0.0, 0, 0, Vector2( 0.994989, 0.324 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id="6"]
|
||||
curve = SubResource( "5" )
|
||||
[sub_resource type="CurveTexture" id=6]
|
||||
curve = SubResource( 5 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id="7"]
|
||||
gravity = Vector3(0, 0, 0)
|
||||
scale_curve = SubResource( "6" )
|
||||
color_ramp = SubResource( "4" )
|
||||
[sub_resource type="ParticlesMaterial" id=7]
|
||||
flag_disable_z = true
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 1.0
|
||||
orbit_velocity = 0.0
|
||||
orbit_velocity_random = 0.0
|
||||
scale = 0.75
|
||||
scale_curve = SubResource( 6 )
|
||||
color_ramp = SubResource( 4 )
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
z_index = 10
|
||||
script = ExtResource( "1" )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
frames = SubResource( "1" )
|
||||
animation = &"right"
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "right"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( "2" )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Trail" type="GPUParticles2D" parent="."]
|
||||
[node name="Trail" type="Particles2D" parent="."]
|
||||
z_index = -1
|
||||
amount = 10
|
||||
speed_scale = 2.0
|
||||
local_coords = false
|
||||
process_material = SubResource( "7" )
|
||||
texture = ExtResource( "2" )
|
||||
process_material = SubResource( 7 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
|
||||
|
||||
@@ -10,7 +10,7 @@ consider following the tutorial in the documentation.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Vulkan Mobile
|
||||
Renderer: GLES 3 (particles are not available in GLES 2)
|
||||
|
||||
Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://q2pf4fr8d0ks"
|
||||
path="res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/House In a Forest Loop.ogg"
|
||||
dest_files=["res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"]
|
||||
dest_files=[ "res://.import/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://yqglrrsx7j1f"
|
||||
path="res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyFlyingAlt_1.png"
|
||||
dest_files=["res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"]
|
||||
dest_files=[ "res://.import/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bpot8awhdn6ph"
|
||||
path="res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyFlyingAlt_2.png"
|
||||
dest_files=["res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"]
|
||||
dest_files=[ "res://.import/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://5lvm88ij4jqn"
|
||||
path="res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemySwimming_1.png"
|
||||
dest_files=["res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"]
|
||||
dest_files=[ "res://.import/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bng45cvsgufqc"
|
||||
path="res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemySwimming_2.png"
|
||||
dest_files=["res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"]
|
||||
dest_files=[ "res://.import/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bu4221t7qpa7d"
|
||||
path="res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyWalking_1.png"
|
||||
dest_files=["res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"]
|
||||
dest_files=[ "res://.import/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://booij5t7h4efb"
|
||||
path="res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/enemyWalking_2.png"
|
||||
dest_files=["res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"]
|
||||
dest_files=[ "res://.import/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dw26fpygeag8o"
|
||||
path="res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/gameover.wav"
|
||||
dest_files=["res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"]
|
||||
dest_files=[ "res://.import/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b4yyoafu8bi0q"
|
||||
path="res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_up1.png"
|
||||
dest_files=["res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"]
|
||||
dest_files=[ "res://.import/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bko65a0nd66st"
|
||||
path="res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_up2.png"
|
||||
dest_files=["res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"]
|
||||
dest_files=[ "res://.import/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ftkxr8r4qghp"
|
||||
path="res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_walk1.png"
|
||||
dest_files=["res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"]
|
||||
dest_files=[ "res://.import/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://couyhcegeihme"
|
||||
path="res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://art/playerGrey_walk2.png"
|
||||
dest_files=["res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"]
|
||||
dest_files=[ "res://.import/playerGrey_walk2.png-34d2d916366100182d08037c51884043.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
[gd_resource type="Font" load_steps=2 format=3 uid="uid://dyjc58f6sdms0"]
|
||||
|
||||
[ext_resource type="FontData" uid="uid://cit6gwe5px1q8" path="res://fonts/Xolonium-Regular.ttf" id="1_mnk3h"]
|
||||
|
||||
[resource]
|
||||
data/0 = ExtResource( "1_mnk3h" )
|
||||
@@ -1,33 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://cit6gwe5px1q8"
|
||||
path="res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/Xolonium-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://brsl7ypls5f57"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
@@ -18,62 +18,51 @@ This is a finished version of the game featured in the 'Your first 2D game'
|
||||
tutorial in the documentation. For more details, consider
|
||||
following the tutorial in the documentation."
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[debug]
|
||||
|
||||
gdscript/warnings/redundant_await=false
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=480
|
||||
window/size/viewport_height=720
|
||||
window/size/window_width_override=480
|
||||
window/size/window_height_override=720
|
||||
window/stretch/mode="canvas_items"
|
||||
window/size/width=480
|
||||
window/size/height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
start_game={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"echo":false,"script":null)
|
||||
]
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="mobile"
|
||||
|
||||
@@ -1,61 +1,38 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dmn8nkpogiwsf"]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bpdyvy2681m3i" path="res://player/Player.tscn" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cvi13chv8g4hj" path="res://debug/StatesStackDiplayer.tscn" id="3"]
|
||||
[ext_resource type="PackedScene" uid="uid://bq6rrfy53rfvo" path="res://debug/ControlsPanel.tscn" id="4"]
|
||||
|
||||
[sub_resource type="Animation" id="1"]
|
||||
|
||||
[sub_resource type="Animation" id="2"]
|
||||
length = 0.6
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("BodyPivot/Body:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qbwwp"]
|
||||
_data = {
|
||||
"idle": SubResource("1"),
|
||||
"stagger": SubResource("2"),
|
||||
"walk": SubResource("3")
|
||||
}
|
||||
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://debug/StatesStackDiplayer.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://debug/ControlsPanel.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=5]
|
||||
|
||||
[node name="Demo" type="Node"]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1")]
|
||||
position = Vector2(640, 400)
|
||||
|
||||
[node name="StateMachine" parent="Player" index="0"]
|
||||
start_state = NodePath("Idle")
|
||||
|
||||
[node name="AnimationPlayer" parent="Player" index="1"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_qbwwp")
|
||||
}
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 640, 400 )
|
||||
|
||||
[node name="Explanations" type="RichTextLabel" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 10.0
|
||||
offset_top = -370.0
|
||||
offset_right = -10.0
|
||||
offset_bottom = -730.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 4
|
||||
margin_left = 10.0
|
||||
margin_top = -370.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -730.0
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 4
|
||||
custom_fonts/bold_font = ExtResource( 5 )
|
||||
custom_fonts/normal_font = ExtResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "This example shows how to apply the State programming pattern in GDScript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
|
||||
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
|
||||
2. Respect the Single Responsibility Principle. Each State object represents [b]one[/b] action
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent [url=http://gameprogrammingpatterns.com/state.html]Game Programming Patterns ebook[/url]."
|
||||
text = "This example shows how to apply the State programming pattern in GDScript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
@@ -65,19 +42,19 @@ States are common in games. You can use the pattern to:
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent Game Programming Patterns ebook."
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="StatesStackDiplayer" parent="Control" instance=ExtResource("3")]
|
||||
layout_mode = 0
|
||||
[node name="StatesStackDiplayer" parent="Control" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="ControlsPanel" parent="Control" instance=ExtResource("4")]
|
||||
layout_mode = 1
|
||||
[node name="ControlsPanel" parent="Control" instance=ExtResource( 4 )]
|
||||
|
||||
[editable path="Player"]
|
||||
|
||||
@@ -6,7 +6,7 @@ pushdown automaton.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Compatibility
|
||||
Renderer: GLES 2
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/516
|
||||
|
||||
|
||||
@@ -1,41 +1,38 @@
|
||||
[gd_scene format=3 uid="uid://bq6rrfy53rfvo"]
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=1]
|
||||
|
||||
[node name="ControlsPanel" type="Panel"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -150.0
|
||||
offset_bottom = 171.0
|
||||
grow_horizontal = 0
|
||||
margin_left = -220.0
|
||||
margin_bottom = 170.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -56.5
|
||||
offset_top = -65.0
|
||||
offset_right = 56.5
|
||||
offset_bottom = 65.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Actions" type="Label" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Move:
|
||||
Shoot:
|
||||
[node name="Keys" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Shoot:
|
||||
Attack:
|
||||
Stagger:
|
||||
Jump:
|
||||
Sprint:"
|
||||
|
||||
[node name="Keys" type="Label" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "WASD
|
||||
R
|
||||
[node name="Keys2" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "R
|
||||
F
|
||||
X
|
||||
Space
|
||||
Shift"
|
||||
align = 2
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
[gd_scene format=3 uid="uid://bywptem1jb35a"]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations_bold.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://fonts/source_code_pro_explanations.tres" type="DynamicFont" id=2]
|
||||
|
||||
[node name="Explanations" type="RichTextLabel"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 10.0
|
||||
offset_top = -370.0
|
||||
offset_right = -10.0
|
||||
offset_bottom = -730.0
|
||||
size_flags_vertical = 4
|
||||
margin_left = 10.0
|
||||
margin_top = -370.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -730.0
|
||||
rect_clip_content = false
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 4
|
||||
custom_fonts/bold_font = ExtResource( 1 )
|
||||
custom_fonts/normal_font = ExtResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
|
||||
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
|
||||
2. Respect the Single Responsibility Principle. Each State object represents [b]one[/b] action
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent [url=http://gameprogrammingpatterns.com/state.html]Game Programming Patterns ebook[/url]."
|
||||
text = "This example shows how to apply the State programming pattern in GDscript, including Hierarchical States, and a pushdown automaton.
|
||||
|
||||
States are common in games. You can use the pattern to:
|
||||
@@ -20,3 +34,6 @@ States are common in games. You can use the pattern to:
|
||||
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
|
||||
|
||||
You can read more about States in the excellent Game Programming Patterns ebook."
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
@@ -1,37 +1,48 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cvi13chv8g4hj"]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://debug/states_stack_displayer.gd" id="1"]
|
||||
[ext_resource path="res://debug/states_stack_displayer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="StatesStackDiplayer" type="Panel"]
|
||||
offset_right = 210.0
|
||||
offset_bottom = 170.0
|
||||
script = ExtResource("1")
|
||||
margin_right = 210.0
|
||||
margin_bottom = 170.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Title" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
[node name="Title" type="Label" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -105.0
|
||||
margin_right = 105.0
|
||||
margin_bottom = 40.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Pushown"
|
||||
align = 1
|
||||
valign = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Numbers" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "1.
|
||||
2."
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="States" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
[node name="States" type="Label" parent="."]
|
||||
margin_left = 20.0
|
||||
margin_top = 50.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 170.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Jump
|
||||
Test"
|
||||
align = 1
|
||||
|
||||
[node name="Numbers" type="Label" parent="."]
|
||||
margin_left = 20.0
|
||||
margin_top = 50.0
|
||||
margin_right = 190.0
|
||||
margin_bottom = 170.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "1.
|
||||
2."
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Panel
|
||||
|
||||
@onready var fsm_node = get_node(^"../../Player/StateMachine")
|
||||
onready var fsm_node = get_node("../../Player/StateMachine")
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
var states_names = ""
|
||||
@@ -10,5 +11,5 @@ func _process(_delta):
|
||||
states_names += String(state.get_name()) + "\n"
|
||||
numbers += str(index) + "\n"
|
||||
index += 1
|
||||
%States.text = states_names
|
||||
%Numbers.text = numbers
|
||||
$States.text = states_names
|
||||
$Numbers.text = numbers
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b7c5m4mw0jhww"
|
||||
path="res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/SourceCodePro-Black.ttf"
|
||||
dest_files=["res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
@@ -1,33 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b5bspum6ffekd"
|
||||
path="res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725fc00754bf7.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/SourceCodePro-Bold.ttf"
|
||||
dest_files=["res://.godot/imported/SourceCodePro-Bold.ttf-bf03bd9c90603419d32725fc00754bf7.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_resource type="Font" load_steps=2 format=2]
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="FontData" id=1]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_resource type="Font" load_steps=2 format=2]
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="FontData" id=1]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cmdjuhfejngkf"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,118 +1,122 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://bpdyvy2681m3i"]
|
||||
[gd_scene load_steps=20 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://player/player_controller.gd" id="1"]
|
||||
[ext_resource type="Script" path="res://player/player_state_machine.gd" id="2"]
|
||||
[ext_resource type="Script" path="res://player/states/motion/on_ground/idle.gd" id="3"]
|
||||
[ext_resource type="Script" path="res://player/states/motion/on_ground/move.gd" id="4"]
|
||||
[ext_resource type="Script" path="res://player/states/motion/in_air/jump.gd" id="5"]
|
||||
[ext_resource type="Script" path="res://player/states/combat/stagger.gd" id="6"]
|
||||
[ext_resource type="Script" path="res://player/states/combat/attack.gd" id="7"]
|
||||
[ext_resource type="Script" path="res://player/states/die.gd" id="8"]
|
||||
[ext_resource type="Texture2D" uid="uid://eds33w28pilu" path="res://player/shadow.png" id="9"]
|
||||
[ext_resource type="Texture2D" uid="uid://ds53oxkqrcumd" path="res://player/body.png" id="10"]
|
||||
[ext_resource type="Script" path="res://player/bullet/bullet_spawner.gd" id="11"]
|
||||
[ext_resource type="Script" path="res://player/weapon/weapon_pivot.gd" id="12"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdacdp11r3jua" path="res://player/weapon/Sword.tscn" id="13"]
|
||||
[ext_resource type="Script" path="res://player/states/debug/state_name_displayer.gd" id="15"]
|
||||
[ext_resource path="res://player/player_controller.gd" type="Script" id=1]
|
||||
[ext_resource path="res://player/player_state_machine.gd" type="Script" id=2]
|
||||
[ext_resource path="res://player/states/motion/on_ground/idle.gd" type="Script" id=3]
|
||||
[ext_resource path="res://player/states/motion/on_ground/move.gd" type="Script" id=4]
|
||||
[ext_resource path="res://player/states/motion/in_air/jump.gd" type="Script" id=5]
|
||||
[ext_resource path="res://player/states/combat/stagger.gd" type="Script" id=6]
|
||||
[ext_resource path="res://player/states/combat/attack.gd" type="Script" id=7]
|
||||
[ext_resource path="res://player/states/die.gd" type="Script" id=8]
|
||||
[ext_resource path="res://player/shadow.png" type="Texture" id=9]
|
||||
[ext_resource path="res://player/body.png" type="Texture" id=10]
|
||||
[ext_resource path="res://player/bullet/bullet_spawner.gd" type="Script" id=11]
|
||||
[ext_resource path="res://player/weapon/weapon_pivot.gd" type="Script" id=12]
|
||||
[ext_resource path="res://player/weapon/Sword.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=14]
|
||||
[ext_resource path="res://player/states/debug/state_name_displayer.gd" type="Script" id=15]
|
||||
|
||||
[sub_resource type="Animation" id="1"]
|
||||
[sub_resource type="Animation" id=1]
|
||||
|
||||
[sub_resource type="Animation" id="2"]
|
||||
[sub_resource type="Animation" id=2]
|
||||
length = 0.6
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("BodyPivot/Body:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
[sub_resource type="Animation" id=3]
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vi1hn"]
|
||||
_data = {
|
||||
"idle": SubResource("1"),
|
||||
"stagger": SubResource("2"),
|
||||
"walk": SubResource("3")
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 14 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ ]
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="StateMachine" type="Node" parent="."]
|
||||
script = ExtResource("2")
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("3")
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Move" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("4")
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Jump" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("5")
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Stagger" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("6")
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="Attack" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("7")
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="Die" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("8")
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_vi1hn")
|
||||
}
|
||||
anims/idle = SubResource( 1 )
|
||||
anims/stagger = SubResource( 2 )
|
||||
anims/walk = SubResource( 3 )
|
||||
|
||||
[node name="Shadow" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(1, 1, 1, 0.361098)
|
||||
position = Vector2(0, -4)
|
||||
texture = ExtResource("9")
|
||||
[node name="Shadow" type="Sprite" parent="."]
|
||||
self_modulate = Color( 1, 1, 1, 0.361098 )
|
||||
position = Vector2( 0, -4 )
|
||||
texture = ExtResource( 9 )
|
||||
|
||||
[node name="BodyPivot" type="Marker2D" parent="."]
|
||||
[node name="BodyPivot" type="Position2D" parent="."]
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="BodyPivot"]
|
||||
position = Vector2(0, -58)
|
||||
texture = ExtResource("10")
|
||||
[node name="Body" type="Sprite" parent="BodyPivot"]
|
||||
position = Vector2( 0, -58 )
|
||||
texture = ExtResource( 10 )
|
||||
|
||||
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
|
||||
position = Vector2(0, -58)
|
||||
script = ExtResource("11")
|
||||
position = Vector2( 0, -58 )
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
|
||||
wait_time = 0.2
|
||||
one_shot = true
|
||||
|
||||
[node name="WeaponPivot" type="Marker2D" parent="BodyPivot"]
|
||||
position = Vector2(0, -58)
|
||||
script = ExtResource("12")
|
||||
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
|
||||
position = Vector2( 0, -58 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="Offset" type="Marker2D" parent="BodyPivot/WeaponPivot"]
|
||||
position = Vector2(110, 0)
|
||||
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
|
||||
position = Vector2( 110, 0 )
|
||||
|
||||
[node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource("13")]
|
||||
[node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource( 13 )]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(-20, 0, -20, -20, 20, -20, 20, 0)
|
||||
polygon = PoolVector2Array( -20, 0, -20, -20, 20, -20, 20, 0 )
|
||||
|
||||
[node name="StateNameDisplayer" type="Label" parent="."]
|
||||
offset_left = -109.0
|
||||
offset_top = -180.0
|
||||
offset_right = 110.0
|
||||
offset_bottom = -143.0
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 8
|
||||
theme_override_font_sizes/font_size = 24
|
||||
margin_left = -109.0
|
||||
margin_top = -172.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = -138.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Idle"
|
||||
horizontal_alignment = 1
|
||||
align = 1
|
||||
valign = 1
|
||||
uppercase = true
|
||||
script = ExtResource("15")
|
||||
script = ExtResource( 15 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="state_changed" from="StateMachine" to="BodyPivot/WeaponPivot/Offset/Sword" method="_on_StateMachine_state_changed"]
|
||||
[connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ds53oxkqrcumd"
|
||||
path="res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://player/body.png"
|
||||
dest_files=["res://.godot/imported/body.png-313f6363670a5852a7b7126ab476d8b1.ctex"]
|
||||
dest_files=[ "res://.import/body.png-313f6363670a5852a7b7126ab476d8b1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b6uru8lfx45ma"]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://player/bullet/bullet.gd" id="1"]
|
||||
[ext_resource path="res://player/bullet/bullet.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="1"]
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 12.0
|
||||
|
||||
[node name="Bullet" type="CharacterBody2D"]
|
||||
[node name="Bullet" type="KinematicBody2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
script = ExtResource("1")
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("1")
|
||||
shape = SubResource( 1 )
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
extends CharacterBody2D
|
||||
extends KinematicBody2D
|
||||
|
||||
var direction = Vector2()
|
||||
@export var speed: float = 1000.0
|
||||
export(float) var speed = 1000.0
|
||||
|
||||
onready var root = get_tree().root
|
||||
|
||||
@onready var root = get_tree().root
|
||||
|
||||
func _ready():
|
||||
set_as_top_level(true)
|
||||
set_as_toplevel(true)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
@@ -20,4 +21,4 @@ func _physics_process(delta):
|
||||
|
||||
|
||||
func _draw():
|
||||
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.WHITE)
|
||||
draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white)
|
||||
|
||||
@@ -2,6 +2,7 @@ extends Node2D
|
||||
|
||||
var bullet = preload("Bullet.tscn")
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event.is_action_pressed("fire"):
|
||||
fire()
|
||||
@@ -12,7 +13,7 @@ func fire():
|
||||
return
|
||||
|
||||
$CooldownTimer.start()
|
||||
var new_bullet = bullet.instantiate()
|
||||
var new_bullet = bullet.instance()
|
||||
add_child(new_bullet)
|
||||
new_bullet.position = global_position
|
||||
new_bullet.direction = owner.look_direction
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
extends CharacterBody2D
|
||||
# The Player is a CharacterBody2D, in other words a physics-driven object.
|
||||
extends KinematicBody2D
|
||||
# The Player is a KinematicBody2D, in other words a physics-driven object.
|
||||
# It can move, collide with the world, etc...
|
||||
# The player has a state machine, but the body and the state machine are separate.
|
||||
|
||||
signal direction_changed(new_direction)
|
||||
|
||||
var look_direction = Vector2.RIGHT:
|
||||
set(value):
|
||||
look_direction = value
|
||||
set_look_direction(value)
|
||||
var look_direction = Vector2.RIGHT setget set_look_direction
|
||||
|
||||
|
||||
func take_damage(attacker, amount, effect = null):
|
||||
if is_ancestor_of(attacker):
|
||||
if is_a_parent_of(attacker):
|
||||
return
|
||||
$States/Stagger.knockback_direction = (attacker.global_position - global_position).normalized()
|
||||
$Health.take_damage(amount, effect)
|
||||
@@ -24,4 +22,5 @@ func set_dead(value):
|
||||
|
||||
|
||||
func set_look_direction(value):
|
||||
look_direction = value
|
||||
emit_signal("direction_changed", value)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
extends "res://state_machine/state_machine.gd"
|
||||
|
||||
@onready var idle = $Idle
|
||||
@onready var move = $Move
|
||||
@onready var jump = $Jump
|
||||
@onready var stagger = $Stagger
|
||||
@onready var attack = $Attack
|
||||
onready var idle = $Idle
|
||||
onready var move = $Move
|
||||
onready var jump = $Jump
|
||||
onready var stagger = $Stagger
|
||||
onready var attack = $Attack
|
||||
|
||||
|
||||
func _ready():
|
||||
states_map = {
|
||||
@@ -24,7 +25,7 @@ func _change_state(state_name):
|
||||
states_stack.push_front(states_map[state_name])
|
||||
if state_name == "jump" and current_state == move:
|
||||
jump.initialize(move.speed, move.velocity)
|
||||
super._change_state(state_name)
|
||||
._change_state(state_name)
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://eds33w28pilu"
|
||||
path="res://.godot/imported/shadow.png-493c4635eca1ce8bdece629560617dc7.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://player/shadow.png"
|
||||
dest_files=["res://.godot/imported/shadow.png-493c4635eca1ce8bdece629560617dc7.ctex"]
|
||||
dest_files=[ "res://.import/shadow.png-493c4635eca1ce8bdece629560617dc7.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
|
||||
func enter():
|
||||
owner.get_node(^"AnimationPlayer").play("idle")
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
func _on_Sword_attack_finished():
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
# The stagger state end with the stagger animation from the AnimationPlayer.
|
||||
# The animation only affects the Body Sprite2D's modulate property so it
|
||||
# The animation only affects the Body Sprite's modulate property so it
|
||||
# could stack with other animations if we had two AnimationPlayer nodes.
|
||||
|
||||
|
||||
func enter():
|
||||
owner.get_node(^"AnimationPlayer").play("stagger")
|
||||
owner.get_node("AnimationPlayer").play("stagger")
|
||||
|
||||
|
||||
func _on_animation_finished(anim_name):
|
||||
|
||||
@@ -2,12 +2,13 @@ extends Label
|
||||
|
||||
var start_position = Vector2()
|
||||
|
||||
|
||||
func _ready():
|
||||
start_position = position
|
||||
start_position = rect_position
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
position = $"../BodyPivot".position + start_position
|
||||
rect_position = $"../BodyPivot".position + start_position
|
||||
|
||||
|
||||
func _on_StateMachine_state_changed(current_state):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
owner.set_dead(true)
|
||||
owner.get_node(^"AnimationPlayer").play("die")
|
||||
owner.get_node("AnimationPlayer").play("die")
|
||||
|
||||
|
||||
func _on_animation_finished(_anim_name):
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
extends "../motion.gd"
|
||||
|
||||
@export var base_max_horizontal_speed: float = 400.0
|
||||
export(float) var base_max_horizontal_speed = 400.0
|
||||
|
||||
@export var air_acceleration: float = 1000.0
|
||||
@export var air_deceleration: float = 2000.0
|
||||
@export var air_steering_power: float = 50.0
|
||||
export(float) var air_acceleration = 1000.0
|
||||
export(float) var air_deceleration = 2000.0
|
||||
export(float) var air_steering_power = 50.0
|
||||
|
||||
@export var gravity: float = 1600.0
|
||||
export(float) var gravity = 1600.0
|
||||
|
||||
var enter_velocity = Vector2()
|
||||
|
||||
@@ -17,6 +17,7 @@ var horizontal_velocity = Vector2()
|
||||
var vertical_speed = 0.0
|
||||
var height = 0.0
|
||||
|
||||
|
||||
func initialize(speed, velocity):
|
||||
horizontal_speed = speed
|
||||
if speed > 0.0:
|
||||
@@ -36,7 +37,7 @@ func enter():
|
||||
horizontal_velocity = Vector2()
|
||||
vertical_speed = 600.0
|
||||
|
||||
owner.get_node(^"AnimationPlayer").play("idle")
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
func update(delta):
|
||||
@@ -60,8 +61,7 @@ func move_horizontally(delta, direction):
|
||||
var steering_velocity = (target_velocity - horizontal_velocity).normalized() * air_steering_power
|
||||
horizontal_velocity += steering_velocity
|
||||
|
||||
owner.velocity = horizontal_velocity
|
||||
owner.move_and_slide()
|
||||
owner.move_and_slide(horizontal_velocity)
|
||||
|
||||
|
||||
func animate_jump_height(delta):
|
||||
@@ -69,4 +69,4 @@ func animate_jump_height(delta):
|
||||
height += vertical_speed * delta
|
||||
height = max(0.0, height)
|
||||
|
||||
owner.get_node(^"BodyPivot").position.y = -height
|
||||
owner.get_node("BodyPivot").position.y = -height
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends "res://state_machine/state.gd"
|
||||
# Collection of important methods to handle direction and animation.
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
if event.is_action_pressed("simulate_damage"):
|
||||
emit_signal("finished", "stagger")
|
||||
@@ -8,8 +9,8 @@ func handle_input(event):
|
||||
|
||||
func get_input_direction():
|
||||
var input_direction = Vector2(
|
||||
Input.get_axis(&"move_left", &"move_right"),
|
||||
Input.get_axis(&"move_up", &"move_down")
|
||||
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
|
||||
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||
)
|
||||
return input_direction
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
|
||||
func enter():
|
||||
owner.get_node(^"AnimationPlayer").play("idle")
|
||||
owner.get_node("AnimationPlayer").play("idle")
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
return super.handle_input(event)
|
||||
return .handle_input(event)
|
||||
|
||||
|
||||
func update(_delta):
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
extends "on_ground.gd"
|
||||
|
||||
@export var max_walk_speed: float = 450
|
||||
@export var max_run_speed: float = 700
|
||||
|
||||
export(float) var max_walk_speed = 450.0
|
||||
export(float) var max_run_speed = 700.0
|
||||
|
||||
|
||||
func enter():
|
||||
speed = 0.0
|
||||
@@ -9,16 +11,16 @@ func enter():
|
||||
|
||||
var input_direction = get_input_direction()
|
||||
update_look_direction(input_direction)
|
||||
owner.get_node(^"AnimationPlayer").play("walk")
|
||||
owner.get_node("AnimationPlayer").play("walk")
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
return super.handle_input(event)
|
||||
return .handle_input(event)
|
||||
|
||||
|
||||
func update(_delta):
|
||||
var input_direction = get_input_direction()
|
||||
if input_direction.is_zero_approx():
|
||||
if not input_direction:
|
||||
emit_signal("finished", "idle")
|
||||
update_look_direction(input_direction)
|
||||
|
||||
@@ -35,8 +37,8 @@ func update(_delta):
|
||||
|
||||
|
||||
func move(speed, direction):
|
||||
owner.velocity = direction.normalized() * speed
|
||||
owner.move_and_slide()
|
||||
if owner.get_slide_collision_count() == 0:
|
||||
velocity = direction.normalized() * speed
|
||||
owner.move_and_slide(velocity, Vector2(), 5, 2)
|
||||
if owner.get_slide_count() == 0:
|
||||
return
|
||||
return owner.get_slide_collision(0)
|
||||
|
||||
@@ -4,7 +4,8 @@ extends "../motion.gd"
|
||||
var speed = 0.0
|
||||
var velocity = Vector2()
|
||||
|
||||
|
||||
func handle_input(event):
|
||||
if event.is_action_pressed("jump"):
|
||||
emit_signal("finished", "jump")
|
||||
return super.handle_input(event)
|
||||
return .handle_input(event)
|
||||
|
||||
@@ -1,232 +1,223 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://cdacdp11r3jua"]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource type="Script" path="res://player/weapon/sword.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://7cfjw83v5m75" path="res://player/weapon/sword.png" id="2"]
|
||||
[ext_resource path="res://player/weapon/sword.gd" type="Script" id=1]
|
||||
[ext_resource path="res://player/weapon/sword.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="Animation" id="1"]
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "SETUP"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:monitoring")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath(".:monitorable")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="2"]
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "attack_circular"
|
||||
length = 0.3
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.15, 0.2),
|
||||
"transitions": PackedFloat32Array(0.439427, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [-100.0, 100.0, 90.0]
|
||||
"values": [ -100.0, 100.0, 90.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.15, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
[sub_resource type="Animation" id=3]
|
||||
length = 0.45
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.15, 0.2),
|
||||
"transitions": PackedFloat32Array(0.439427, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [-80.0, 85.0, 75.0]
|
||||
"values": [ -80.0, 85.0, 75.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.15, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.05, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/3/type = "method"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0.1, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"set_attack_input_listening"
|
||||
"times": PoolRealArray( 0.1, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "set_attack_input_listening"
|
||||
}, {
|
||||
"args": [],
|
||||
"method": &"set_ready_for_next_attack"
|
||||
}]
|
||||
"args": [ ],
|
||||
"method": "set_ready_for_next_attack"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="4"]
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "attack_medium"
|
||||
length = 0.5
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.05, 0.25, 0.35),
|
||||
"transitions": PackedFloat32Array(0.439427, 1, 1),
|
||||
"times": PoolRealArray( 0.05, 0.25, 0.35 ),
|
||||
"transitions": PoolRealArray( 0.439427, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [95.0, -95.0, -90.0]
|
||||
"values": [ 95.0, -95.0, -90.0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 2.50795, 1, 1),
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 2.50795, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1, 1.3), Vector2(1, 1), Vector2(1, 1)]
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.3 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="5"]
|
||||
[sub_resource type="Animation" id=5]
|
||||
length = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6cp3i"]
|
||||
_data = {
|
||||
"SETUP": SubResource("1"),
|
||||
"attack_circular": SubResource("2"),
|
||||
"attack_fast": SubResource("3"),
|
||||
"attack_medium": SubResource("4"),
|
||||
"idle": SubResource("5")
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[node name="Sword" type="Area2D"]
|
||||
@@ -234,17 +225,19 @@ collision_layer = 16
|
||||
collision_mask = 3
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
script = ExtResource("1")
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_6cp3i")
|
||||
}
|
||||
anims/SETUP = SubResource( 1 )
|
||||
anims/attack_circular = SubResource( 2 )
|
||||
anims/attack_fast = SubResource( 3 )
|
||||
anims/attack_medium = SubResource( 4 )
|
||||
anims/idle = SubResource( 5 )
|
||||
|
||||
[node name="Sword" type="Sprite2D" parent="."]
|
||||
position = Vector2(4, 0)
|
||||
texture = ExtResource("2")
|
||||
offset = Vector2(67, 0)
|
||||
[node name="Sword" type="Sprite" parent="."]
|
||||
position = Vector2( 4, 0 )
|
||||
texture = ExtResource( 2 )
|
||||
offset = Vector2( 67, 0 )
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(28.0001, -15.9999, 136, -15.9995, 160, 0, 136, 16.0005, 27.9999, 16.0001)
|
||||
polygon = PoolVector2Array( 28.0001, -15.9999, 136, -15.9995, 160, 0, 136, 16.0005, 27.9999, 16.0001 )
|
||||
|
||||
@@ -30,9 +30,12 @@ var combo = [{
|
||||
|
||||
var hit_objects = []
|
||||
|
||||
|
||||
func _ready():
|
||||
$AnimationPlayer.animation_finished.connect(self._on_animation_finished)
|
||||
body_entered.connect(self._on_body_entered)
|
||||
# warning-ignore:return_value_discarded
|
||||
$AnimationPlayer.connect("animation_finished", self, "_on_animation_finished")
|
||||
# warning-ignore:return_value_discarded
|
||||
self.connect("body_entered", self, "_on_body_entered")
|
||||
_change_state(States.IDLE)
|
||||
|
||||
|
||||
@@ -96,7 +99,7 @@ func _on_body_entered(body):
|
||||
|
||||
|
||||
func _on_animation_finished(_name):
|
||||
if attack_current.is_empty():
|
||||
if not attack_current:
|
||||
return
|
||||
|
||||
if attack_input_state == AttackInputStates.REGISTERED and combo_count < MAX_COMBO_COUNT:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7cfjw83v5m75"
|
||||
path="res://.godot/imported/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.ctex"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -11,24 +10,26 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://player/weapon/sword.png"
|
||||
dest_files=["res://.godot/imported/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.ctex"]
|
||||
dest_files=[ "res://.import/sword.png-fc7f0084cdf333c826eda2b33f2ec3cc.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=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
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
extends Marker2D
|
||||
extends Position2D
|
||||
|
||||
var z_index_start = 0
|
||||
|
||||
|
||||
func _ready():
|
||||
owner.direction_changed.connect(self._on_Parent_direction_changed)
|
||||
#warning-ignore:return_value_discarded
|
||||
owner.connect("direction_changed", self, "_on_Parent_direction_changed")
|
||||
z_index_start = z_index
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
@@ -15,86 +15,87 @@ config/description="This example shows how to apply the State machine programmin
|
||||
pattern in GDscript, including Hierarchical States, and a
|
||||
pushdown automaton."
|
||||
run/main_scene="res://Demo.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1280
|
||||
window/size/viewport_height=720
|
||||
window/stretch/mode="canvas_items"
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"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(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":65,"key_label":0,"unicode":113,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"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(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":87,"key_label":0,"unicode":122,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"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(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":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"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":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, 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":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
fire={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":82,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
run={
|
||||
"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":4194325,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
simulate_damage={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":88,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
attack={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":70,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/physics_ticks_per_second=120
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
|
||||
@@ -6,6 +6,7 @@ extends Node
|
||||
# warning-ignore:unused_signal
|
||||
signal finished(next_state_name)
|
||||
|
||||
|
||||
# Initialize the state. E.g. change the animation.
|
||||
func enter():
|
||||
pass
|
||||
|
||||
@@ -10,34 +10,33 @@ signal state_changed(current_state)
|
||||
# You should set a starting node from the inspector or on the node that inherits
|
||||
# from this state machine interface. If you don't, the game will default to
|
||||
# the first state in the state machine's children.
|
||||
@export var start_state: NodePath
|
||||
export(NodePath) var start_state
|
||||
var states_map = {}
|
||||
|
||||
var states_stack = []
|
||||
var current_state = null
|
||||
var _active = false:
|
||||
set(value):
|
||||
_active = value
|
||||
set_active(value)
|
||||
var _active = false setget set_active
|
||||
|
||||
func _enter_tree():
|
||||
if start_state.is_empty():
|
||||
|
||||
func _ready():
|
||||
if not start_state:
|
||||
start_state = get_child(0).get_path()
|
||||
for child in get_children():
|
||||
var err = child.finished.connect(self._change_state)
|
||||
var err = child.connect("finished", self, "_change_state")
|
||||
if err:
|
||||
printerr(err)
|
||||
initialize(start_state)
|
||||
|
||||
|
||||
func initialize(initial_state):
|
||||
_active = true
|
||||
set_active(true)
|
||||
states_stack.push_front(get_node(initial_state))
|
||||
current_state = states_stack[0]
|
||||
current_state.enter()
|
||||
|
||||
|
||||
func set_active(value):
|
||||
_active = value
|
||||
set_physics_process(value)
|
||||
set_process_input(value)
|
||||
if not _active:
|
||||
|
||||
@@ -6,7 +6,7 @@ and eraser, as well as a rectangle and a circle brush.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Vulkan Mobile
|
||||
Renderer: GLES 2
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/517
|
||||
|
||||
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
35
2d/gd_paint/icon.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
@@ -4,6 +4,8 @@ extends Control
|
||||
const UNDO_MODE_SHAPE = -2
|
||||
# A constant for whether or not we can undo.
|
||||
const UNDO_NONE = -1
|
||||
# How large is the image (it's actually the size of DrawingAreaBG, because that's our background canvas).
|
||||
const IMAGE_SIZE = Vector2(930, 720)
|
||||
|
||||
# Enums for the various modes and brush shapes that can be applied.
|
||||
enum BrushModes {
|
||||
@@ -18,6 +20,9 @@ enum BrushShapes {
|
||||
CIRCLE,
|
||||
}
|
||||
|
||||
# The top-left position of the canvas.
|
||||
var TL_node
|
||||
|
||||
# A list to hold all of the dictionaries that make up each brush.
|
||||
var brush_data_list = []
|
||||
|
||||
@@ -36,24 +41,30 @@ var undo_element_list_num = -1
|
||||
# The current brush settings: The mode, size, color, and shape we have currently selected.
|
||||
var brush_mode = BrushModes.PENCIL
|
||||
var brush_size = 32
|
||||
var brush_color = Color.BLACK
|
||||
var brush_color = Color.black
|
||||
var brush_shape = BrushShapes.CIRCLE;
|
||||
|
||||
# The color of the background. We need this for the eraser (see the how we handle the eraser
|
||||
# in the _draw function for more details).
|
||||
var bg_color = Color.WHITE
|
||||
var bg_color = Color.white
|
||||
|
||||
@onready var drawing_area = $"../DrawingAreaBG"
|
||||
|
||||
func _ready():
|
||||
# Get the top left position node. We need this to find out whether or not the mouse is inside the canvas.
|
||||
TL_node = get_node("TLPos")
|
||||
set_process(true)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
var mouse_pos = get_viewport().get_mouse_position()
|
||||
|
||||
# Check if the mouse is currently inside the canvas/drawing-area.
|
||||
var drawing_area_rect := Rect2(drawing_area.position, drawing_area.size)
|
||||
is_mouse_in_drawing_area = drawing_area_rect.has_point(mouse_pos)
|
||||
is_mouse_in_drawing_area = false
|
||||
if mouse_pos.x > TL_node.global_position.x:
|
||||
if mouse_pos.y > TL_node.global_position.y:
|
||||
is_mouse_in_drawing_area = true
|
||||
|
||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
||||
# If we do not have a position for when the mouse was first clicked, then this must
|
||||
# be the first time is_mouse_button_pressed has been called since the mouse button was
|
||||
# released, so we need to store the position.
|
||||
@@ -100,10 +111,11 @@ func check_if_mouse_is_inside_canvas():
|
||||
# Make sure the mouse click starting position is inside the canvas.
|
||||
# This is so if we start out click outside the canvas (say chosing a color from the color picker)
|
||||
# and then move our mouse back into the canvas, it won't start painting.
|
||||
if Rect2(drawing_area.position, drawing_area.size).has_point(mouse_click_start_pos):
|
||||
# Make sure the current mouse position is inside the canvas.
|
||||
if is_mouse_in_drawing_area:
|
||||
return true
|
||||
if mouse_click_start_pos.x > TL_node.global_position.x:
|
||||
if mouse_click_start_pos.y > TL_node.global_position.y:
|
||||
# Make sure the current mouse position is inside the canvas.
|
||||
if is_mouse_in_drawing_area:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
@@ -115,7 +127,7 @@ func undo_stroke():
|
||||
# If we are undoing a shape, then we can just remove the latest brush.
|
||||
if undo_element_list_num == UNDO_MODE_SHAPE:
|
||||
if brush_data_list.size() > 0:
|
||||
brush_data_list.remove_at(brush_data_list.size() - 1)
|
||||
brush_data_list.remove(brush_data_list.size() - 1)
|
||||
|
||||
# Now that we've undone a shape, we cannot undo again until another stoke is added.
|
||||
undo_element_list_num = UNDO_NONE
|
||||
@@ -135,7 +147,7 @@ func undo_stroke():
|
||||
undo_element_list_num = UNDO_NONE
|
||||
|
||||
# Redraw the brushes
|
||||
queue_redraw()
|
||||
update()
|
||||
|
||||
|
||||
func add_brush(mouse_pos, type):
|
||||
@@ -187,7 +199,7 @@ func add_brush(mouse_pos, type):
|
||||
|
||||
# Add the brush and update/draw all of the brushes.
|
||||
brush_data_list.append(new_brush)
|
||||
queue_redraw()
|
||||
update()
|
||||
|
||||
|
||||
func _draw():
|
||||
@@ -228,12 +240,14 @@ func _draw():
|
||||
|
||||
func save_picture(path):
|
||||
# Wait until the frame has finished before getting the texture.
|
||||
await RenderingServer.frame_post_draw
|
||||
yield(VisualServer, "frame_post_draw")
|
||||
|
||||
# Get the viewport image.
|
||||
var img = get_viewport().get_texture().get_image()
|
||||
var img = get_viewport().get_texture().get_data()
|
||||
# Crop the image so we only have canvas area.
|
||||
var cropped_image = img.get_region(Rect2(drawing_area.position, drawing_area.size))
|
||||
var cropped_image = img.get_rect(Rect2(TL_node.global_position, IMAGE_SIZE))
|
||||
# Flip the image on the Y-axis (it's flipped upside down by default).
|
||||
cropped_image.flip_y()
|
||||
|
||||
# Save the image with the passed in path we got from the save dialog.
|
||||
cropped_image.save_png(path)
|
||||
221
2d/gd_paint/paint_root.tscn
Normal file
@@ -0,0 +1,221 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://paint_control.gd" type="Script" id=1]
|
||||
[ext_resource path="res://tools_panel.gd" type="Script" id=2]
|
||||
[ext_resource path="res://paint_tools.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="PaintRoot" type="Control"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="DrawingAreaBG" type="Panel" parent="."]
|
||||
margin_left = 350.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 720.0
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
|
||||
[node name="PaintControl" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TLPos" type="Position2D" parent="PaintControl"]
|
||||
position = Vector2( 350, 0 )
|
||||
|
||||
[node name="ToolsPanel" type="Panel" parent="."]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 720.0
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="LabelTools" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 10.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 24.0
|
||||
text = "Selected tool: Pencil"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonToolPencil" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 40.0
|
||||
margin_top = 40.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolPencil"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 16, 16 )
|
||||
|
||||
[node name="ButtonToolEraser" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 110.0
|
||||
margin_top = 40.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolEraser"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 0, 16, 16 )
|
||||
|
||||
[node name="ButtonToolRectangle" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 180.0
|
||||
margin_top = 40.0
|
||||
margin_right = 240.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolRectangle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 16, 16, 16 )
|
||||
|
||||
[node name="ButtonToolCircle" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 250.0
|
||||
margin_top = 40.0
|
||||
margin_right = 310.0
|
||||
margin_bottom = 100.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/ButtonToolCircle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 16, 16, 16 )
|
||||
|
||||
[node name="LabelBrushColor" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 120.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 134.0
|
||||
text = "Current color"
|
||||
align = 1
|
||||
|
||||
[node name="ColorPickerBrush" type="ColorPickerButton" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 140.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 190.0
|
||||
|
||||
[node name="BrushSettings" type="Control" parent="ToolsPanel"]
|
||||
margin_top = 200.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 375.0
|
||||
|
||||
[node name="LabelBrushSize" type="Label" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 10.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 24.0
|
||||
text = "Brush size: 32px"
|
||||
align = 1
|
||||
|
||||
[node name="HScrollBarBrushSize" type="HScrollBar" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 30.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 60.0
|
||||
min_value = 2.0
|
||||
step = 1.0
|
||||
value = 32.0
|
||||
|
||||
[node name="LabelBrushShape" type="Label" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 20.0
|
||||
margin_top = 80.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 94.0
|
||||
text = "Brush shape: Circle"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonShapeBox" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 100.0
|
||||
margin_top = 100.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 160.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeBox"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 16, 16, 16 )
|
||||
|
||||
[node name="ButtonShapeCircle" type="Button" parent="ToolsPanel/BrushSettings"]
|
||||
margin_left = 190.0
|
||||
margin_top = 100.0
|
||||
margin_right = 250.0
|
||||
margin_bottom = 160.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="ToolsPanel/BrushSettings/ButtonShapeCircle"]
|
||||
position = Vector2( 30, 30 )
|
||||
scale = Vector2( 2.5, 2.5 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 16, 16, 16 )
|
||||
|
||||
[node name="LabelBackgroundColor" type="Label" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 400.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 414.0
|
||||
text = "Background color"
|
||||
align = 1
|
||||
|
||||
[node name="ColorPickerBackground" type="ColorPickerButton" parent="ToolsPanel"]
|
||||
margin_left = 20.0
|
||||
margin_top = 420.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 470.0
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
edit_alpha = false
|
||||
|
||||
[node name="LabelStats" type="Label" parent="ToolsPanel"]
|
||||
modulate = Color( 0.414062, 0.414062, 0.414062, 1 )
|
||||
margin_left = 20.0
|
||||
margin_top = 590.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 604.0
|
||||
text = "Brush objects: 00000"
|
||||
align = 1
|
||||
|
||||
[node name="ButtonUndo" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 520.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 560.0
|
||||
text = "Undo last stroke"
|
||||
|
||||
[node name="ButtonSave" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 620.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 660.0
|
||||
text = "Save picture"
|
||||
|
||||
[node name="ButtonClear" type="Button" parent="ToolsPanel"]
|
||||
margin_left = 10.0
|
||||
margin_top = 670.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 710.0
|
||||
text = "Clear picture"
|
||||
|
||||
[node name="SaveFileDialog" type="FileDialog" parent="."]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 400.0
|
||||
rect_min_size = Vector2( 300, 105 )
|
||||
resizable = true
|
||||
access = 2
|
||||
filters = PoolStringArray( "*.png" )
|
||||
|
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
35
2d/gd_paint/paint_tools.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://paint_tools.png"
|
||||
dest_files=[ "res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
@@ -6,7 +6,7 @@
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
@@ -16,17 +16,21 @@ It supports different types of 'brushes': a basic pen/pencil
|
||||
and eraser, as well as a rectangle and a circle brush."
|
||||
run/main_scene="res://paint_root.tscn"
|
||||
config/icon="res://icon.png"
|
||||
config/features=PackedStringArray("4.0")
|
||||
|
||||
[debug]
|
||||
|
||||
gdscript/warnings/redundant_await=false
|
||||
|
||||
[display]
|
||||
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/aspect="keep_height"
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="mobile"
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@@ -1,36 +1,38 @@
|
||||
extends Panel
|
||||
|
||||
@onready var brush_settings = $BrushSettings
|
||||
@onready var label_brush_size = brush_settings.get_node(^"LabelBrushSize")
|
||||
@onready var label_brush_shape = brush_settings.get_node(^"LabelBrushShape")
|
||||
@onready var label_stats = $LabelStats
|
||||
@onready var label_tools = $LabelTools
|
||||
onready var brush_settings = $BrushSettings
|
||||
onready var label_brush_size = brush_settings.get_node(@"LabelBrushSize")
|
||||
onready var label_brush_shape = brush_settings.get_node(@"LabelBrushShape")
|
||||
onready var label_stats = $LabelStats
|
||||
onready var label_tools = $LabelTools
|
||||
|
||||
onready var _parent = get_parent()
|
||||
onready var save_dialog = _parent.get_node(@"SaveFileDialog")
|
||||
onready var paint_control = _parent.get_node(@"PaintControl")
|
||||
|
||||
@onready var _parent = get_parent()
|
||||
@onready var save_dialog = _parent.get_node(^"SaveFileDialog")
|
||||
@onready var paint_control = _parent.get_node(^"PaintControl")
|
||||
|
||||
func _ready():
|
||||
# warning-ignore-all:return_value_discarded
|
||||
# Assign all of the needed signals for the oppersation buttons.
|
||||
$ButtonUndo.pressed.connect(self.button_pressed.bind("undo_stroke"))
|
||||
$ButtonSave.pressed.connect(self.button_pressed.bind("save_picture"))
|
||||
$ButtonClear.pressed.connect(self.button_pressed.bind("clear_picture"))
|
||||
$ButtonUndo.connect("pressed", self, "button_pressed", ["undo_stroke"])
|
||||
$ButtonSave.connect("pressed", self, "button_pressed", ["save_picture"])
|
||||
$ButtonClear.connect("pressed", self, "button_pressed", ["clear_picture"])
|
||||
|
||||
# Assign all of the needed signals for the brush buttons.
|
||||
$ButtonToolPencil.pressed.connect(self.button_pressed.bind("mode_pencil"))
|
||||
$ButtonToolEraser.pressed.connect(self.button_pressed.bind("mode_eraser"))
|
||||
$ButtonToolRectangle.pressed.connect(self.button_pressed.bind("mode_rectangle"))
|
||||
$ButtonToolCircle.pressed.connect(self.button_pressed.bind("mode_circle"))
|
||||
$BrushSettings/ButtonShapeBox.pressed.connect(self.button_pressed.bind("shape_rectangle"))
|
||||
$BrushSettings/ButtonShapeCircle.pressed.connect(self.button_pressed.bind("shape_circle"))
|
||||
$ButtonToolPencil.connect("pressed", self, "button_pressed", ["mode_pencil"])
|
||||
$ButtonToolEraser.connect("pressed", self, "button_pressed", ["mode_eraser"])
|
||||
$ButtonToolRectangle.connect("pressed", self, "button_pressed", ["mode_rectangle"])
|
||||
$ButtonToolCircle.connect("pressed", self, "button_pressed", ["mode_circle"])
|
||||
$BrushSettings/ButtonShapeBox.connect("pressed", self, "button_pressed", ["shape_rectangle"])
|
||||
$BrushSettings/ButtonShapeCircle.connect("pressed", self, "button_pressed", ["shape_circle"])
|
||||
|
||||
# Assign all of the needed signals for the other brush settings (and ColorPickerBackground).
|
||||
$ColorPickerBrush.color_changed.connect(self.brush_color_changed)
|
||||
$ColorPickerBackground.color_changed.connect(self.background_color_changed)
|
||||
$BrushSettings/HScrollBarBrushSize.value_changed.connect(self.brush_size_changed)
|
||||
$ColorPickerBrush.connect("color_changed", self, "brush_color_changed")
|
||||
$ColorPickerBackground.connect("color_changed", self, "background_color_changed")
|
||||
$BrushSettings/HScrollBarBrushSize.connect("value_changed", self, "brush_size_changed")
|
||||
|
||||
# Assign the "file_selected" signal in SaveFileDialog.
|
||||
save_dialog.file_selected.connect(self.save_file_selected)
|
||||
save_dialog.connect("file_selected", self, "save_file_selected")
|
||||
|
||||
# Set physics process so we can update the status label.
|
||||
set_physics_process(true)
|
||||
@@ -38,7 +40,7 @@ func _ready():
|
||||
|
||||
func _physics_process(_delta):
|
||||
# Update the status label with the newest brush element count.
|
||||
label_stats.text = "Brush objects: " + str(paint_control.brush_data_list.size())
|
||||
label_stats.text = "Brush objects: " + String(paint_control.brush_data_list.size())
|
||||
|
||||
|
||||
func button_pressed(button_name):
|
||||
@@ -74,7 +76,7 @@ func button_pressed(button_name):
|
||||
# If a opperation button is pressed
|
||||
elif button_name == "clear_picture":
|
||||
paint_control.brush_data_list = []
|
||||
paint_control.queue_redraw()
|
||||
paint_control.update()
|
||||
elif button_name == "save_picture":
|
||||
save_dialog.popup_centered()
|
||||
elif button_name == "undo_stroke":
|
||||
@@ -94,16 +96,16 @@ func brush_color_changed(color):
|
||||
|
||||
func background_color_changed(color):
|
||||
# Change the background color to whatever colorthe background color picker is.
|
||||
get_parent().get_node(^"DrawingAreaBG").modulate = color
|
||||
get_parent().get_node("DrawingAreaBG").modulate = color
|
||||
paint_control.bg_color = color
|
||||
# Because of how the eraser works we also need to redraw the paint control.
|
||||
paint_control.queue_redraw()
|
||||
paint_control.update()
|
||||
|
||||
|
||||
func brush_size_changed(value):
|
||||
# Change the size of the brush, and update the label to reflect the new value.
|
||||
paint_control.brush_size = ceil(value)
|
||||
label_brush_size.text = "Brush size: " + str(ceil(value)) + "px"
|
||||
label_brush_size.text = "Brush size: " + String(ceil(value)) + "px"
|
||||
|
||||
|
||||
func save_file_selected(path):
|
||||
@@ -1,17 +0,0 @@
|
||||
# Glow for 2D
|
||||
|
||||
This showcases how to use glow in a 2D game via the WorldEnvironment node.
|
||||
|
||||
Slide the cave image left and right to observe the glow effect at work.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Forward Plus
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/110
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
@@ -1,21 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
const CAVE_LIMIT = 1000
|
||||
|
||||
var glow_map = preload("res://glow_map.webp")
|
||||
|
||||
@onready var cave = $Cave
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion and event.button_mask > 0:
|
||||
cave.position.x = clampf(cave.position.x + event.relative.x, -CAVE_LIMIT, 0)
|
||||
|
||||
if event.is_action_pressed("toggle_glow_map"):
|
||||
if $WorldEnvironment.environment.glow_map:
|
||||
$WorldEnvironment.environment.glow_map = null
|
||||
# Restore glow intensity to its default value
|
||||
$WorldEnvironment.environment.glow_intensity = 0.8
|
||||
else:
|
||||
$WorldEnvironment.environment.glow_map = glow_map
|
||||
# Increase glow intensity to compensate for the glow map darkening parts of the glow.
|
||||
$WorldEnvironment.environment.glow_intensity = 1.6
|
||||
@@ -1,51 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bhcia8aeoa4cm"]
|
||||
|
||||
[ext_resource type="Script" path="res://beach_cave.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://drndflsw6mug" path="res://ocean_beach.png" id="2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyslwppgvocgd" path="res://ocean_cave.png" id="3"]
|
||||
|
||||
[sub_resource type="Environment" id="1"]
|
||||
background_mode = 3
|
||||
ambient_light_sky_contribution = 0.0
|
||||
glow_enabled = true
|
||||
glow_levels/3 = 0.0
|
||||
glow_levels/4 = 1.0
|
||||
glow_levels/7 = 1.0
|
||||
glow_strength = 0.88
|
||||
glow_bloom = 0.08
|
||||
glow_blend_mode = 0
|
||||
|
||||
[node name="BeachCave" type="Node2D"]
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="Beach" type="Sprite2D" parent="."]
|
||||
modulate = Color(2, 2, 2, 1)
|
||||
self_modulate = Color(2, 2, 2, 1)
|
||||
texture = ExtResource("2")
|
||||
centered = false
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 3840, 720)
|
||||
|
||||
[node name="Cave" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(0.233166, 0.221219, 0.23582, 1)
|
||||
scale = Vector2(1.2, 1)
|
||||
texture = ExtResource("3")
|
||||
centered = false
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("1")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2(540, 360)
|
||||
current = true
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
offset_left = 18.0
|
||||
offset_top = 18.0
|
||||
offset_right = 294.0
|
||||
offset_bottom = 70.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Drag left and right with the mouse
|
||||
G: Toggle glow map (lens dirt effect)"
|
||||
|
Before Width: | Height: | Size: 247 KiB |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bocux7q0xdifq"
|
||||
path="res://.godot/imported/glow_map.webp-13400453956ba4dd65042386a2d4cf65.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://glow_map.webp"
|
||||
dest_files=["res://.godot/imported/glow_map.webp-13400453956ba4dd65042386a2d4cf65.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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
2d/glow/icon.png
|
Before Width: | Height: | Size: 9.5 KiB |
@@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bsjtxyyenw6db"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://drndflsw6mug"
|
||||
path="res://.godot/imported/ocean_beach.png-b571ab5468cc775a520aaa47efbed607.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ocean_beach.png"
|
||||
dest_files=["res://.godot/imported/ocean_beach.png-b571ab5468cc775a520aaa47efbed607.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dyslwppgvocgd"
|
||||
path="res://.godot/imported/ocean_cave.png-2a86f381e3092b4cb698b627d778e19b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ocean_cave.png"
|
||||
dest_files=["res://.godot/imported/ocean_cave.png-2a86f381e3092b4cb698b627d778e19b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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,39 +0,0 @@
|
||||
; 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="Glow for 2D"
|
||||
config/description="This showcases how to use glow in a 2D game via the WorldEnvironment node.
|
||||
|
||||
Slide the cave image left and right to observe the glow effect at work."
|
||||
run/main_scene="res://beach_cave.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.png"
|
||||
run/name=""
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1080
|
||||
window/size/viewport_height=720
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[input]
|
||||
|
||||
toggle_glow_map={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":71,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/defaults/default_clear_color=Color(0.0666667, 0.0588235, 0.0431373, 1)
|
||||
18
2d/hdr/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# HDR for 2D
|
||||
|
||||
Simple demo how to use High Dynamic Range (HDR) in a 2D game,
|
||||
via the WorldEnvironment node.
|
||||
|
||||
Just slide the cave image left and right to observe the HDR effect at work.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: GLES 3 (HDR is not available in GLES 2)
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/110
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
17
2d/hdr/beach_cave.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Node2D
|
||||
|
||||
const CAVE_LIMIT = 1000
|
||||
|
||||
onready var cave = $Cave
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion and event.button_mask > 0:
|
||||
var rel_x = event.relative.x
|
||||
var cavepos = cave.position
|
||||
cavepos.x += rel_x
|
||||
if cavepos.x < -CAVE_LIMIT:
|
||||
cavepos.x = -CAVE_LIMIT
|
||||
elif cavepos.x > 0:
|
||||
cavepos.x = 0
|
||||
cave.position = cavepos
|
||||
56
2d/hdr/beach_cave.tscn
Normal file
@@ -0,0 +1,56 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://beach_cave.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ocean_beach.png" type="Texture" id=2]
|
||||
[ext_resource path="res://ocean_cave.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="Environment" id=1]
|
||||
background_mode = 4
|
||||
ambient_light_sky_contribution = 0.0
|
||||
auto_exposure_enabled = true
|
||||
auto_exposure_scale = 0.51
|
||||
auto_exposure_speed = 4.0
|
||||
ssao_blur = 1
|
||||
glow_enabled = true
|
||||
glow_levels/3 = false
|
||||
glow_levels/4 = true
|
||||
glow_levels/7 = true
|
||||
glow_strength = 0.88
|
||||
glow_blend_mode = 0
|
||||
glow_bicubic_upscale = true
|
||||
|
||||
[node name="BeachCave" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Beach" type="Sprite" parent="."]
|
||||
modulate = Color( 2, 2, 2, 1 )
|
||||
self_modulate = Color( 2, 2, 2, 1 )
|
||||
texture = ExtResource( 2 )
|
||||
centered = false
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 3840, 720 )
|
||||
|
||||
[node name="Cave" type="Sprite" parent="."]
|
||||
self_modulate = Color( 0.233166, 0.221219, 0.23582, 1 )
|
||||
scale = Vector2( 1.2, 1 )
|
||||
texture = ExtResource( 3 )
|
||||
centered = false
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 1 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2( 540, 360 )
|
||||
current = true
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = 135.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Drag Left and Right"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
BIN
2d/hdr/icon.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
35
2d/hdr/icon.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
Before Width: | Height: | Size: 376 KiB After Width: | Height: | Size: 376 KiB |
35
2d/hdr/ocean_beach.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ocean_beach.png-b571ab5468cc775a520aaa47efbed607.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ocean_beach.png"
|
||||
dest_files=[ "res://.import/ocean_beach.png-b571ab5468cc775a520aaa47efbed607.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=2
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
|
Before Width: | Height: | Size: 597 KiB After Width: | Height: | Size: 597 KiB |
35
2d/hdr/ocean_cave.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/ocean_cave.png-2a86f381e3092b4cb698b627d778e19b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ocean_cave.png"
|
||||
dest_files=[ "res://.import/ocean_cave.png-2a86f381e3092b4cb698b627d778e19b.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
40
2d/hdr/project.godot
Normal file
@@ -0,0 +1,40 @@
|
||||
; 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=4
|
||||
|
||||
[application]
|
||||
|
||||
config/name="HDR for 2D"
|
||||
config/description="Simple demo how to use High Dynamic Range (HDR) in a 2D game,
|
||||
via the WorldEnvironment node.
|
||||
|
||||
Just slide the cave image left and right to observe the HDR effect at work."
|
||||
run/main_scene="res://beach_cave.tscn"
|
||||
config/icon="res://icon.png"
|
||||
run/name=""
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1080
|
||||
window/size/height=720
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ ]
|
||||
|
||||
[rasterizer]
|
||||
|
||||
blur_buffer_size=128
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0.05, 0.0453, 0.0265, 1 )
|
||||