Compare commits

..

61 Commits
3.2 ... 3.3

Author SHA1 Message Date
Aaron Franke
bf94d62472 [3.3] Simplify list of branches in the README (#1255) 2025-10-02 17:00:58 -07:00
Rémi Verschelde
95d97d9001 Update README for new branches, matches Godot upstream
(cherry picked from commit c0180d20d1)
2023-02-28 18:36:34 +01:00
Aaron Franke
53ea602c07 Update README for the new 3.3 branch 2021-11-05 10:15:06 -05:00
Aaron Franke
874d3bcc33 Merge pull request #657 from Calinou/allow-fallback-gles2
Allow 3D demos to fallback to GLES2
2021-11-05 11:07:01 -04:00
Hugo Locurcio
cbb5c94c6f Allow 3D demos to fallback to GLES2
A GLES2-specific tweak is now documented for the GUI in 3D demo.

This also tweaks shadow quality and performance to find a better
balance and result in smoother shadows, including when using GLES2
(thanks to the use of PCF13 shadow filter mode).

In demos that allow falling back to GLES2, ETC1 texture import
is enabled to allow exporting to Android or HTML5 without having
to tweak anything.
2021-11-05 09:57:51 -05:00
Aaron Franke
44aefaecb6 Merge pull request #655 from Calinou/bullet-shower-no-check-collision-with-other-bullets
Don't check bullet collision with other bullets in the Bullet shower demo
2021-10-26 10:33:38 -04:00
Hugo Locurcio
7a7af4cf4e Don't check bullet collision with other bullets in the Bullet shower demo
This improves performance by reducing the number of collision checks
that need to be done.
2021-10-25 23:16:29 +02:00
Rémi Verschelde
1916f87ac5 Merge pull request #654 from aaronfranke/circlepop-noready 2021-10-15 21:54:09 +02:00
Aaron Franke
36e8b45bd4 Remove useless "_ready" in the Circle Pop demo 2021-10-15 14:35:14 -05:00
Rémi Verschelde
89b64e33e2 CI: Ping actions/checkout@v2, no need to be more specific 2021-10-15 21:20:16 +02:00
Gunnar Ahlberg
2b10e6724e Fix leaked object - Label (#648)
This fixes a warning of leaked instances.
2021-09-13 00:05:26 -05:00
Hugo Locurcio
b9685cb369 Merge pull request #645 from Calinou/use-remotesync-keyword
Use `remotesync` instead of the deprecated `sync` in networking demos
2021-08-29 17:09:25 +02:00
Hugo Locurcio
d1f25ca4aa Use remotesync instead of the deprecated sync in networking demos
The `sync` keyword has been deprecated since Godot 3.1.
2021-08-29 12:22:37 +02:00
Aaron Franke
11a72411cc Merge pull request #644 from Calinou/ci-update-to-godot-3.3.3
GitHub Actions: Update to Godot 3.3.3 for HTML5 deployment
2021-08-22 14:55:44 -05:00
Hugo Locurcio
5057fcff50 GitHub Actions: Update to Godot 3.3.3 for HTML5 deployment 2021-08-22 11:56:01 +02:00
Aaron Franke
d791cd9bda Merge pull request #643 from shahediqbal13/mono-iap-signal-mismatch
Google play billing method signature mismatch in demo with Godot's android billing plugin method
2021-08-18 18:46:42 -04:00
Shahed Iqbal
7d7c728227 Fixes following issues:
1. Google play billing method(OnGodotGooglePlayBilling_sku_details_query_error) signature in GooglePlayBilling class doesn't match with Godot's android library exposed method
Check: https://github.com/godotengine/godot-google-play-billing/blob/master/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java
Line: 236.

2. "OnConnectError" method signature mismatch
2021-08-19 03:23:44 +06:00
Aaron Franke
5fb81434e7 Merge pull request #642 from nathanfranke/opensimplexnoise-improvements
Simplify and improve OpenSimplexNoise viewer
2021-08-18 00:05:26 -04:00
Nathan Franke
c3c4fdf4fa Simplify and improve OpenSimplexNoise viewer 2021-08-17 23:02:55 -05:00
Aaron Franke
9ea18370d3 Add link to the Godot Asset Library for Skeleton2D 2021-08-17 21:03:15 -05:00
Aaron Franke
f9333dce01 Merge pull request #640 from shahediqbal13/mono-iap-signal-mismatch
Mono IAP signal method definition mismatch.
2021-08-17 21:24:11 -04:00
Aaron Franke
84a87a5128 Merge pull request #641 from aaronfranke/desc
Ensure most demos have descriptions and screenshots
2021-08-17 20:49:22 -04:00
Aaron Franke
7d64830cfe Ensure most demos have descriptions and screenshots 2021-08-16 21:13:06 -05:00
Shahed Iqbal
f08916c90f Mono IAP signal method definition mismatch. Updated OnPurchaseConsumptionError() method to match with GooglePlayBilling's signal 2021-08-15 02:48:05 +06:00
Aaron Franke
89978a7421 Merge pull request #636 from Powerbyte7/patch-1
Fix jumps in scale and rotation when pinching
2021-07-18 11:19:48 -07:00
Powerbyte7
6ca2a45a21 Fix jumps in scale and rotation when pinching
When pressing with two fingers at once and pinching,  an old coordinate contained in the curr_state dictionary gets added to the base_state dictionary, which causes unintended jumps in both scale and rotation. By clearing base_state the script functions as intended.
2021-07-18 17:00:59 +02:00
Agnis "NeZvērs" Aldiņš
57f8628b50 Update impact, rigid groundcheck, moving platform (#634) 2021-07-17 13:00:51 -04:00
Aaron Franke
a4e8231f5a Merge pull request #635 from aaronfranke/tweaks
Minor tweaks to Pong and Dodge the Creeps
2021-07-12 13:15:01 -07:00
Aaron Franke
f71816ed31 Minor tweaks to Pong and Dodge the Creeps 2021-07-11 13:08:01 -04:00
Aaron Franke
ef069d49ae Merge pull request #632 from aaronfranke/fsm-bullets
Fix bullets in the Finite State Machine demo
2021-07-06 20:34:41 -04:00
Aaron Franke
742ea87708 Merge pull request #633 from starptr/master
Use the Jump sound already present in the Platformer 2D demo
2021-07-06 20:32:50 -04:00
Yuto Nishida
45f5417822 Add jump sound effect 2021-07-06 16:40:15 -07:00
Aaron Franke
f28a09ea0d Fix bullets in the Finite State Machine demo 2021-07-05 01:09:50 -04:00
Aaron Franke
85c1805d33 Merge pull request #631 from aaronfranke/not
Use "not" instead of the exclamation mark in GDScript files
2021-07-05 01:00:28 -04:00
Aaron Franke
7e129db12e Use "not" instead of the exclamation mark in GDScript files
Also add String casts
2021-07-04 03:46:21 -04:00
Aaron Franke
7bfc57d1ae Merge pull request #628 from aaronfranke/skeleton2d
Add a Skeleton2D demo
2021-06-25 19:19:26 -04:00
Aaron Franke
cd48c9a9cc Add a Skeleton2D demo 2021-06-25 19:12:53 -04:00
Rémi Verschelde
244b759787 Merge pull request #627 from aaronfranke/no-builtin-e
Replace built-in scripts and delete strange "e" scripts
2021-06-21 20:57:16 +02:00
Aaron Franke
6875a21545 Replace built-in scripts and delete strange "e" scripts 2021-06-21 12:33:42 -04:00
Aaron Franke
694ee7fa36 Merge pull request #626 from aaronfranke/jrpg-simplify
Vastly simplify the JRPG demo
2021-06-21 12:22:44 -04:00
Aaron Franke
6e3db7c64d Vastly simplify the JRPG demo 2021-06-20 22:47:24 -04:00
Agnis "NeZvērs" Aldiņš
2d4d23302a 3D physics tests - Moving platform (#623) 2021-06-09 20:57:49 -04:00
Aaron Franke
4456027f91 Merge pull request #625 from aaronfranke/3d2d-robot
Simplify 3D robot in the 3D in 2D demo
2021-06-07 09:40:49 -04:00
Aaron Franke
19312b2899 Simplify 3D robot in the 3D in 2D demo 2021-06-06 23:28:53 -04:00
Aaron Franke
ca17967de1 Merge pull request #622 from aaronfranke/waypoint-camera-current
Have waypoints check if the camera is current
2021-05-29 03:19:57 -04:00
Aaron Franke
491fb265b1 Have waypoints check if the camera is current
If not, get the current camera.
2021-05-29 03:16:07 -04:00
Agnis "NeZvērs" Aldiņš
08be1b7f03 Additional 3D physics tests - RigidBody impact and ground check (#619)
Co-authored-by: Camille Mohr-Daurat <pouleyKetchoup@gmail.com>
2021-05-29 02:58:01 -04:00
Aaron Franke
4ef90a836a Merge pull request #621 from nellodotca/master
Fixed project settings to match tutorial
2021-05-24 21:09:43 -04:00
nello
bfd903a933 Fixed project settings to match tutorial 2021-05-24 19:14:12 -03:00
Aaron Franke
e0db0b8f6d Merge pull request #615 from nekomatata/physics-tests-draw-shape-clean
Fix hack to draw shapes in 3D physics tests
2021-05-19 15:45:22 -04:00
PouleyKetchoupp
4d21951b71 Fix hack to draw shapes in 3D physics tests
Using Shape::get_debug_mesh instead of the previous hack to draw a mesh
instance based on a collision shape.
2021-05-05 13:41:51 -07:00
Aaron Franke
7656c08454 Merge pull request #614 from aaronfranke/gridmap-perf
Improve performance in GridMap demos by adjusting octant size
2021-05-04 15:22:10 -04:00
Aaron Franke
e894e4655a Improve performance in GridMap demos 2021-05-04 02:48:32 -04:00
Aaron Franke
2ce76ff4e5 Update web deploy CI to use Godot 3.3 2021-04-24 04:20:39 -04:00
Aaron Franke
e5d829eb8f Merge pull request #613 from nekomatata/physics-tests-contacts-update
Update contact tests in physics tests for 2D & 3D
2021-04-24 02:32:19 -05:00
PouleyKetchoupp
7f025e000e Update contact tests in physics tests for 2D & 3D
- Create bodies by duplicating the ones from the scene to allow custom
settings on them for testing purpose
- Rename 3D test with multiple groups of bodies "Contact Islands"
instead of "Contacts Extended" for clarity
- Added "Contact Islands" test for 2D
- Fixed log spamming with "Contact Islands" tests due to printing log
messages for each group of bodies
- Added parameter to randomize spawn positions in order to make
contact separation more balanced (avoids artifacts like a huge column
for circles in 2D test)
- Using smaller shapes and larger amount of objects by default to test
more extreme case
2021-04-21 18:25:35 -07:00
Aaron Franke
5132941a84 Merge pull request #612 from nekomatata/physics-tests-3.3
Physics Tests 3.3 update
2021-04-21 19:51:44 -05:00
PouleyKetchoupp
ef265cca0a Physics Tests 3.3 update
Fix custom collision shape drawing in physics tests:
CollisionShape debug draw has changed in 3.3 and now requires a body
to be rendered, so the trick to display custom physics shapes in the
physics tests had to be updated.

Cylinder support:
Now cylinders are supported in Godot Physics, so the exception to avoid
spamming errors when cylinders are used can be removed.

Rigid body picking:
Added mouse-picking to Test Shapes in both 2D and 3D.
2021-04-21 16:50:33 -07:00
Aaron Franke
31bb09233b Update the OS test demo for Godot 3.3 2021-04-21 19:30:53 -04:00
Aaron Franke
57f5e0835d Merge pull request #558 from aaronfranke/update-3.2.4
Update projects to Godot 3.3
2021-04-21 18:20:01 -05:00
Aaron Franke
814909538f Update projects to Godot 3.3 2021-04-21 19:17:12 -04:00
479 changed files with 5652 additions and 1947 deletions

View File

@@ -38,6 +38,10 @@ 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,5 +29,6 @@ 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,5 +53,6 @@ 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.
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
# Choose the velocity for the mob.
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
mob.linear_velocity = velocity.rotated(direction)

View File

@@ -47,6 +47,7 @@ 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,9 +1,5 @@
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()
@@ -12,7 +8,3 @@ func _ready():
func _on_VisibilityNotifier2D_screen_exited():
queue_free()
func _on_start_game():
queue_free()

View File

@@ -50,4 +50,5 @@ 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,4 +67,5 @@ 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,12 +14,16 @@ 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 &copy; 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,11 +8,6 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Dodge the Creeps"
@@ -29,6 +24,8 @@ 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.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,15 +1,50 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://debug/Explanations.tscn" type="PackedScene" id=2]
[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="Explanations" parent="." instance=ExtResource( 2 )]
[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="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 += state.get_name() + "\n"
states_names += String(state.get_name()) + "\n"
numbers += str(index) + "\n"
index += 1
$States.text = states_names

View File

@@ -41,7 +41,6 @@ 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_": [ ]
@@ -81,11 +80,11 @@ texture = ExtResource( 9 )
[node name="BodyPivot" type="Position2D" parent="."]
[node name="Body" type="Sprite" parent="BodyPivot"]
position = Vector2( 0, -58.8242 )
position = Vector2( 0, -58 )
texture = ExtResource( 10 )
[node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
position = Vector2( 1.17401, -61.266 )
position = Vector2( 0, -58 )
script = ExtResource( 11 )
[node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
@@ -93,7 +92,7 @@ wait_time = 0.2
one_shot = true
[node name="WeaponPivot" type="Position2D" parent="BodyPivot"]
position = Vector2( 1.17401, -61.266 )
position = Vector2( 0, -58 )
script = ExtResource( 12 )
[node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot"]
@@ -110,11 +109,15 @@ margin_top = -172.0
margin_right = 110.0
margin_bottom = -138.0
custom_fonts/font = SubResource( 4 )
text = "Test"
text = "Idle"
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,14 +4,15 @@ var bullet = preload("Bullet.tscn")
func _unhandled_input(event):
if event.is_action_pressed("fire"):
fire(owner.look_direction)
fire()
func fire(direction):
func fire():
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 = current_state.get_name()
text = String(current_state.get_name())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -266,4 +266,5 @@ 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,11 +8,6 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="2D Lights as Mask"

View File

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

View File

@@ -8,11 +8,6 @@
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 = null
var _state = States.IDLE
var _path = []
var _target_point_world = Vector2()

View File

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

View File

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

View File

@@ -142,4 +142,5 @@ 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,4 +83,5 @@ 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 )
vframes = 2
hframes = 16
vframes = 2
[node name="Smoke" type="Particles2D" parent="Sprite"]
self_modulate = Color( 1, 1, 1, 0.26702 )

View File

@@ -156,10 +156,11 @@ mipmap_policy=1
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=1
quality/2d/use_pixel_snap=true
2d/snapping/use_gpu_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,5 +193,6 @@ 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,6 +33,12 @@ _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,23 +83,6 @@ 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,6 +50,10 @@ 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 = node.name.substr("RigidBody".length())
shape.resource_name = String(node.name).substr("RigidBody".length())
_collision_shapes.push_back(shape)

View File

@@ -146,5 +146,6 @@ 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,13 +17,6 @@ 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
@@ -245,6 +238,7 @@ 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 = body.name.substr("RigidBody".length())
var body_name = String(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 body.name.ends_with("ConcavePolygon"):
if String(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,7 +1,8 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 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]
@@ -21,6 +22,7 @@ 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
@@ -28,6 +30,7 @@ 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
@@ -35,6 +38,7 @@ 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 )
@@ -47,6 +51,7 @@ 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 )
@@ -59,6 +64,7 @@ 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

@@ -0,0 +1,105 @@
[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,8 +8,9 @@ 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) var spawns = Array()
export(Array, NodePath) var spawns = Array()
export(int) var spawn_count = 100
export(Vector2) var spawn_randomize
onready var options = $Options
@@ -90,7 +91,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 type_node.name.find(type_name) > -1:
if String(type_node.name).find(type_name) > -1:
return type_index
Log.print_error("Invalid shape type: " + type_name)
@@ -152,31 +153,44 @@ 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)
var body = create_rigidbody_collision(collision, false, collision.transform)
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)
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)
@@ -184,8 +198,6 @@ 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( 20, 30 )
extents = Vector2( 10, 15 )
[sub_resource type="CircleShape2D" id=2]
radius = 30.0
radius = 15.0
[sub_resource type="CapsuleShape2D" id=3]
radius = 20.0
height = 30.0
height = 15.0
[node name="Test" type="Node2D"]
script = ExtResource( 2 )
_enable_debug_collision = false
spawns = [ NodePath("SpawnTarget1") ]
spawn_count = 200
spawn_count = 500
spawn_randomize = Vector2( 10, 10 )
[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.5, 0.5 )
scale = Vector2( 0.25, 0.25 )
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.5, 0.5 )
scale = Vector2( 0.25, 0.25 )
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.5, 0.5 )
scale = Vector2( 0.25, 0.25 )
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.5, 0.5 )
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 3 )

