Compare commits

..

5 Commits
3.3 ... 3.2

Author SHA1 Message Date
Aaron Franke
f43c0fb3a1 [3.2] Simplify list of branches in the README (#1255) 2025-10-02 16:55:39 -07:00
Rémi Verschelde
834c62fb88 Update README for new branches, matches Godot upstream
(cherry picked from commit c0180d20d1)
2023-02-28 18:36:43 +01:00
Aaron Franke
098e13cca2 [3.2] Update README for the new 3.3 branch 2021-11-05 10:16:59 -05:00
Aaron Franke
ee1252eafe Merge pull request #611 from aaronfranke/3.2-readme-license-3.2
[3.2] Update README for the new 3.2 branch
2021-04-21 03:52:20 -05:00
Aaron Franke
aa5aa936cb [3.2] Update README for the new 3.2 branch 2021-04-21 03:59:54 -04:00
476 changed files with 1860 additions and 5565 deletions

View File

@@ -38,10 +38,6 @@ func _ready():
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.
# 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.

View File

@@ -29,6 +29,5 @@ frames = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
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"]

View File

@@ -53,6 +53,5 @@ text = "Start"
[node name="MessageTimer" type="Timer" parent="."]
one_shot = true
[connection signal="pressed" from="StartButton" to="." method="_on_StartButton_pressed"]
[connection signal="timeout" from="MessageTimer" to="." method="_on_MessageTimer_timeout"]

View File

@@ -44,8 +44,8 @@ func _on_MobTimer_timeout():
direction += rand_range(-PI / 4, PI / 4)
mob.rotation = direction
# Choose the velocity for the mob.
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
# Choose the velocity.
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
mob.linear_velocity = velocity.rotated(direction)

View File

@@ -47,7 +47,6 @@ stream = ExtResource( 5 )
[node name="DeathSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="_on_ScoreTimer_timeout"]

View File

@@ -1,5 +1,9 @@
extends RigidBody2D
#warning-ignore-all:unused_class_variable
export var min_speed = 150
export var max_speed = 250
func _ready():
$AnimatedSprite.playing = true
var mob_types = $AnimatedSprite.frames.get_animation_names()
@@ -8,3 +12,7 @@ func _ready():
func _on_VisibilityNotifier2D_screen_exited():
queue_free()
func _on_start_game():
queue_free()

View File

@@ -50,5 +50,4 @@ rotation = 1.5708
shape = SubResource( 2 )
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]

View File

@@ -67,5 +67,4 @@ speed_scale = 2.0
local_coords = false
process_material = SubResource( 7 )
texture = ExtResource( 2 )
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]

View File

