Skip to content

Commit 2399874

Browse files
authored
Merge branch 'master' into navigation_astar_hexagonal
2 parents 4fbff04 + 16d8ba0 commit 2399874

File tree

809 files changed

+9720
-8100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

809 files changed

+9720
-8100
lines changed

2d/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
These demos are all 2D, but otherwise do not have a common theme.
44

55
Languages: Most have GDScript, some have
6-
[GDSL](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shading_language.html)
6+
[Godot shader language](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shading_language.html)
77

8-
Renderers: 4 of them are GLES 3, but most are GLES 2
8+
Renderers: Glow for 2D and Physics Platformer use Forward+, 2D Particles uses Mobile, and the rest use Compatibility

2d/bullet_shower/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ in the documentation for more information.
99

1010
Language: GDScript
1111

12-
Renderer: Vulkan Mobile
12+
Renderer: Compatibility
1313

14-
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/887
14+
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2711
1515

1616
## Screenshots
1717

2d/bullet_shower/bullets.gd

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ const BULLET_COUNT = 500
88
const SPEED_MIN = 20
99
const SPEED_MAX = 80
1010

11-
const bullet_image = preload("res://bullet.png")
11+
const bullet_image := preload("res://bullet.png")
1212

1313
var bullets := []
14-
var shape
14+
var shape := RID()
1515

1616

1717
class Bullet:
18-
var position = Vector2()
19-
var speed = 1.0
18+
var position := Vector2()
19+
var speed := 1.0
2020
# The body is stored as a RID, which is an "opaque" way to access resources.
2121
# With large amounts of objects (thousands or more), it can be significantly
2222
# faster to use RIDs compared to a high-level approach.
23-
var body = RID()
23+
var body := RID()
2424

2525

26-
func _ready():
26+
func _ready() -> void:
2727
shape = PhysicsServer2D.circle_shape_create()
2828
# Set the collision shape's radius for each bullet in pixels.
2929
PhysicsServer2D.shape_set_data(shape, 8)
3030

3131
for _i in BULLET_COUNT:
32-
var bullet = Bullet.new()
32+
var bullet := Bullet.new()
3333
# Give each bullet its own random speed.
3434
bullet.speed = randf_range(SPEED_MIN, SPEED_MAX)
3535
bullet.body = PhysicsServer2D.body_create()
@@ -45,22 +45,22 @@ func _ready():
4545
randf_range(0, get_viewport_rect().size.x) + get_viewport_rect().size.x,
4646
randf_range(0, get_viewport_rect().size.y)
4747
)
48-
var transform2d = Transform2D()
48+
var transform2d := Transform2D()
4949
transform2d.origin = bullet.position
5050
PhysicsServer2D.body_set_state(bullet.body, PhysicsServer2D.BODY_STATE_TRANSFORM, transform2d)
5151

5252
bullets.push_back(bullet)
5353

5454

55-
func _process(_delta):
55+
func _process(_delta: float) -> void:
5656
# Order the CanvasItem to update every frame.
5757
queue_redraw()
5858

5959

60-
func _physics_process(delta):
61-
var transform2d = Transform2D()
62-
var offset = get_viewport_rect().size.x + 16
63-
for bullet in bullets:
60+
func _physics_process(delta: float) -> void:
61+
var transform2d := Transform2D()
62+
var offset := get_viewport_rect().size.x + 16
63+
for bullet: Bullet in bullets:
6464
bullet.position.x -= bullet.speed * delta
6565

6666
if bullet.position.x < -16:
@@ -73,15 +73,15 @@ func _physics_process(delta):
7373

7474
# Instead of drawing each bullet individually in a script attached to each bullet,
7575
# we are drawing *all* the bullets at once here.
76-
func _draw():
77-
var offset = -bullet_image.get_size() * 0.5
78-
for bullet in bullets:
76+
func _draw() -> void:
77+
var offset := -bullet_image.get_size() * 0.5
78+
for bullet: Bullet in bullets:
7979
draw_texture(bullet_image, bullet.position + offset)
8080

8181

8282
# Perform cleanup operations (required to exit without error messages in the console).
83-
func _exit_tree():
84-
for bullet in bullets:
83+
func _exit_tree() -> void:
84+
for bullet: Bullet in bullets:
8585
PhysicsServer2D.free_rid(bullet.body)
8686

8787
PhysicsServer2D.free_rid(shape)

2d/bullet_shower/player.gd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ extends Node2D
44
# efficient than using instancing and nodes, but requires more programming and
55
# is less visual. Bullets are managed together in the `bullets.gd` script.
66

7-
# The number of bullets currently touched by the player.
8-
var touching = 0
7+
## The number of bullets currently touched by the player.
8+
var touching := 0
99