View File

@@ -242,10 +242,11 @@ mipmap_policy=1
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=1
quality/2d/use_pixel_snap=true
2d/snapping/use_gpu_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,6 +13,7 @@ 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")
@@ -46,6 +47,10 @@ 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 )
vframes = 2
hframes = 16
vframes = 2
frame = 16
[node name="Gun" type="Position2D" parent="Sprite"]

View File

@@ -94,5 +94,6 @@ 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,4 +160,5 @@ 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,6 +84,7 @@ 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,6 +12,8 @@ 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 = name.to_lower()
var n = String(name).to_lower()
_up = n + "_move_up"
_down = n + "_move_down"
if n == "left":

View File

@@ -98,6 +98,7 @@ 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,11 +8,6 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Pong with GDScript"
@@ -70,7 +65,8 @@ right_move_up={
[rendering]
quality/driver/driver_name="GLES2"
quality/2d/use_pixel_snap=true
2d/snapping/use_gpu_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://screens/combat/Combat.tscn" type="PackedScene" id=2]
[ext_resource path="res://screens/exploration/Exploration.tscn" type="PackedScene" id=3]
[ext_resource path="res://combat/Combat.tscn" type="PackedScene" id=2]
[ext_resource path="res://grid_movement/Exploration.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
length = 0.5

View File

@@ -1,7 +1,6 @@
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://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://combat/Combat.gd" type="Script" id=1]
[ext_resource path="res://combat/TurnQueue.gd" type="Script" id=2]
[ext_resource path="res://theme/theme.tres" type="Theme" id=3]
[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]
[ext_resource path="res://combat/interface/UI.gd" type="Script" id=4]
[ext_resource path="res://combat/interface/Info.tscn" type="PackedScene" id=5]
[sub_resource type="GDScript" id=1]
script/source = "extends Node2D
@@ -21,7 +21,8 @@ script = ExtResource( 1 )
position = Vector2( 539, 275 )
script = SubResource( 1 )
[node name="TurnQueue" parent="." instance=ExtResource( 2 )]
[node name="TurnQueue" type="Node" parent="."]
script = ExtResource( 2 )
combatants_list = NodePath("../Combatants")
[node name="UI" type="Control" parent="."]
@@ -78,6 +79,7 @@ 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

@@ -1,7 +1,5 @@
extends Node
const combatant = preload("../combatants/Combatant.gd")
export(NodePath) var combatants_list
var queue = [] setget set_queue
var active_combatant = null setget _set_active_combatant
@@ -43,7 +41,7 @@ func remove(combatant):
func set_queue(new_queue):
queue.clear()
for node in new_queue:
if not node is combatant:
if not node is Combatant:
continue
queue.append(node)
node.active = false

View File

@@ -1,3 +1,4 @@
class_name Combatant
extends Node
export(int) var damage = 1

View File

@@ -0,0 +1,15 @@
[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

@@ -1,10 +1,12 @@
extends "Combatant.gd"
extends Combatant
func set_active(value):
.set_active(value)
if not active:
return
if not $Timer.is_inside_tree():
return
$Timer.start()
yield($Timer, "timeout")
var target

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://turn_combat/combatants/Combatant.tscn" type="PackedScene" id=1]
[ext_resource path="res://turn_combat/combatants/Opponent.gd" type="Script" id=2]
[ext_resource path="res://turn_combat/combatants/sprites/green.png" type="Texture" id=3]
[ext_resource path="res://combat/combatants/Combatant.tscn" type="PackedScene" id=1]
[ext_resource path="res://combat/combatants/Opponent.gd" type="Script" id=2]
[ext_resource path="res://combat/combatants/sprites/green.png" type="Texture" id=3]
[node name="Opponent" instance=ExtResource( 1 )]
script = ExtResource( 2 )

View File

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

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://turn_combat/combatants/health/Health.gd" type="Script" id=1]
[ext_resource path="res://combat/combatants/Health.gd" type="Script" id=1]
[node name="Health" type="Node"]
script = ExtResource( 1 )

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=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]
[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]
[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-127e2b8d7aa8f4a7572c4923c2b20228.stex"
path="res://.import/blue.png-8092cf6d59f8b71b187a850a15aa9759.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://screens/combat/actors/sprites/blue.png"
dest_files=[ "res://.import/blue.png-127e2b8d7aa8f4a7572c4923c2b20228.stex" ]
source_file="res://combat/combatants/sprites/blue.png"
dest_files=[ "res://.import/blue.png-8092cf6d59f8b71b187a850a15aa9759.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-7937ec3931675b5dd0f218cbb8ae006a.stex"
path="res://.import/green.png-d2deadceb974a66b9f9b9df11dc41501.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://screens/combat/actors/sprites/green.png"
dest_files=[ "res://.import/green.png-7937ec3931675b5dd0f218cbb8ae006a.stex" ]
source_file="res://combat/combatants/sprites/green.png"
dest_files=[ "res://.import/green.png-d2deadceb974a66b9f9b9df11dc41501.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 741 B

View File

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

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=1]
[ext_resource path="res://theme/fonts/montserrat_extra_bold_48.tres" type="DynamicFont" id=1]
[node name="Info" type="PanelContainer"]
margin_right = 409.0
@@ -17,12 +17,22 @@ margin_top = 7.0
margin_right = 402.0
margin_bottom = 232.0
[node name="Name" parent="VBoxContainer" instance=ExtResource( 1 )]
[node name="Name" type="Label" parent="VBoxContainer"]
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

@@ -34,4 +34,5 @@ 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,12 +1,12 @@
[gd_scene load_steps=11 format=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/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/grid/Grid.gd" type="Script" id=3]
[ext_resource path="res://grid_movement/pawns/Character.tscn" type="PackedScene" id=4]
[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://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://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

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/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex"
path="res://.import/grid_lines.png-52aa706884a3dba960110e63cdf54a8c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/tilesets/grid/obstacle.png"
dest_files=[ "res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex" ]
source_file="res://grid_movement/grid/lines/grid_lines.png"
dest_files=[ "res://.import/grid_lines.png-52aa706884a3dba960110e63cdf54a8c.stex" ]
[params]

View File

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

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-147dff690f83be8a2c66a5bfa83da49f.stex"
path="res://.import/actor.png-c322bfa3077f1c55a7d6251f76155bcc.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/tilesets/grid/actor.png"
dest_files=[ "res://.import/actor.png-147dff690f83be8a2c66a5bfa83da49f.stex" ]
source_file="res://grid_movement/grid/tiles/actor.png"
dest_files=[ "res://.import/actor.png-c322bfa3077f1c55a7d6251f76155bcc.stex" ]
[params]

View File

@@ -1,8 +1,8 @@
[gd_resource type="TileSet" load_steps=4 format=2]
[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]
[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]
[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/sprite.png-e28cedc69371816a3468e6325b327ece.stex"
path="res://.import/object.png-105b8788e1883723a96438fd97d5db23.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/pawns/sprite.png"
dest_files=[ "res://.import/sprite.png-e28cedc69371816a3468e6325b327ece.stex" ]
source_file="res://grid_movement/grid/tiles/object.png"
dest_files=[ "res://.import/object.png-105b8788e1883723a96438fd97d5db23.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 103 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/obstacle.png-bd15bb10c9507019dfb2cad5661bca49.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/grid/tiles/obstacle.png"
dest_files=[ "res://.import/obstacle.png-bd15bb10c9507019dfb2cad5661bca49.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

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

View File

@@ -1,83 +0,0 @@
[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,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/sprite.png" type="Texture" id=2]
[ext_resource path="res://grid_movement/pawns/character.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="Actor" type="Node2D"]
[node name="Character" type="Node2D"]
position = Vector2( 32, 32 )
z_index = 1
script = ExtResource( 1 )

View File

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

View File

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

View File

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

View File

@@ -1,16 +0,0 @@
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.gd"
extends Pawn
onready var Grid = get_parent()
onready var parent = 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 = Grid.request_move(self, input_direction)
var target_position = parent.request_move(self, input_direction)
if target_position:
move_to(target_position)
$Tween.start()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grid_movement/tilesets/grid_lines/grid_lines.png"
dest_files=[ "res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.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

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