@@ -14,16 +14,12 @@ 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).
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/515
## Screenshots
![GIF from the documentation](https://docs.godotengine.org/en/latest/_images/dodge_preview.gif)
![Screenshot](screenshots/dodge.png)
## Copying
`art/House In a Forest Loop.ogg` Copyright © 2012 [HorrorPen](https://opengameart.org/users/horrorpen), [CC-BY 3.0: Attribution](http://creativecommons.org/licenses/by/3.0/). Source: https://opengameart.org/content/loop-house-in-a-forest

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Dodge the Creeps"
@@ -24,8 +29,6 @@ config/icon="res://icon.png"
window/size/width=480
window/size/height=720
window/stretch/mode="2d"
window/stretch/aspect="keep"
[input]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,50 +1,15 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=5 format=2]
[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/Explanations.tscn" type="PackedScene" 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="Explanations" type="RichTextLabel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
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:
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 one 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 Game Programming Patterns ebook."
__meta__ = {
"_edit_lock_": true
}
[node name="Explanations" parent="." instance=ExtResource( 2 )]
[node name="Control" type="Control" parent="."]
anchor_right = 1.0

View File

@@ -7,7 +7,7 @@ func _process(_delta):
var numbers = ""
var index = 0
for state in fsm_node.states_stack:
states_names += String(state.get_name()) + "\n"
states_names += state.get_name() + "\n"
numbers += str(index) + "\n"
index += 1
$States.text = states_names

View File

@@ -41,6 +41,7 @@ use_filter = true
font_data = ExtResource( 14 )
[node name="Player" type="KinematicBody2D"]
position = Vector2( 628.826, 391.266 )
script = ExtResource( 1 )
__meta__ = {
"_edit_horizontal_guides_": [ ]
@@ -80,11 +81,11 @@ texture = ExtResource( 9 )
[node name="BodyPivot" type="Position2D" parent="."]
[node name="Body" type="Sprite" parent="BodyPivot"]
position = Vector2( 0, -58 )
position = Vector2( 0, -58.8242 )
texture = ExtResource( 10 )
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
position = Vector2( 0, -58 )
position = Vector2( 1.17401, -61.266 )
script = ExtResource( 11 )
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
@@ -92,7 +93,7 @@ wait_time = 0.2
one_shot = true
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
position = Vector2( 0, -58 )
position = Vector2( 1.17401, -61.266 )
script = ExtResource( 12 )
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
@@ -109,15 +110,11 @@ margin_top = -172.0
margin_right = 110.0
margin_bottom = -138.0
custom_fonts/font = SubResource( 4 )
text = "Idle"
text = "Test"
align = 1
valign = 1
uppercase = true
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"]
[connection signal="animation_finished" from="AnimationPlayer" to="StateMachine" method="_on_animation_finished"]

View File

@@ -4,15 +4,14 @@ var bullet = preload("Bullet.tscn")
func _unhandled_input(event):
if event.is_action_pressed("fire"):
fire()
fire(owner.look_direction)
func fire():
func fire(direction):
if not $CooldownTimer.is_stopped():
return
$CooldownTimer.start()
var new_bullet = bullet.instance()
new_bullet.direction = direction
add_child(new_bullet)
new_bullet.position = global_position
new_bullet.direction = owner.look_direction

View File

@@ -11,4 +11,4 @@ func _physics_process(_delta):
func _on_StateMachine_state_changed(current_state):
text = String(current_state.get_name())
text = current_state.get_name()

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Hierarchical Finite State Machine"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="GD Paint"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="HDR for 2D"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Hexagonal Game"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Scene Instancing Demo"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Isometric Game"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Kinematic Character 2D"

View File

@@ -266,5 +266,4 @@ shape = SubResource( 12 )
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2( 265, 247 )
current = true
[connection signal="body_entered" from="Princess" to="Princess" method="_on_body_entered"]

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="2D Lights as Mask"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="2D Lights and Shadows"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Navigation Polygon 2D"

View File

@@ -6,7 +6,7 @@ const MASS = 10.0
const ARRIVE_DISTANCE = 10.0
export(float) var speed = 200.0
var _state = States.IDLE
var _state = null
var _path = []
var _target_point_world = Vector2()

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Grid-based Pathfinding with Astar"

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="2D Particles"

View File

@@ -142,5 +142,4 @@ texture = ExtResource( 4 )
[node name="Enabler" type="VisibilityEnabler2D" parent="."]
rect = Rect2( -5, -5, 10, 10 )
pause_particles = false
[connection signal="body_entered" from="." to="." method="_on_body_enter"]

View File

@@ -83,5 +83,4 @@ one_shot = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/shutdown = SubResource( 4 )
[connection signal="timeout" from="Timer" to="." method="disable"]

View File

@@ -215,8 +215,8 @@ script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
hframes = 16
vframes = 2
hframes = 16
[node name="Smoke" type="Particles2D" parent="Sprite"]
self_modulate = Color( 1, 1, 1, 0.26702 )

View File

@@ -156,11 +156,10 @@ mipmap_policy=1
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=1
2d/snapping/use_gpu_pixel_snap=true
quality/2d/use_pixel_snap=true
quality/filters/anisotropic_filter_level=2
quality/filters/use_nearest_mipmap_filter=true
quality/depth/hdr=false
quality/2d/use_pixel_snap=true
[texture_import]

View File

@@ -193,6 +193,5 @@ max_lines_visible = 5
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="PanelLog/ButtonClear" to="PanelLog/ScrollLog/VBoxLog" method="clear"]
[connection signal="toggled" from="PanelLog/CheckBoxScroll" to="PanelLog/ScrollLog" method="set_auto_scroll"]

View File

@@ -33,12 +33,6 @@ _global_script_class_icons={
[application]
config/name="2D Physics Tests"
config/description="This demo contains a series of tests for the 2D physics engine.
They can be used for different purpose:
- Functional tests to check for regressions and behavior of the 2D physics engine
- Performance tests to evaluate performance of the 2D physics engine"
run/main_scene="res://main.tscn"
config/icon="res://icon.png"

View File

@@ -83,6 +83,23 @@ func create_rigidbody(shape, pickable = false, transform = Transform.IDENTITY):
return body
func create_rigidbody_collision(collision, pickable = false, transform = Transform.IDENTITY):
var collision_copy = collision.duplicate()
collision_copy.transform = transform
if collision is CollisionShape2D:
collision_copy.shape = collision.shape.duplicate()
var body = RigidBody2D.new()
body.add_child(collision_copy)
if pickable:
var script = load("res://utils/rigidbody_pick.gd")
body.set_script(script)
return body
func create_rigidbody_box(size, pickable = false, use_icon = false, transform = Transform.IDENTITY):
var shape = RectangleShape2D.new()
shape.extents = 0.5 * size

View File

@@ -50,10 +50,6 @@ var _tests = [
"id": "Performance Tests/Contacts",
"path": "res://tests/performance/test_perf_contacts.tscn",
},
{
"id" : "Performance Tests/Contact Islands",
"path" : "res://tests/performance/test_perf_contact_islands.tscn",
},
]

View File

@@ -92,7 +92,7 @@ func _initialize_collision_shapes():
for node in $Shapes.get_children():
var body = node as PhysicsBody2D
var shape = body.shape_owner_get_shape(0, 0)
shape.resource_name = String(node.name).substr("RigidBody".length())
shape.resource_name = node.name.substr("RigidBody".length())
_collision_shapes.push_back(shape)

View File

@@ -146,6 +146,5 @@ rect_min_size = Vector2( 120, 0 )
min_value = -1.0
max_value = 1.0
step = 0.01
[connection signal="value_changed" from="Controls/OffsetH/HSlider" to="." method="set_h_offset"]
[connection signal="value_changed" from="Controls/OffsetV/HSlider" to="." method="set_v_offset"]

View File

@@ -17,6 +17,13 @@ extents = Vector2( 32, 32 )
[node name="Test" type="Node2D"]
script = ExtResource( 1 )
_enable_debug_collision = true
_platform_size = 64.0
_platform_angle = 0.0
_platform_speed = 0.0
_body_angle = 0.0
_body_velocity = Vector2( 400, 0 )
_use_kinematic_body = false
[node name="LabelTestType" type="Label" parent="."]
margin_left = 14.0
@@ -238,7 +245,6 @@ texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
shape = SubResource( 3 )
[connection signal="value_changed" from="Controls/PlatformSize/HSlider" to="." method="_set_platform_size"]
[connection signal="value_changed" from="Controls/PlatformAngle/HSlider" to="." method="_set_platform_angle"]
[connection signal="value_changed" from="Controls/BodyAngle/HSlider" to="." method="_set_rigidbody_angle"]

View File

@@ -25,7 +25,7 @@ func _physics_process(_delta):
for node in $Shapes.get_children():
var body = node as PhysicsBody2D
var space_state = body.get_world_2d().direct_space_state
var body_name = String(body.name).substr("RigidBody".length())
var body_name = body.name.substr("RigidBody".length())
Log.print_log("* Testing: %s" % body_name)
@@ -45,7 +45,7 @@ func _physics_process(_delta):
res = _add_raycast(space_state, center, center + Vector2(0, 40))
Log.print_log("Raycast inside: %s" % ("HIT" if res else "NO HIT"))
if String(body.name).ends_with("ConcavePolygon"):
if body.name.ends_with("ConcavePolygon"):
# Raycast inside an internal face.
center.x += 20
res = _add_raycast(space_state, center, center + Vector2(0, 40))

View File

@@ -1,8 +1,7 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/texture/godot-head.png" type="Texture" id=1]
[ext_resource path="res://test.gd" type="Script" id=2]
[ext_resource path="res://utils/rigidbody_pick.gd" type="Script" id=3]
[ext_resource path="res://tests/static_scene.tscn" type="PackedScene" id=6]
[sub_resource type="RectangleShape2D" id=1]
@@ -22,7 +21,6 @@ script = ExtResource( 2 )
[node name="RigidBodyRectangle" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 96, 127 )
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyRectangle"]
rotation = 0.675442
@@ -30,7 +28,6 @@ shape = SubResource( 1 )
[node name="RigidBodyCapsule" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 270.165, 139.444 )
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyCapsule"]
rotation = -0.202458
@@ -38,7 +35,6 @@ shape = SubResource( 2 )
[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 683.614, 132.749 )
script = ExtResource( 3 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConcavePolygon"]
scale = Vector2( 0.5, 0.5 )
@@ -51,7 +47,6 @@ texture = ExtResource( 1 )
[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 473.536, 134.336 )
script = ExtResource( 3 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConvexPolygon"]
scale = Vector2( 0.5, 0.5 )
@@ -64,7 +59,6 @@ texture = ExtResource( 1 )
[node name="RigidBodySphere" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 919.968, 115.129 )
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodySphere"]
shape = SubResource( 3 )

View File

@@ -1,105 +0,0 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://tests/static_scene.tscn" type="PackedScene" id=1]
[ext_resource path="res://tests/performance/test_perf_contacts.gd" type="Script" id=2]
[ext_resource path="res://assets/texture/godot-head.png" type="Texture" id=3]
[ext_resource path="res://tests/test_options.tscn" type="PackedScene" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 5, 7 )
[sub_resource type="CircleShape2D" id=2]
radius = 5.0
[sub_resource type="CapsuleShape2D" id=3]
radius = 5.0
height = 7.0
[node name="Test" type="Node2D"]
script = ExtResource( 2 )
_enable_debug_collision = false
spawns = [ NodePath("SpawnTarget1"), NodePath("SpawnTarget2"), NodePath("SpawnTarget3"), NodePath("SpawnTarget4"), NodePath("SpawnTarget5"), NodePath("SpawnTarget6"), NodePath("SpawnTarget7"), NodePath("SpawnTarget8"), NodePath("SpawnTarget9") ]
spawn_count = 300
spawn_randomize = Vector2( 10, 10 )
[node name="Options" parent="." instance=ExtResource( 4 )]
[node name="SpawnTarget1" type="Node2D" parent="."]
position = Vector2( 145.646, 109.462 )
[node name="SpawnTarget2" type="Node2D" parent="."]
position = Vector2( 508.14, 109.113 )
[node name="SpawnTarget3" type="Node2D" parent="."]
position = Vector2( 873.995, 110.042 )
[node name="SpawnTarget4" type="Node2D" parent="."]
position = Vector2( 149.646, 301.462 )
[node name="SpawnTarget5" type="Node2D" parent="."]
position = Vector2( 512.14, 301.113 )
[node name="SpawnTarget6" type="Node2D" parent="."]
position = Vector2( 877.995, 302.042 )
[node name="SpawnTarget7" type="Node2D" parent="."]
position = Vector2( 165.646, 507.462 )
[node name="SpawnTarget8" type="Node2D" parent="."]
position = Vector2( 528.14, 507.113 )
[node name="SpawnTarget9" type="Node2D" parent="."]
position = Vector2( 893.995, 508.042 )
[node name="StaticScene" parent="." instance=ExtResource( 1 )]
visible = false
position = Vector2( 0, 125.017 )
[node name="DynamicShapes" type="Node2D" parent="."]
[node name="RigidBodyRectangle" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 0, 1024 )
gravity_scale = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyRectangle"]
shape = SubResource( 1 )
[node name="RigidBodySphere" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 100, 1024 )
gravity_scale = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodySphere"]
shape = SubResource( 2 )
[node name="RigidBodyCapsule" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 200, 1024 )
gravity_scale = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyCapsule"]
shape = SubResource( 3 )
[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 300, 1024 )
gravity_scale = 0.0
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConvexPolygon"]
scale = Vector2( 0.1, 0.1 )
polygon = PoolVector2Array( 10.7, -54.5, 28.3596, -49.4067, 47.6282, -34.3806, 57.9717, -20.9447, 50.9869, 35.2694, 38.8, 47.5, 15.9852, 54.3613, -14.9507, 54.1845, -36.5, 48.1, -50.4828, 36.33, -58.0115, -20.515, -46.9473, -34.7342, -26.0876, -50.1138, -11.4152, -54.5332 )
[node name="GodotIcon" type="Sprite" parent="DynamicShapes/RigidBodyConvexPolygon"]
self_modulate = Color( 1, 1, 1, 0.392157 )
scale = Vector2( 0.1, 0.1 )
texture = ExtResource( 3 )
[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 400, 1024 )
gravity_scale = 0.0
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConcavePolygon"]
scale = Vector2( 0.1, 0.1 )
polygon = PoolVector2Array( -5.93512, -43.2195, 6.44476, -42.9695, 11.127, -54.3941, 26.9528, -49.4309, 26.2037, -36.508, 37.5346, -28.1737, 47.6282, -34.3806, 58.0427, -20.9631, 51.113, -10.2876, 50.9869, 35.2694, 38.8, 47.5, 15.9852, 54.3613, -14.9507, 54.1845, -36.5, 48.1, -50.4828, 36.33, -51.3668, -9.98545, -57.8889, -20.5885, -46.9473, -34.7342, -37.4014, -28.547, -26.0876, -37.0323, -26.9862, -49.15, -11.4152, -54.5332 )
[node name="GodotIcon" type="Sprite" parent="DynamicShapes/RigidBodyConcavePolygon"]
self_modulate = Color( 1, 1, 1, 0.392157 )
scale = Vector2( 0.1, 0.1 )
texture = ExtResource( 3 )

View File

@@ -8,9 +8,8 @@ const OPTION_TYPE_CAPSULE = "Shape type/Capsule"
const OPTION_TYPE_CONVEX_POLYGON = "Shape type/Convex Polygon"
const OPTION_TYPE_CONCAVE_POLYGON = "Shape type/Concave Polygon"
export(Array, NodePath) var spawns = Array()
export(Array) var spawns = Array()
export(int) var spawn_count = 100
export(Vector2) var spawn_randomize
onready var options = $Options
@@ -91,7 +90,7 @@ func _on_option_selected(option):
func _find_type_index(type_name):
for type_index in range(_object_templates.size()):
var type_node = _object_templates[type_index]
if String(type_node.name).find(type_name) > -1:
if type_node.name.find(type_name) > -1:
return type_index
Log.print_error("Invalid shape type: " + type_name)
@@ -153,44 +152,31 @@ func _start_all_types():
func _spawn_objects(type_index):
var template_node = _object_templates[type_index]
Log.print_log("* Spawning: " + template_node.name)
for spawn in spawns:
var spawn_parent = get_node(spawn)
Log.print_log("* Spawning: " + template_node.name)
for _node_index in range(spawn_count):
# Create a new object and shape every time to avoid the overhead of connecting many bodies to the same shape.
var collision = template_node.get_child(0).duplicate()
if collision is CollisionShape2D:
collision.shape = collision.shape.duplicate()
var body = template_node.duplicate()
body.transform = Transform.IDENTITY
if spawn_randomize != Vector2.ZERO:
body.position.x = randf() * spawn_randomize.x
body.position.y = randf() * spawn_randomize.y
var prev_collision = body.get_child(0)
body.remove_child(prev_collision)
prev_collision.queue_free()
body.add_child(collision)
var collision = template_node.get_child(0)
var body = create_rigidbody_collision(collision, false, collision.transform)
body.set_sleeping(true)
spawn_parent.add_child(body)
func _activate_objects():
Log.print_log("* Activating")
for spawn in spawns:
var spawn_parent = get_node(spawn)
Log.print_log("* Activating")
for node_index in range(spawn_parent.get_child_count()):
var node = spawn_parent.get_child(node_index) as RigidBody2D
node.set_sleeping(false)
func _despawn_objects():
Log.print_log("* Despawning")
for spawn in spawns:
var spawn_parent = get_node(spawn)
@@ -198,6 +184,8 @@ func _despawn_objects():
if object_count == 0:
continue
Log.print_log("* Despawning")
# Remove objects in reversed order to avoid the overhead of changing children index in parent.
for object_index in range(object_count):
var node = spawn_parent.get_child(object_count - object_index - 1)

View File

@@ -6,20 +6,20 @@
[ext_resource path="res://tests/test_options.tscn" type="PackedScene" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 10, 15 )
extents = Vector2( 20, 30 )
[sub_resource type="CircleShape2D" id=2]
radius = 15.0
radius = 30.0
[sub_resource type="CapsuleShape2D" id=3]
height = 15.0
radius = 20.0
height = 30.0
[node name="Test" type="Node2D"]
script = ExtResource( 2 )
_enable_debug_collision = false
spawns = [ NodePath("SpawnTarget1") ]
spawn_count = 500
spawn_randomize = Vector2( 10, 10 )
spawn_count = 200
[node name="Options" parent="." instance=ExtResource( 4 )]
@@ -53,22 +53,22 @@ shape = SubResource( 3 )
position = Vector2( 300, 1024 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConvexPolygon"]
scale = Vector2( 0.25, 0.25 )
scale = Vector2( 0.5, 0.5 )
polygon = PoolVector2Array( 10.7, -54.5, 28.3596, -49.4067, 47.6282, -34.3806, 57.9717, -20.9447, 50.9869, 35.2694, 38.8, 47.5, 15.9852, 54.3613, -14.9507, 54.1845, -36.5, 48.1, -50.4828, 36.33, -58.0115, -20.515, -46.9473, -34.7342, -26.0876, -50.1138, -11.4152, -54.5332 )
[node name="GodotIcon" type="Sprite" parent="DynamicShapes/RigidBodyConvexPolygon"]
self_modulate = Color( 1, 1, 1, 0.392157 )
scale = Vector2( 0.25, 0.25 )
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 3 )
[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="DynamicShapes"]
position = Vector2( 400, 1024 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="DynamicShapes/RigidBodyConcavePolygon"]
scale = Vector2( 0.25, 0.25 )
scale = Vector2( 0.5, 0.5 )
polygon = PoolVector2Array( -5.93512, -43.2195, 6.44476, -42.9695, 11.127, -54.3941, 26.9528, -49.4309, 26.2037, -36.508, 37.5346, -28.1737, 47.6282, -34.3806, 58.0427, -20.9631, 51.113, -10.2876, 50.9869, 35.2694, 38.8, 47.5, 15.9852, 54.3613, -14.9507, 54.1845, -36.5, 48.1, -50.4828, 36.33, -51.3668, -9.98545, -57.8889, -20.5885, -46.9473, -34.7342, -37.4014, -28.547, -26.0876, -37.0323, -26.9862, -49.15, -11.4152, -54.5332 )
[node name="GodotIcon" type="Sprite" parent="DynamicShapes/RigidBodyConcavePolygon"]
self_modulate = Color( 1, 1, 1, 0.392157 )
scale = Vector2( 0.25, 0.25 )
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 3 )

View File

@@ -242,11 +242,10 @@ mipmap_policy=1
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=1
2d/snapping/use_gpu_pixel_snap=true
quality/2d/use_pixel_snap=true
quality/filters/anisotropic_filter_level=2
quality/filters/use_nearest_mipmap_filter=true
quality/depth/hdr=false
quality/2d/use_pixel_snap=true
[texture_import]

View File

@@ -13,7 +13,6 @@ onready var platform_detector = $PlatformDetector
onready var animation_player = $AnimationPlayer
onready var shoot_timer = $ShootAnimation
onready var sprite = $Sprite
onready var sound_jump = $Jump
onready var gun = sprite.get_node(@"Gun")
@@ -47,10 +46,6 @@ func _ready():
# - If you split the character into a state machine or more advanced pattern,
# you can easily move individual functions.
func _physics_process(_delta):
# Play jump sound
if Input.is_action_just_pressed("jump" + action_suffix) and is_on_floor():
sound_jump.play()
var direction = get_direction()
var is_jump_interrupted = Input.is_action_just_released("jump" + action_suffix) and _velocity.y < 0.0

View File

@@ -203,8 +203,8 @@ collision_mask = 8
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0, -14 )
texture = ExtResource( 2 )
hframes = 16
vframes = 2
hframes = 16
frame = 16
[node name="Gun" type="Position2D" parent="Sprite"]

View File

@@ -94,6 +94,5 @@ autostart = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/destroy = SubResource( 6 )
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="timeout" from="Timer" to="." method="destroy"]

View File

@@ -160,5 +160,4 @@ shape = SubResource( 3 )
[node name="Pickup" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@@ -84,7 +84,6 @@ margin_right = 105.0
margin_bottom = 50.0
[node name="Tween" type="Tween" parent="."]
[connection signal="pressed" from="ColorRect/CenterContainer/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"]
[connection signal="pressed" from="ColorRect/CenterContainer/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]
[connection signal="tween_all_completed" from="Tween" to="." method="_on_Tween_all_completed"]

View File

@@ -12,8 +12,6 @@ Note: There is a C# version available [here](https://github.com/godotengine/godo
Note: There is a VisualScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/visual_script/pong).
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/pong).
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/121
## How does it work?

View File

@@ -2,10 +2,10 @@ extends Area2D
const DEFAULT_SPEED = 100
var _speed = DEFAULT_SPEED
var direction = Vector2.LEFT
onready var _initial_pos = position
onready var _speed = DEFAULT_SPEED
func _process(delta):
_speed += delta * 2

View File

@@ -9,7 +9,7 @@ var _down
onready var _screen_size_y = get_viewport_rect().size.y
func _ready():
var n = String(name).to_lower()
var n = name.to_lower()
_up = n + "_move_up"
_down = n + "_move_down"
if n == "left":

View File

@@ -98,7 +98,6 @@ shape = SubResource( 4 )
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2( 320, 200 )
current = true
[connection signal="area_entered" from="Left" to="Left" method="_on_area_entered"]
[connection signal="area_entered" from="Right" to="Right" method="_on_area_entered"]
[connection signal="area_entered" from="LeftWall" to="LeftWall" method="_on_wall_area_entered"]

View File

@@ -8,6 +8,11 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Pong with GDScript"
@@ -65,8 +70,7 @@ right_move_up={
[rendering]
quality/driver/driver_name="GLES2"
2d/snapping/use_gpu_pixel_snap=true
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
vram_compression/import_etc2=false
quality/2d/use_pixel_snap=true
viewport/default_clear_color=Color( 0, 0, 0, 1 )

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Game.gd" type="Script" id=1]
[ext_resource path="res://combat/Combat.tscn" type="PackedScene" id=2]
[ext_resource path="res://grid_movement/Exploration.tscn" type="PackedScene" id=3]
[ext_resource path="res://screens/combat/Combat.tscn" type="PackedScene" id=2]
[ext_resource path="res://screens/exploration/Exploration.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
length = 0.5

View File

@@ -1,15 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://combat/combatants/Combatant.gd" type="Script" id=1]
[ext_resource path="res://combat/combatants/Health.gd" type="Script" id=2]
[ext_resource path="res://combat/combatants/sprites/Sprite.tscn" type="PackedScene" id=3]
[node name="Combatant" type="Node2D"]
script = ExtResource( 1 )
damage = 2
[node name="Health" type="Node" parent="."]
script = ExtResource( 2 )
life = 10
[node name="Sprite" parent="." instance=ExtResource( 3 )]

View File

@@ -34,5 +34,4 @@ margin_top = 32.0
margin_right = 1264.0
margin_bottom = 151.0
text = "Next"
[connection signal="button_up" from="Button" to="." method="_on_Button_button_up"]

View File

@@ -1,4 +1,4 @@
extends Pawn
extends "Pawn.gd"
onready var Grid = get_parent()
var lost = false

View File

@@ -0,0 +1,83 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://grid_movement/pawns/Actor.gd" type="Script" id=1]
[ext_resource path="res://grid_movement/pawns/character.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "bump"
length = 0.1
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.02, 0.04, 0.06, 0.08, 0.1 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( -1.5, -9 ), Vector2( 6.5, 2.5 ), Vector2( -11.5, 8.5 ), Vector2( 4, -5 ), Vector2( 0, 0 ) ]
}
[sub_resource type="Animation" id=2]
resource_name = "walk"
length = 0.25
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:self_modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = false
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.25 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0.9375, 0, 1 ), Color( 1, 1, 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Pivot/Sprite:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.15, 0.25 ),
"transitions": PoolRealArray( 1, 0.303143, 2.61003, 1 ),
"update": 0,
"values": [ Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 0, -20 ), Vector2( 1.43051e-06, -1.90735e-06 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Pivot/Sprite:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.05, 0.15, 0.25 ),
"transitions": PoolRealArray( 1, 0.354553, 1, 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ]
}
[node name="Actor" type="Node2D"]
position = Vector2( 32, 32 )
z_index = 1
script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/bump = SubResource( 1 )
anims/walk = SubResource( 2 )
[node name="Tween" type="Tween" parent="."]
[node name="Pivot" type="Position2D" parent="."]
[node name="Sprite" type="Sprite" parent="Pivot"]
texture = ExtResource( 2 )
centered = false
offset = Vector2( -32, -32 )