10-
@onready var sprite = $AnimatedSprite2D
10+
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
1111

1212

13-
func _ready():
13+
func _ready() -> void:
1414
# The player follows the mouse cursor automatically, so there's no point
1515
# in displaying the mouse cursor.
1616
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
1717

1818

19-
func _input(event):
19+
func _input(event: InputEvent) -> void:
2020
# Getting the movement of the mouse so the sprite can follow its position.
2121
if event is InputEventMouseMotion:
2222
position = event.position - Vector2(0, 16)
2323

2424

25-
func _on_body_shape_entered(_body_id, _body, _body_shape, _local_shape):
25+
func _on_body_shape_entered(_body_id: RID, _body: Node2D, _body_shape_index: int, _local_shape_index: int) -> void:
2626
# Player got touched by a bullet so sprite changes to sad face.
2727
touching += 1
2828
if touching >= 1:
2929
sprite.frame = 1
3030

3131

32-
func _on_body_shape_exited(_body_id, _body, _body_shape, _local_shape):
32+
func _on_body_shape_exited(_body_id: RID, _body: Node2D, _body_shape_index: int, _local_shape_index: int) -> void:
3333
touching -= 1
3434
# When non of the bullets are touching the player,
3535
# sprite changes to happy face.

2d/bullet_shower/project.godot

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ run/main_scene="res://shower.tscn"
1717
config/features=PackedStringArray("4.2")
1818
config/icon="res://icon.webp"
1919

20+
[debug]
21+
22+
gdscript/warnings/untyped_declaration=1
23+
2024
[display]
2125

2226
window/stretch/mode="canvas_items"
@@ -26,10 +30,7 @@ window/stretch/aspect="expand"
2630

2731
2d_physics/layer_1="Player"
2832

29-
[physics]
30-
31-
2d/cell_size=64
32-
3333
[rendering]
3434

35-
renderer/rendering_method="mobile"
35+
renderer/rendering_method="gl_compatibility"
36+
renderer/rendering_method.mobile="gl_compatibility"

2d/dodge_the_creeps/HUD.tscn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
[gd_scene load_steps=4 format=3 uid="uid://ccqoreueuxdb7"]
1+
[gd_scene load_steps=5 format=3 uid="uid://ccqoreueuxdb7"]
22

33
[ext_resource type="Script" path="res://HUD.gd" id="1"]
4+
[ext_resource type="FontFile" uid="uid://cit6gwe5px1q8" path="res://fonts/Xolonium-Regular.ttf" id="2_2jm3i"]
45

56
[sub_resource type="InputEventAction" id="InputEventAction_fopy7"]
67
action = &"start_game"
@@ -16,6 +17,7 @@ anchors_preset = 10
1617
anchor_right = 1.0
1718
offset_bottom = 78.0
1819
grow_horizontal = 2
20+
theme_override_fonts/font = ExtResource("2_2jm3i")
1921
theme_override_font_sizes/font_size = 60
2022
text = "0"
2123
horizontal_alignment = 1
@@ -29,6 +31,7 @@ offset_top = -79.5
2931
offset_bottom = 79.5
3032
grow_horizontal = 2
3133
grow_vertical = 2
34+
theme_override_fonts/font = ExtResource("2_2jm3i")
3235
theme_override_font_sizes/font_size = 60
3336
text = "Dodge the
3437
Creeps"
@@ -46,6 +49,7 @@ offset_right = 90.0
4649
offset_bottom = -100.0
4750
grow_horizontal = 2
4851
grow_vertical = 0
52+
theme_override_fonts/font = ExtResource("2_2jm3i")
4953
theme_override_font_sizes/font_size = 60
5054
shortcut = SubResource("4")
5155
text = "Start"

2d/dodge_the_creeps/Player.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func start(pos):
4747
$CollisionShape2D.disabled = false
4848

4949

50-
func _on_Player_body_entered(_body):
50+
func _on_body_entered(_body):
5151
hide() # Player disappears after being hit.
5252
hit.emit()
5353
# Must be deferred as we can't change physics properties on a physics callback.

2d/dodge_the_creeps/Player.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ process_material = SubResource("7")
7272
texture = ExtResource("2")
7373
speed_scale = 2.0
7474

75-
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
75+
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

2d/dodge_the_creeps/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ consider following the tutorial in the documentation.
1010

1111
Language: GDScript
1212

13-
Renderer: Vulkan Mobile
13+
Renderer: Compatibility
1414

1515
Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).
1616

17-
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
18-
19-
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/515
17+
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2712
2018

2119
## Screenshots
2220

2d/dodge_the_creeps/fonts/Xolonium-Regular.tres

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)