View File

@@ -1,4 +1,4 @@
extends Pawn
extends "Pawn.gd"
#warning-ignore:unused_class_variable
export(PackedScene) var combat_actor

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://grid_movement/pawns/Walker.gd" type="Script" id=1]
[ext_resource path="res://grid_movement/pawns/character.png" type="Texture" id=2]
[ext_resource path="res://grid_movement/pawns/sprite.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "bump"
@@ -61,7 +61,7 @@ tracks/2/keys = {
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ]
}
[node name="Character" type="Node2D"]
[node name="Actor" type="Node2D"]
position = Vector2( 32, 32 )
z_index = 1
script = ExtResource( 1 )

View File

@@ -0,0 +1,8 @@
extends "Actor.gd"
func _ready():
set_process(false)
func get_input_direction():
return Vector2.ZERO

View File

@@ -1,4 +1,3 @@
class_name Pawn
extends Node2D
enum CellType { ACTOR, OBSTACLE, OBJECT }

View File

@@ -0,0 +1,16 @@
extends "Actor.gd"
const DIRECTIONS = [-1, 1]
func get_input_direction():
if not active:
return Vector2()
var random_x = DIRECTIONS[randi() % DIRECTIONS.size()]
var random_y = DIRECTIONS[randi() % DIRECTIONS.size()]
var random_axis = randi() % 2
if random_axis > 0:
random_x = 0
else:
random_y = 0
return Vector2(random_x, random_y)

View File

@@ -1,6 +1,6 @@
extends Pawn
extends "Pawn.gd"
onready var parent = get_parent()
onready var Grid = get_parent()
#warning-ignore:unused_class_variable
export(PackedScene) var combat_actor
#warning-ignore:unused_class_variable
@@ -16,7 +16,7 @@ func _process(_delta):
return
update_look_direction(input_direction)
var target_position = parent.request_move(self, input_direction)
var target_position = Grid.request_move(self, input_direction)
if target_position:
move_to(target_position)
$Tween.start()

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/object.png-105b8788e1883723a96438fd97d5db23.stex"
path="res://.import/sprite.png-e28cedc69371816a3468e6325b327ece.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/grid/tiles/object.png"
dest_files=[ "res://.import/object.png-105b8788e1883723a96438fd97d5db23.stex" ]
source_file="res://grid_movement/pawns/sprite.png"
dest_files=[ "res://.import/sprite.png-e28cedc69371816a3468e6325b327ece.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 698 B

After

Width:  |  Height:  |  Size: 698 B

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/actor.png-c322bfa3077f1c55a7d6251f76155bcc.stex"
path="res://.import/actor.png-147dff690f83be8a2c66a5bfa83da49f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/grid/tiles/actor.png"
dest_files=[ "res://.import/actor.png-c322bfa3077f1c55a7d6251f76155bcc.stex" ]
source_file="res://grid_movement/tilesets/grid/actor.png"
dest_files=[ "res://.import/actor.png-147dff690f83be8a2c66a5bfa83da49f.stex" ]
[params]

View File

@@ -1,8 +1,8 @@
[gd_resource type="TileSet" load_steps=4 format=2]
[ext_resource path="res://grid_movement/grid/tiles/actor.png" type="Texture" id=1]
[ext_resource path="res://grid_movement/grid/tiles/obstacle.png" type="Texture" id=2]
[ext_resource path="res://grid_movement/grid/tiles/object.png" type="Texture" id=3]
[ext_resource path="res://grid_movement/tilesets/grid/actor.png" type="Texture" id=1]
[ext_resource path="res://grid_movement/tilesets/grid/obstacle.png" type="Texture" id=2]
[ext_resource path="res://grid_movement/tilesets/grid/object.png" type="Texture" id=3]
[resource]

View File

Before

Width:  |  Height:  |  Size: 913 B

After

Width:  |  Height:  |  Size: 913 B

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/shadow.png-d8772fa49c8867b55809e76164b76188.stex"
path="res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://combat/combatants/sprites/shadow.png"
dest_files=[ "res://.import/shadow.png-d8772fa49c8867b55809e76164b76188.stex" ]
source_file="res://grid_movement/tilesets/grid/object.png"
dest_files=[ "res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 103 B

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/obstacle.png-bd15bb10c9507019dfb2cad5661bca49.stex"
path="res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/grid/tiles/obstacle.png"
dest_files=[ "res://.import/obstacle.png-bd15bb10c9507019dfb2cad5661bca49.stex" ]
source_file="res://grid_movement/tilesets/grid/obstacle.png"
dest_files=[ "res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 111 B

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/grid_lines.png-52aa706884a3dba960110e63cdf54a8c.stex"
path="res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/grid/lines/grid_lines.png"
dest_files=[ "res://.import/grid_lines.png-52aa706884a3dba960110e63cdf54a8c.stex" ]
source_file="res://grid_movement/tilesets/grid_lines/grid_lines.png"
dest_files=[ "res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.stex" ]
[params]

View File

@@ -1,6 +1,6 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://grid_movement/grid/lines/grid_lines.png" type="Texture" id=1]
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
[resource]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -8,20 +8,9 @@
config_version=4
_global_script_classes=[ {
"base": "Node",
"class": "Combatant",
"language": "GDScript",
"path": "res://combat/combatants/Combatant.gd"
}, {
"base": "Node2D",
"class": "Pawn",
"language": "GDScript",
"path": "res://grid_movement/pawns/Pawn.gd"
} ]
_global_script_classes=[ ]
_global_script_class_icons={
"Combatant": "",
"Pawn": ""
}
[application]

View File

@@ -1,6 +1,7 @@
extends Node
signal combat_finished(winner, loser)
const Combatant = preload("res://turn_combat/combatants/Combatant.gd")
func initialize(combat_combatants):
for combatant in combat_combatants:

View File

@@ -1,10 +1,10 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://combat/Combat.gd" type="Script" id=1]
[ext_resource path="res://combat/TurnQueue.gd" type="Script" id=2]
[ext_resource path="res://screens/combat/Combat.gd" type="Script" id=1]
[ext_resource path="res://turn_combat/turn_queue/TurnQueue.tscn" type="PackedScene" id=2]
[ext_resource path="res://theme/theme.tres" type="Theme" id=3]
[ext_resource path="res://combat/interface/UI.gd" type="Script" id=4]
[ext_resource path="res://combat/interface/Info.tscn" type="PackedScene" id=5]
[ext_resource path="res://screens/combat/interface/UI.gd" type="Script" id=4]
[ext_resource path="res://screens/combat/interface/Info.tscn" type="PackedScene" id=5]
[sub_resource type="GDScript" id=1]
script/source = "extends Node2D
@@ -21,8 +21,7 @@ script = ExtResource( 1 )
position = Vector2( 539, 275 )
script = SubResource( 1 )
[node name="TurnQueue" type="Node" parent="."]
script = ExtResource( 2 )
[node name="TurnQueue" parent="." instance=ExtResource( 2 )]
combatants_list = NodePath("../Combatants")
[node name="UI" type="Control" parent="."]
@@ -79,7 +78,6 @@ margin_bottom = 242.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Flee"
[connection signal="button_up" from="UI/Buttons/GridContainer/Attack" to="UI" method="_on_Attack_button_up"]
[connection signal="button_up" from="UI/Buttons/GridContainer/Defend" to="UI" method="_on_Defend_button_up"]
[connection signal="button_up" from="UI/Buttons/GridContainer/Flee" to="UI" method="_on_Flee_button_up"]

View File

@@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://turn_combat/combatants/Combatant.gd" type="Script" id=1]
[ext_resource path="res://turn_combat/combatants/health/Health.tscn" type="PackedScene" id=2]
[ext_resource path="res://screens/combat/actors/sprites/Sprite.tscn" type="PackedScene" id=3]
[node name="Actor" type="Node2D"]
script = ExtResource( 1 )
damage = 2
[node name="Health" parent="." instance=ExtResource( 2 )]
life = 10
[node name="Sprite" parent="." instance=ExtResource( 3 )]

View File

@@ -0,0 +1,39 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://screens/combat/actors/Actor.tscn" type="PackedScene" id=1]
[ext_resource path="res://screens/combat/actors/sprites/green.png" type="Texture" id=2]
[sub_resource type="GDScript" id=1]
script/source = "extends \"res://turn_combat/combatants/Combatant.gd\"
func set_active(value):
.set_active(value)
if not active:
return
$Timer.start()
yield($Timer, \"timeout\")
var target
for actor in get_parent().get_children():
if not actor == self:
target = actor
break
attack(target)"
[node name="Opponent" instance=ExtResource( 1 )]
script = SubResource( 1 )
damage = 3
defense = 0
[node name="Health" parent="." index="0"]
life = 7
max_life = 7
[node name="Body" parent="Sprite/Pivot" index="1"]
texture = ExtResource( 2 )
[node name="Timer" type="Timer" parent="." index="2"]
wait_time = 0.25
one_shot = true
[editable path="Sprite"]

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://screens/combat/actors/Actor.tscn" type="PackedScene" id=1]
[node name="Player" instance=ExtResource( 1 )]
defense = 2

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://combat/combatants/sprites/shadow.png" type="Texture" id=1]
[ext_resource path="res://combat/combatants/sprites/blue.png" type="Texture" id=2]
[ext_resource path="res://screens/combat/actors/sprites/shadow.png" type="Texture" id=1]
[ext_resource path="res://screens/combat/actors/sprites/blue.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "take_damage"

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/blue.png-8092cf6d59f8b71b187a850a15aa9759.stex"
path="res://.import/blue.png-127e2b8d7aa8f4a7572c4923c2b20228.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://combat/combatants/sprites/blue.png"
dest_files=[ "res://.import/blue.png-8092cf6d59f8b71b187a850a15aa9759.stex" ]
source_file="res://screens/combat/actors/sprites/blue.png"
dest_files=[ "res://.import/blue.png-127e2b8d7aa8f4a7572c4923c2b20228.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/green.png-d2deadceb974a66b9f9b9df11dc41501.stex"
path="res://.import/green.png-7937ec3931675b5dd0f218cbb8ae006a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://combat/combatants/sprites/green.png"
dest_files=[ "res://.import/green.png-d2deadceb974a66b9f9b9df11dc41501.stex" ]
source_file="res://screens/combat/actors/sprites/green.png"
dest_files=[ "res://.import/green.png-7937ec3931675b5dd0f218cbb8ae006a.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 741 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/shadow.png-3c36ca984d4b9e8eba8c422537f5ca42.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://screens/combat/actors/sprites/shadow.png"
dest_files=[ "res://.import/shadow.png-3c36ca984d4b9e8eba8c422537f5ca42.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -0,0 +1,36 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=1]
[node name="ActorInfo" type="PanelContainer"]
margin_right = 409.0
margin_bottom = 239.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 402.0
margin_bottom = 232.0
[node name="Name" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 395.0
margin_bottom = 110.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "{name}"
[node name="Health" type="ProgressBar" parent="VBoxContainer"]
margin_top = 168.0
margin_right = 395.0
margin_bottom = 170.0
size_flags_vertical = 6
max_value = 10.0
step = 1.0
value = 5.0
rounded = true
percent_visible = false

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://theme/fonts/montserrat_extra_bold_48.tres" type="DynamicFont" id=1]
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=1]
[node name="Info" type="PanelContainer"]
margin_right = 409.0
@@ -17,22 +17,12 @@ margin_top = 7.0
margin_right = 402.0
margin_bottom = 232.0
[node name="Name" type="Label" parent="VBoxContainer"]
[node name="Name" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 395.0
margin_bottom = 110.0
size_flags_horizontal = 3
size_flags_vertical = 7
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_shadow = Color( 1, 0.596078, 0, 1 )
custom_constants/shadow_offset_y = 5
text = "{name}"
align = 1
autowrap = true
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Health" type="ProgressBar" parent="VBoxContainer"]
margin_top = 168.0

View File

@@ -1,12 +1,12 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://grid_movement/grid/lines/grid_lines_tileset.tres" type="TileSet" id=1]
[ext_resource path="res://grid_movement/grid/tiles/grid_tileset.tres" type="TileSet" id=2]
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines_tileset.tres" type="TileSet" id=1]
[ext_resource path="res://grid_movement/tilesets/grid/grid_tileset.tres" type="TileSet" id=2]
[ext_resource path="res://grid_movement/grid/Grid.gd" type="Script" id=3]
[ext_resource path="res://grid_movement/pawns/Character.tscn" type="PackedScene" id=4]
[ext_resource path="res://combat/combatants/Player.tscn" type="PackedScene" id=5]
[ext_resource path="res://grid_movement/pawns/Opponent.gd" type="Script" id=6]
[ext_resource path="res://combat/combatants/Opponent.tscn" type="PackedScene" id=7]
[ext_resource path="res://turn_combat/combatants/Player.tscn" type="PackedScene" id=5]
[ext_resource path="res://grid_movement/pawns/Character.gd" type="Script" id=6]
[ext_resource path="res://turn_combat/combatants/Opponent.tscn" type="PackedScene" id=7]
[ext_resource path="res://dialogue/dialogue_player/DialoguePlayer.tscn" type="PackedScene" id=8]
[ext_resource path="res://grid_movement/pawns/Pawn.gd" type="Script" id=9]
[ext_resource path="res://dialogue/interface/Interface.tscn" type="PackedScene" id=10]

View File

@@ -0,0 +1,103 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://theme/theme.tres" type="Theme" id=1]
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=2]
[ext_resource path="res://theme/fonts/montserrat_extra_bold_24.tres" type="DynamicFont" id=3]
[ext_resource path="res://theme/progressbar/foreground_stylebox_red.tres" type="StyleBox" id=4]
[ext_resource path="res://theme/progressbar/foreground_stylebox_blue.tres" type="StyleBox" id=5]
[sub_resource type="GDScript" id=1]
script/source = "extends VBoxContainer
func _ready():
set_process(false)
func _process(delta):
for p in get_children():
$ProgressBarBlue.value += 10 * delta
$ProgressBarRed.value += 10 * delta
func _on_Button_button_down():
set_process(true)
func _on_Button_button_up():
set_process(false)
"
[node name="Control" type="Control"]
margin_right = 1024.0
margin_bottom = 600.0
theme = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Panel" type="Panel" parent="."]
margin_left = 128.0
margin_top = 64.0
margin_right = 896.0
margin_bottom = 536.0
[node name="Title" parent="Panel" instance=ExtResource( 2 )]
margin_right = 767.0
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
margin_left = 128.0
margin_top = 180.0
margin_right = 524.0
margin_bottom = 424.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 5
script = SubResource( 1 )
[node name="Speed" type="Label" parent="Panel/VBoxContainer"]
margin_right = 396.0
margin_bottom = 40.0
custom_fonts/font = ExtResource( 3 )
text = "Speed"
[node name="ProgressBarRed" type="ProgressBar" parent="Panel/VBoxContainer"]
margin_top = 45.0
margin_right = 396.0
margin_bottom = 85.0
custom_styles/fg = ExtResource( 4 )
step = 1.0
percent_visible = false
[node name="BlankSpace" type="ReferenceRect" parent="Panel/VBoxContainer"]
margin_top = 90.0
margin_right = 396.0
margin_bottom = 154.0
rect_min_size = Vector2( 0, 16 )
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Acceleration" type="Label" parent="Panel/VBoxContainer"]
margin_top = 159.0
margin_right = 396.0
margin_bottom = 199.0
custom_fonts/font = ExtResource( 3 )
text = "Acceleration"
[node name="ProgressBarBlue" type="ProgressBar" parent="Panel/VBoxContainer"]
margin_top = 204.0
margin_right = 396.0
margin_bottom = 244.0
custom_styles/fg = ExtResource( 5 )
step = 1.0
percent_visible = false
[node name="Button" type="Button" parent="Panel"]
margin_left = 531.0
margin_top = 258.0
margin_right = 664.0
margin_bottom = 377.0
size_flags_horizontal = 2
size_flags_vertical = 4
size_flags_stretch_ratio = 0.0
text = "Add"
[connection signal="button_down" from="Panel/Button" to="Panel/VBoxContainer" method="_on_Button_button_down"]
[connection signal="button_up" from="Panel/Button" to="Panel/VBoxContainer" method="_on_Button_button_up"]

Some files were not shown because too many files have changed in this diff Show More