Compare commits

...

21 Commits

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
Rémi Verschelde
94ec2ea5d9 Merge pull request #607 from aaronfranke/3.2-readme
Update README for the new 3.2 branch
2021-04-21 09:57:08 +02:00
Aaron Franke
40aec7c068 Update README for the new 3.2 branch 2021-04-14 13:46:19 -04:00
Aaron Franke
ead2777f48 Merge pull request #606 from nekomatata/physics-tests-contacts-update
Updated 2d/3d physics contact performance tests
2021-04-14 12:34:24 -05:00
PouleyKetchoupp
0a0d44d4f1 Updated 2d/3d physics contact performance tests 2021-04-14 08:19:10 -07:00
Aaron Franke
4911866f3d Merge pull request #604 from waimus/os_midi_scan_fix
Fix MIDI devices scanning
2021-04-05 16:51:00 -04:00
waimus
d7e1052205 Fix MIDI devices scanning 2021-04-06 03:10:33 +07:00
Aaron Franke
8e2dbf3f55 Merge pull request #602 from aaronfranke/etc
Use ETC instead of ETC2 for all GLES2 demos
2021-03-30 02:31:43 -04:00
Aaron Franke
2ee9b47f6c Use ETC instead of ETC2 for all GLES2 demos 2021-03-29 18:30:14 -04:00
Aaron Franke
d8dc94c1ff Merge pull request #601 from aaronfranke/ternary-volume
Use fewer ternary operators and decrease volume of Platformer 2D
2021-03-29 18:29:28 -04:00
Aaron Franke
d989bf6209 Use fewer ternary operators and decrease volume of Platformer 2D 2021-03-28 22:03:03 -04:00
Aaron Franke
021070215c Merge pull request #595 from dalexeev/bullet-shower-improve
Small improvement for Bullet Shower Demo
2021-03-26 20:20:31 -07:00
Aaron Franke
ac61cba05b Merge pull request #597 from aaronfranke/joy-24
Handle up to 24 joypad buttons in the Joypads demo
2021-03-15 04:34:12 -04:00
Aaron Franke
21e829416f Handle up to 24 joypad buttons in the Joypads demo 2021-03-13 23:28:22 -04:00
Danil Alexeev
cf7e4b31f4 Small improvement for Bullet Shower Demo 2021-03-13 21:04:13 +03:00
Aaron Franke
dc5c1016ce Merge pull request #594 from aaronfranke/assetlib-5c154da
Add links to the Asset Library after release 3.2-5c154da
2021-03-11 21:56:54 -08:00
Aaron Franke
8a0824a948 Add links to the Asset Library after release 3.2-5c154da
Also expand the CODEOWNERS file
2021-03-12 00:32:11 -05:00
108 changed files with 607 additions and 273 deletions

View File

@@ -2,10 +2,15 @@
root = true
# Unix-style newlines with a newline ending every file.
[*.cs]
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
[*.cs]
csharp_space_after_cast = false
indent_size = 4
[*.csproj]
insert_final_newline = false
indent_size = 2

13
.github/CODEOWNERS vendored
View File

@@ -2,7 +2,12 @@
# Each line is a file pattern followed by one or more owners.
# Owners can be @users, @org/teams or emails
/misc/2.5d @aaronfranke
/mono/2.5d @aaronfranke
/2d/physics_tests @pouleyKetchoupp
/3d/physics_tests @pouleyKetchoupp
/.github/dist/ @Calinou
/3d/voxel/ @aaronfranke
/misc/matrix_transform/ @aaronfranke
/misc/2.5d/ @aaronfranke
/mono/2.5d/ @aaronfranke
/2d/physics_tests/ @pouleyKetchoupp
/3d/physics_tests/ @pouleyKetchoupp

View File

@@ -1,9 +1,9 @@
---
name: Bug Report
about: Report a bug with one of the demo projects.
title: ''
title: ""
labels: bug
assignees: ''
assignees: ""
---

View File

@@ -1,9 +1,9 @@
---
name: Feature / Enhancement Request
about: Adding new features or improving existing ones.
title: ''
title: ""
labels: enhancement
assignees: ''
assignees: ""
---

View File

@@ -1,99 +0,0 @@
name: Export projects to HTML5 and deploy to GitHub Pages
on:
push:
branches:
- master
env:
GODOT_VERSION: 3.2.3
jobs:
export-html5:
name: Export projects to HTML5 and deploy to GitHub Pages
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:3.2.3
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup
run: |
mkdir -p ~/.local/share/godot/templates/
mv /root/.local/share/godot/templates/$GODOT_VERSION.stable ~/.local/share/godot/templates/$GODOT_VERSION.stable
- name: Export projects to HTML5
run: |
apt-get update -qq && apt-get install -qqq imagemagick
# Don't export Mono demos (not supported yet), demos that can't be run in HTML5
# since they're platform-specific or demos that are currently broken in HTML5.
# Remember to update `.github/dist/footer.html` when updating the list of excluded demos.
rm -rf \
2d/hdr/ \
3d/voxel/ \
audio/device_changer/ \
loading/background_load/ \
loading/multiple_threads_loading/ \
loading/threads/ \
misc/matrix_transform/ \
mobile/android_iap/ \
mobile/sensors/ \
mono/ \
networking/ \
plugins/
for panorama in 3d/material_testers/backgrounds/*.hdr; do
# Decrease the resolution to get below the 20 MB per-file limit.
# Otherwise, the website can't be deployed as files larger than 20 MB
# can't be pushed to GitHub anymore.
mogrify -resize 75% "$panorama"
done
BASEDIR="$PWD"
# Use absolute paths so that we can `cd` without having to go back to the parent directory manually.
for demo in */*/; do
echo ""
echo "================================"
echo "Exporting demo $demo..."
echo "================================"
mkdir -p "$BASEDIR/.github/dist/$demo"
cd "$BASEDIR/$demo"
# Copy an export template preset file configured for HTML5 exporting.
# This way, we don't have to commit `export_presets.cfg` for each project.
cp "$BASEDIR/.github/dist/export_presets.cfg" .
godot --export "HTML5" "$BASEDIR/.github/dist/$demo/index.html"
# Replace the WASM file with a symbolic link to avoid duplicating files in the pushed branch.
# (WASM files are identical across projects, but not PCK or HTML files.)
mv -f "$BASEDIR/.github/dist/$demo/index.wasm" "$BASEDIR/.github/dist/index.wasm"
# The symlink must be relative as it needs to point to a file within the pushed repository.
ln -s "../../index.wasm" "$BASEDIR/.github/dist/$demo/index.wasm"
# Append the demo to the list of demos for the website.
PROJECT_NAME=$(cat project.godot | grep "config/name" | cut -d '"' -f 2 | tr -d "\n")
echo "<li><a href='$demo'><img width="64" height="64" src="$demo/favicon.png" alt=""><p>$PROJECT_NAME</p></a></li>" >> "$BASEDIR/.github/dist/demos.html"
done
cat "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" > "$BASEDIR/.github/dist/index.html"
# Clean up files that don't need to be deployed.
rm -f "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" "$BASEDIR/.github/dist/export_presets.cfg"
# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail.
- name: Install rsync 📚
run: |
apt-get update -qq && apt-get install -qqq rsync
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The branch the action should deploy to.
BRANCH: gh-pages
# The folder the action should deploy.
FOLDER: .github/dist
# Artifacts are large; don't keep the branch's history.
SINGLE_COMMIT: true

View File

@@ -4,10 +4,10 @@ on: [push, pull_request]
jobs:
format:
name: File formatting (file_format.sh)
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
- name: Install dependencies
run: |

1
.gitignore vendored
View File

@@ -18,4 +18,5 @@ mono_crash.*.json
# System/tool-specific ignores
.directory
.DS_Store
*~

View File

@@ -11,6 +11,8 @@ Language: GDScript
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/887
## Screenshots
![No collision](screenshots/no_collision.png)

View File

@@ -52,22 +52,25 @@ func _ready():
bullets.push_back(bullet)
func _process(delta):
func _process(_delta):
# Order the CanvasItem to update every frame.
update()
func _physics_process(delta):
var transform2d = Transform2D()
var offset = get_viewport_rect().size.x + 16
for bullet in bullets:
bullet.position.x -= bullet.speed * delta
if bullet.position.x < -16:
# The bullet has left the screen; move it back to the right.
bullet.position.x = get_viewport_rect().size.x + 16
bullet.position.x = offset
transform2d.origin = bullet.position
Physics2DServer.body_set_state(bullet.body, Physics2DServer.BODY_STATE_TRANSFORM, transform2d)
# Order the CanvasItem to update since bullets are moving every frame.
update()
# Instead of drawing each bullet individually in a script attached to each bullet,
# we are drawing *all* the bullets at once here.

View File

@@ -19,7 +19,10 @@ var height = 0.0
func initialize(speed, velocity):
horizontal_speed = speed
max_horizontal_speed = speed if speed > 0.0 else base_max_horizontal_speed
if speed > 0.0:
max_horizontal_speed = speed
else:
max_horizontal_speed = base_max_horizontal_speed
enter_velocity = velocity
@@ -27,7 +30,10 @@ func enter():
var input_direction = get_input_direction()
update_look_direction(input_direction)
horizontal_velocity = enter_velocity if input_direction else Vector2()
if input_direction:
horizontal_velocity = enter_velocity
else:
horizontal_velocity = Vector2()
vertical_speed = 600.0
owner.get_node("AnimationPlayer").play("idle")

View File

@@ -22,7 +22,11 @@ func update(_delta):
emit_signal("finished", "idle")
update_look_direction(input_direction)
speed = max_run_speed if Input.is_action_pressed("run") else max_walk_speed
if Input.is_action_pressed("run"):
speed = max_run_speed
else:
speed = max_walk_speed
var collision_info = move(speed, input_direction)
if not collision_info:
return

View File

@@ -102,3 +102,5 @@ attack={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -37,3 +37,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -68,4 +68,6 @@ move_up={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.172549, 0.219608, 0.129412, 1 )

View File

@@ -39,4 +39,6 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.301961, 0.301961, 0.301961, 1 )

View File

@@ -80,4 +80,6 @@ use_pixel_snap=true
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.0784314, 0.105882, 0.145098, 1 )

View File

@@ -76,4 +76,6 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.156, 0.1325, 0.25, 1 )

View File

@@ -37,3 +37,5 @@ shadow_filter=3
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -41,3 +41,5 @@ shadow_filter=2
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -46,4 +46,6 @@ click={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.160784, 0.172549, 0.278431, 1 )

View File

@@ -38,3 +38,5 @@ click={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -4,6 +4,7 @@ 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
@@ -13,6 +14,8 @@ Language: GDScript
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/888
## Screenshots
![Screenshot](screenshots/screenshot.png)

View File

@@ -120,5 +120,7 @@ limits/message_queue/max_size_kb=10240
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.184314, 0.184314, 0.184314, 1 )
quality/filters/msaa=2

View File

@@ -68,12 +68,10 @@ func clear_drawn_nodes():
_drawn_nodes.clear()
func create_rigidbody_box(size, pickable = false, use_icon = false):
var shape = RectangleShape2D.new()
shape.extents = 0.5 * size
func create_rigidbody(shape, pickable = false, transform = Transform.IDENTITY):
var collision = CollisionShape2D.new()
collision.shape = shape
collision.transform = transform
var body = RigidBody2D.new()
body.add_child(collision)
@@ -82,6 +80,32 @@ func create_rigidbody_box(size, pickable = false, use_icon = false):
var script = load("res://utils/rigidbody_pick.gd")
body.set_script(script)
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
var body = create_rigidbody(shape, pickable, transform)
if use_icon:
var texture = load("res://icon.png")
var icon = Sprite.new()

View File

@@ -167,7 +167,7 @@ func _on_option_selected(option):
func _find_type_index(type_name):
for type_index in _collision_shapes.size():
for type_index in range(_collision_shapes.size()):
var type_shape = _collision_shapes[type_index]
if type_shape.resource_name.find(type_name) > -1:
return type_index

View File

@@ -11,8 +11,6 @@ const OPTION_TEST_CASE_CHANGE_POSITIONS = "Test case/Set body positions after ad
const BOX_SIZE = Vector2(64, 64)
onready var options = $Options
var _update_joint = false
var _selected_joint = null
@@ -27,8 +25,10 @@ var _joint_types = {}
func _ready():
var options = $Options
var joints = $Joints
for joint_index in joints.get_child_count():
for joint_index in range(joints.get_child_count()):
var joint_node = joints.get_child(joint_index)
joint_node.visible = false
var joint_name = joint_node.name

View File

@@ -28,7 +28,7 @@ func _create_pyramid():
var pos_x = -0.5 * (num_boxes - 1) * (box_size.x + box_spacing.x)
for box_index in num_boxes:
for box_index in range(num_boxes):
var box = template_body.duplicate()
box.position = Vector2(pos_x, 0.0)
box.name = "Box%02d" % (box_index + 1)

View File

@@ -26,7 +26,7 @@ func _create_stack():
var pos_x = -0.5 * (width - 1) * (box_size.x + box_spacing.x)
for box_index in width:
for box_index in range(width):
var box = template_body.duplicate()
box.position = Vector2(pos_x, 0.0)
box.name = "Box%02d" % (box_index + 1)

View File

@@ -148,7 +148,7 @@ func _remove_objects():
# Remove objects in reversed order to avoid the overhead of changing children index in parent.
var object_count = _objects.size()
for object_index in object_count:
for object_index in range(object_count):
root_node.remove_child(_objects[object_count - object_index - 1])
timer = OS.get_ticks_usec() - timer

View File

@@ -10,12 +10,15 @@ const OPTION_TYPE_CONCAVE_POLYGON = "Shape type/Concave Polygon"
export(Array) var spawns = Array()
export(int) var spawn_count = 100
export(int, 1, 10) var spawn_multiplier = 5
onready var options = $Options
var _object_templates = []
var _log_physics = false
var _log_physics_time = 0
var _log_physics_time_start = 0
func _ready():
yield(start_timer(0.5), "timeout")
@@ -40,6 +43,25 @@ func _ready():
_start_all_types()
func _physics_process(_delta):
if _log_physics:
var time = OS.get_ticks_usec()
var time_delta = time - _log_physics_time
var time_total = time - _log_physics_time_start
_log_physics_time = time
Log.print_log(" Physics Tick: %.3f ms (total = %.3f ms)" % [0.001 * time_delta, 0.001 * time_total])
func _log_physics_start():
_log_physics = true
_log_physics_time_start = OS.get_ticks_usec()
_log_physics_time = _log_physics_time_start
func _log_physics_stop():
_log_physics = false
func _exit_tree():
for object_template in _object_templates:
object_template.free()
@@ -66,7 +88,7 @@ func _on_option_selected(option):
func _find_type_index(type_name):
for type_index in _object_templates.size():
for type_index in range(_object_templates.size()):
var type_node = _object_templates[type_index]
if type_node.name.find(type_name) > -1:
return type_index
@@ -85,44 +107,47 @@ func _start_type(type_index):
if is_timer_canceled():
return
_log_physics_start()
_spawn_objects(type_index)
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_log_physics_start()
_activate_objects()
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_log_physics_start()
_despawn_objects()
Log.print_log("* Done.")
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(1.0), "timeout")
func _start_all_types():
for type_index in _object_templates.size():
yield(start_timer(1.0), "timeout")
Log.print_log("* Start all types.")
for type_index in range(_object_templates.size()):
yield(_start_type(type_index), "completed")
if is_timer_canceled():
return
_spawn_objects(type_index)
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_activate_objects()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_despawn_objects()
Log.print_log("* Done.")
Log.print_log("* Done all types.")
func _spawn_objects(type_index):
@@ -132,33 +157,37 @@ func _spawn_objects(type_index):
Log.print_log("* Spawning: " + template_node.name)
for _index in range(spawn_multiplier):
for _node_index in spawn_count / spawn_multiplier:
var node = template_node.duplicate() as Node2D
spawn_parent.add_child(node)
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)
body.set_sleeping(true)
spawn_parent.add_child(body)
func _activate_objects():
var spawn_parent = $SpawnTarget1
for spawn in spawns:
var spawn_parent = get_node(spawn)
Log.print_log("* Activating")
Log.print_log("* Activating")
for node_index in spawn_parent.get_child_count():
var node = spawn_parent.get_child(node_index) as RigidBody2D
node.set_sleeping(false)
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():
for spawn in spawns:
var spawn_parent = get_node(spawn)
if spawn_parent.get_child_count() == 0:
return
var object_count = spawn_parent.get_child_count()
if object_count == 0:
continue
Log.print_log("* Despawning")
while spawn_parent.get_child_count():
var node_index = spawn_parent.get_child_count() - 1
var node = spawn_parent.get_child(node_index)
# 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)
spawn_parent.remove_child(node)
node.queue_free()

View File

@@ -17,7 +17,9 @@ height = 30.0
[node name="Test" type="Node2D"]
script = ExtResource( 2 )
_enable_debug_collision = false
spawns = [ NodePath("SpawnTarget1") ]
spawn_count = 200
[node name="Options" parent="." instance=ExtResource( 4 )]

View File

@@ -13,7 +13,7 @@ func add_menu_item(item_path, checkbox = false, checked = false, radio = false):
var path = ""
var popup = get_popup()
for element_index in path_element_count - 1:
for element_index in range(path_element_count - 1):
var popup_label = path_elements[element_index]
path += popup_label + "/"
popup = _add_popup(popup, path, popup_label)
@@ -59,7 +59,7 @@ func _on_item_pressed(item_index, popup_menu, path):
var checked = popup_menu.is_item_checked(item_index)
if not checked:
popup_menu.set_item_checked(item_index, true)
for other_index in popup_menu.get_item_count():
for other_index in range(popup_menu.get_item_count()):
if other_index != item_index:
popup_menu.set_item_checked(other_index, false)
emit_signal("option_selected", item_path)

View File

@@ -49,7 +49,10 @@ func _physics_process(_delta):
_velocity.y = move_and_slide(_velocity, FLOOR_NORMAL).y
# We flip the Sprite depending on which way the enemy is moving.
sprite.scale.x = 1 if _velocity.x > 0 else -1
if _velocity.x > 0:
sprite.scale.x = 1
else:
sprite.scale.x = -1
var animation = get_new_animation()
if animation != animation_player.current_animation:
@@ -64,7 +67,10 @@ func destroy():
func get_new_animation():
var animation_new = ""
if _state == State.WALKING:
animation_new = "walk" if abs(_velocity.x) > 0 else "idle"
if _velocity.x == 0:
animation_new = "idle"
else:
animation_new = "walk"
else:
animation_new = "destroy"
return animation_new

View File

@@ -51,7 +51,9 @@ func _physics_process(_delta):
var is_jump_interrupted = Input.is_action_just_released("jump" + action_suffix) and _velocity.y < 0.0
_velocity = calculate_move_velocity(_velocity, direction, speed, is_jump_interrupted)
var snap_vector = Vector2.DOWN * FLOOR_DETECT_DISTANCE if direction.y == 0.0 else Vector2.ZERO
var snap_vector = Vector2.ZERO
if direction.y == 0.0:
snap_vector = Vector2.DOWN * FLOOR_DETECT_DISTANCE
var is_on_platform = platform_detector.is_colliding()
_velocity = move_and_slide_with_snap(
_velocity, snap_vector, FLOOR_NORMAL, not is_on_platform, 4, 0.9, false
@@ -60,7 +62,10 @@ func _physics_process(_delta):
# When the characters direction changes, we want to to scale the Sprite accordingly to flip it.
# This will make Robi face left or right depending on the direction you move.
if direction.x != 0:
sprite.scale.x = 1 if direction.x > 0 else -1
if direction.x > 0:
sprite.scale.x = 1
else:
sprite.scale.x = -1
# We use the sprite's scale to store Robis look direction which allows us to shoot
# bullets forward.
@@ -106,9 +111,15 @@ func calculate_move_velocity(
func get_new_animation(is_shooting = false):
var animation_new = ""
if is_on_floor():
animation_new = "run" if abs(_velocity.x) > 0.1 else "idle"
if abs(_velocity.x) > 0.1:
animation_new = "run"
else:
animation_new = "idle"
else:
animation_new = "falling" if _velocity.y > 0 else "jumping"
if _velocity.y > 0:
animation_new = "falling"
else:
animation_new = "jumping"
if is_shooting:
animation_new += "_weapon"
return animation_new

View File

@@ -2,7 +2,7 @@ extends AudioStreamPlayer
const DOUBLE_VOLUME_DB = 6 # Do not change. Represents doubling of sound pressure.
export(int) var base_volume_db = -4
export(int) var base_volume_db = -14
func _ready():
# To avoid AudioStreamPlayer2D sounds playing on top of each other and

View File

@@ -12,7 +12,10 @@ func _ready():
var n = name.to_lower()
_up = n + "_move_up"
_down = n + "_move_down"
_ball_dir = 1 if n == "left" else -1
if n == "left":
_ball_dir = 1
else:
_ball_dir = -1
func _process(delta):

View File

@@ -71,4 +71,6 @@ right_move_up={
quality/driver/driver_name="GLES2"
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
vram_compression/import_etc2=false
viewport/default_clear_color=Color( 0, 0, 0, 1 )

View File

@@ -68,3 +68,5 @@ ui_down={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -30,3 +30,5 @@ window/stretch/aspect="expand"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -45,4 +45,6 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.2349, 0.2349, 0.27, 1 )

View File

@@ -3,16 +3,16 @@
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.s3tc.stex"
path.etc2="res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.etc2.stex"
path.etc="res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"imported_formats": [ "s3tc", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://particle.png"
dest_files=[ "res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.s3tc.stex", "res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.etc2.stex" ]
dest_files=[ "res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.s3tc.stex", "res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.etc.stex" ]
[params]

View File

@@ -31,5 +31,7 @@ singletons=[ ]
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_etc=true
vram_compression/import_etc2=false
quality/shadows/filter_mode=2
quality/filters/msaa=2

View File

@@ -4,6 +4,7 @@ This demo contains a series of tests for the 3D
physics engine.
They can be used for different purpose:
- Functional tests to check for regressions and
compare the behavior between physics engines
- Performance tests to evaluate and compare

View File

@@ -92,5 +92,7 @@ toggle_pause={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.184314, 0.184314, 0.184314, 1 )
quality/filters/msaa=2

View File

@@ -67,12 +67,10 @@ func clear_drawn_nodes():
_drawn_nodes.clear()
func create_rigidbody_box(size, pickable = false):
var shape = BoxShape.new()
shape.extents = 0.5 * size
func create_rigidbody(shape, pickable = false, transform = Transform.IDENTITY):
var collision = CollisionShape.new()
collision.shape = shape
collision.transform = transform
var body = RigidBody.new()
body.add_child(collision)
@@ -84,6 +82,13 @@ func create_rigidbody_box(size, pickable = false):
return body
func create_rigidbody_box(size, pickable = false, transform = Transform.IDENTITY):
var shape = BoxShape.new()
shape.extents = 0.5 * size
return create_rigidbody(shape, pickable, transform)
func start_timer(timeout):
if _timer == null:
_timer = Timer.new()

View File

@@ -170,7 +170,7 @@ func _on_option_selected(option):
func _find_type_index(type_name):
for type_index in _collision_shapes.size():
for type_index in range(_collision_shapes.size()):
var type_shape = _collision_shapes[type_index]
if type_shape.resource_name.find(type_name) > -1:
return type_index

View File

@@ -24,23 +24,26 @@ var _joint_types = {}
func _ready():
for joint_index in $Joints.get_child_count():
var joint_node = $Joints.get_child(joint_index)
var options = $Options
var joints = $Joints
for joint_index in joints.get_child_count():
var joint_node = joints.get_child(joint_index)
joint_node.visible = false
var joint_name = joint_node.name
var joint_short = joint_name.substr(0, joint_name.length() - 5)
var option_name = OPTION_JOINT_TYPE % [joint_short, joint_index + 1]
$Options.add_menu_item(option_name)
options.add_menu_item(option_name)
_joint_types[option_name] = joint_node
$Options.add_menu_item(OPTION_TEST_CASE_BODIES_COLLIDE, true, false)
$Options.add_menu_item(OPTION_TEST_CASE_WORLD_ATTACHMENT, true, false)
$Options.add_menu_item(OPTION_TEST_CASE_DYNAMIC_ATTACHMENT, true, false)
$Options.add_menu_item(OPTION_TEST_CASE_DESTROY_BODY, true, false)
$Options.add_menu_item(OPTION_TEST_CASE_CHANGE_POSITIONS, true, false)
options.add_menu_item(OPTION_TEST_CASE_BODIES_COLLIDE, true, false)
options.add_menu_item(OPTION_TEST_CASE_WORLD_ATTACHMENT, true, false)
options.add_menu_item(OPTION_TEST_CASE_DYNAMIC_ATTACHMENT, true, false)
options.add_menu_item(OPTION_TEST_CASE_DESTROY_BODY, true, false)
options.add_menu_item(OPTION_TEST_CASE_CHANGE_POSITIONS, true, false)
$Options.connect("option_selected", self, "_on_option_selected")
$Options.connect("option_changed", self, "_on_option_changed")
options.connect("option_selected", self, "_on_option_selected")
options.connect("option_changed", self, "_on_option_changed")
_selected_joint = _joint_types.values()[0]
_update_joint = true

View File

@@ -154,7 +154,7 @@ func _remove_objects():
# Remove objects in reversed order to avoid the overhead of changing children index in parent.
var object_count = _objects.size()
for object_index in object_count:
for object_index in range(object_count):
root_node.remove_child(_objects[object_count - object_index - 1])
timer = OS.get_ticks_usec() - timer

View File

@@ -10,10 +10,13 @@ const OPTION_TYPE_CONVEX = "Shape type/Convex"
export(Array) var spawns = Array()
export(int) var spawn_count = 100
export(int, 1, 10) var spawn_multiplier = 5
var _object_templates = []
var _log_physics = false
var _log_physics_time = 0
var _log_physics_time_start = 0
func _ready():
yield(start_timer(0.5), "timeout")
@@ -41,6 +44,25 @@ func _exit_tree():
object_template.free()
func _physics_process(_delta):
if _log_physics:
var time = OS.get_ticks_usec()
var time_delta = time - _log_physics_time
var time_total = time - _log_physics_time_start
_log_physics_time = time
Log.print_log(" Physics Tick: %.3f ms (total = %.3f ms)" % [0.001 * time_delta, 0.001 * time_total])
func _log_physics_start():
_log_physics = true
_log_physics_time_start = OS.get_ticks_usec()
_log_physics_time = _log_physics_time_start
func _log_physics_stop():
_log_physics = false
func _on_option_selected(option):
cancel_timer()
@@ -62,7 +84,7 @@ func _on_option_selected(option):
func _find_type_index(type_name):
for type_index in _object_templates.size():
for type_index in range(_object_templates.size()):
var type_node = _object_templates[type_index]
if type_node.name.find(type_name) > -1:
return type_index
@@ -81,44 +103,47 @@ func _start_type(type_index):
if is_timer_canceled():
return
_log_physics_start()
_spawn_objects(type_index)
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_log_physics_start()
_activate_objects()
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_log_physics_start()
_despawn_objects()
Log.print_log("* Done.")
yield(wait_for_physics_ticks(5), "wait_done")
_log_physics_stop()
yield(start_timer(1.0), "timeout")
func _start_all_types():
for type_index in _object_templates.size():
yield(start_timer(1.0), "timeout")
Log.print_log("* Start all types.")
for type_index in range(_object_templates.size()):
yield(_start_type(type_index), "completed")
if is_timer_canceled():
return
_spawn_objects(type_index)
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_activate_objects()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_despawn_objects()
Log.print_log("* Done.")
Log.print_log("* Done all types.")
func _spawn_objects(type_index):
@@ -128,34 +153,35 @@ func _spawn_objects(type_index):
Log.print_log("* Spawning: " + template_node.name)
for _index in range(spawn_multiplier):
for _node_index in spawn_count / spawn_multiplier:
var node = template_node.duplicate() as Spatial
node.transform.origin = Vector3.ZERO
spawn_parent.add_child(node)
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) as CollisionShape
var shape = collision.shape.duplicate()
var body = create_rigidbody(shape, false, collision.transform)
body.set_sleeping(true)
spawn_parent.add_child(body)
func _activate_objects():
var spawn_parent = $SpawnTarget1
for spawn in spawns:
var spawn_parent = get_node(spawn)
Log.print_log("* Activating")
Log.print_log("* Activating")
for node_index in spawn_parent.get_child_count():
var node = spawn_parent.get_child(node_index) as RigidBody
node.set_sleeping(false)
for node_index in range(spawn_parent.get_child_count()):
var node = spawn_parent.get_child(node_index) as RigidBody
node.set_sleeping(false)
func _despawn_objects():
for spawn in spawns:
var spawn_parent = get_node(spawn)
if spawn_parent.get_child_count() == 0:
return
Log.print_log("* Despawning")
while spawn_parent.get_child_count():
var node_index = spawn_parent.get_child_count() - 1
var node = spawn_parent.get_child(node_index)
# Remove objects in reversed order to avoid the overhead of changing children index in parent.
var object_count = spawn_parent.get_child_count()
for object_index in range(object_count):
var node = spawn_parent.get_child(object_count - object_index - 1)
spawn_parent.remove_child(node)
node.queue_free()

View File

@@ -17,12 +17,13 @@ points = PoolVector3Array( -0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0 )
[sub_resource type="SphereShape" id=5]
[sub_resource type="ConcavePolygonShape" id=6]
data = PoolVector3Array( -1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
[sub_resource type="PlaneShape" id=6]
[node name="Test" type="Spatial"]
script = ExtResource( 2 )
_enable_debug_collision = false
spawns = [ "SpawnTarget1" ]
spawn_count = 500
[node name="Options" parent="." instance=ExtResource( 4 )]
@@ -65,19 +66,19 @@ shape = SubResource( 5 )
[node name="StaticBodyWalls" type="StaticBody" parent="."]
[node name="CollisionShape1" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( -1.62921e-05, 1, 0, -100, -1.62921e-07, 0, 0, 0, 100, -5, 0, 0 )
transform = Transform( -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0, 1, -5, 0, 0 )
shape = SubResource( 6 )
[node name="CollisionShape2" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( -1.62921e-05, -1, 0, 100, -1.62921e-07, 0, 0, 0, 100, 5, 0, 0 )
transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 5, 0, 0 )
shape = SubResource( 6 )
[node name="CollisionShape3" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( 2.65431e-12, 1.62921e-07, 100, 100, -1.62921e-07, 0, 1.62921e-05, 1, -1.62921e-05, 0, 0, -5 )
transform = Transform( 2.6543e-14, 1.62921e-07, 1, 1, -1.62921e-07, 1.56125e-19, 1.62921e-07, 1, -1.62921e-07, 0, 0, -5 )
shape = SubResource( 6 )
[node name="CollisionShape4" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( 2.65431e-12, 1.62921e-07, -100, 100, -1.62921e-07, 0, -1.62921e-05, -1, -1.62921e-05, 0, 0, 5 )
transform = Transform( 2.6543e-14, 1.62921e-07, -1, 1, -1.62921e-07, -1.56125e-19, -1.62921e-07, -1, -1.62921e-07, 0, 0, 5 )
shape = SubResource( 6 )
[node name="StaticScene" parent="." instance=ExtResource( 1 )]

View File

@@ -17,12 +17,13 @@ points = PoolVector3Array( -0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0 )
[sub_resource type="SphereShape" id=5]
[sub_resource type="ConcavePolygonShape" id=6]
data = PoolVector3Array( -1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
[sub_resource type="PlaneShape" id=6]
[node name="Test" type="Spatial"]
script = ExtResource( 1 )
_enable_debug_collision = false
spawns = [ "SpawnTarget1", "SpawnTarget2", "SpawnTarget3", "SpawnTarget4", "SpawnTarget5", "SpawnTarget6", "SpawnTarget7", "SpawnTarget8", "SpawnTarget9", "SpawnTarget10", "SpawnTarget11", "SpawnTarget12", "SpawnTarget13", "SpawnTarget14", "SpawnTarget15", "SpawnTarget16" ]
spawn_count = 50
[node name="Options" parent="." instance=ExtResource( 4 )]
@@ -107,26 +108,26 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 0 )
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodySphere"]
shape = SubResource( 5 )
[node name="StaticScene" parent="." instance=ExtResource( 5 )]
[node name="StaticBodyWalls" type="StaticBody" parent="."]
[node name="CollisionShape1" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( -1.62921e-05, 1, 0, -100, -1.62921e-07, 0, 0, 0, 100, -5, 0, 0 )
transform = Transform( -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0, 1, -50, 0, 0 )
shape = SubResource( 6 )
[node name="CollisionShape2" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( -1.62921e-05, -1, 0, 100, -1.62921e-07, 0, 0, 0, 100, 5, 0, 0 )
transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 50, 0, 0 )
shape = SubResource( 6 )
[node name="CollisionShape3" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( 2.65431e-12, 1.62921e-07, 100, 100, -1.62921e-07, 0, 1.62921e-05, 1, -1.62921e-05, 0, 0, -5 )
transform = Transform( 2.6543e-14, 1.62921e-07, 1, 1, -1.62921e-07, 1.56125e-19, 1.62921e-07, 1, -1.62921e-07, 0, 0, -50 )
shape = SubResource( 6 )
[node name="CollisionShape4" type="CollisionShape" parent="StaticBodyWalls"]
transform = Transform( 2.65431e-12, 1.62921e-07, -100, 100, -1.62921e-07, 0, -1.62921e-05, -1, -1.62921e-05, 0, 0, 5 )
transform = Transform( 2.6543e-14, 1.62921e-07, -1, 1, -1.62921e-07, -1.56125e-19, -1.62921e-07, -1, -1.62921e-07, 0, 0, 50 )
shape = SubResource( 6 )
[node name="StaticScene" parent="." instance=ExtResource( 5 )]
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 0.881757, 0.471705, 0, -0.471705, 0.881757, 0, 20.4125, 41.0426 )
script = ExtResource( 3 )

View File

@@ -13,7 +13,7 @@ func add_menu_item(item_path, checkbox = false, checked = false):
var path = ""
var popup = get_popup()
for element_index in path_element_count - 1:
for element_index in range(path_element_count - 1):
var popup_label = path_elements[element_index]
path += popup_label + "/"
popup = _add_popup(popup, path, popup_label)

View File

@@ -3,16 +3,16 @@
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.stex"
path.etc2="res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.stex"
path.etc="res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"imported_formats": [ "s3tc", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://Images/cement.png"
dest_files=[ "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.stex", "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.stex" ]
dest_files=[ "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.stex", "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc.stex" ]
[params]

View File

@@ -3,16 +3,16 @@
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.stex"
path.etc2="res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.stex"
path.etc="res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"imported_formats": [ "s3tc", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://Images/grass.png"
dest_files=[ "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.stex", "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.stex" ]
dest_files=[ "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.stex", "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc.stex" ]
[params]

View File

@@ -78,6 +78,8 @@ shadow_filter=3
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_etc=true
vram_compression/import_etc2=false
quality/shadows/filter_mode=2
quality/filters/msaa=2
environment/default_environment="res://default_env.tres"

View File

@@ -13,7 +13,10 @@ func _process(_delta):
pause.visible = crosshair.visible
crosshair.visible = !crosshair.visible
options.visible = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED if crosshair.visible else Input.MOUSE_MODE_VISIBLE)
if crosshair.visible:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _on_Resume_pressed():

View File

@@ -14,6 +14,8 @@ Language: GDScript
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/889
## Screenshots
![Screenshot](screenshots/waypoints.png)

View File

@@ -6,21 +6,18 @@ be used with [Godot Engine](https://godotengine.org), the open source
## Godot versions
- The [`master`](https://github.com/godotengine/godot-demo-projects) branch is compatible with the latest stable Godot version (currently 3.2).
- If you are using an older version of Godot, use the appropriate branch for your Godot version:
- [`3.1`](https://github.com/godotengine/godot-demo-projects/tree/3.1) branch
for Godot 3.1.x.
- [`3.0`](https://github.com/godotengine/godot-demo-projects/tree/3.0) branch
for Godot 3.0.x.
- [`2.1`](https://github.com/godotengine/godot-demo-projects/tree/2.1) branch
for Godot 2.1.x.
- The [`master`](https://github.com/godotengine/godot-demo-projects) branch is compatible with Godot's `master` development branch (next 4.x release).
- The [`3.x`](https://github.com/godotengine/godot-demo-projects/tree/3.x) branch is compatible with Godot's `3.x` development branch (next 3.x release).
- The other branches are compatible with the matching stable versions of Godot.
- [Click here](https://github.com/godotengine/godot-demo-projects/branches) to see all branches.
- For example, the [`2.1`](https://github.com/godotengine/godot-demo-projects/tree/2.1)
branch is for demos compatible with Godot 2.1.x.
## Importing all demos
To import all demos at once in the project manager:
- Clone this repository or [download a ZIP archive](https://github.com/godotengine/godot-demo-projects/archive/master.zip).
- Clone this repository or [download a ZIP archive](https://github.com/godotengine/godot-demo-projects/archive/3.2.zip).
- If you've downloaded a ZIP archive, extract it somewhere.
- Open the Godot project manager and click the **Scan** button on the right.
- Choose the path to the folder containing all demos.
@@ -40,6 +37,7 @@ desktop. For the best performance, consider downloading the demos.
- [Source code](https://github.com/godotengine/godot)
- [Documentation](http://docs.godotengine.org)
- [Community hub](https://godotengine.org/community)
- [TPS demo](https://github.com/godotengine/tps-demo)
## License

View File

@@ -23,3 +23,5 @@ config/icon="res://icon.png"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -100,3 +100,5 @@ ui_end={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -24,3 +24,5 @@ run/main_scene="res://generator.tscn"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -36,3 +36,5 @@ window/stretch/aspect="expand"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -23,3 +23,5 @@ config/icon="res://icon.png"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -13,6 +13,8 @@ Language: GDScript
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/890
## Screenshots
![Screenshot](screenshots/control_gallery.png)

View File

@@ -36,3 +36,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -67,3 +67,5 @@ dash={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -34,3 +34,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -37,4 +37,6 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.145098, 0.145098, 0.164706, 1 )

View File

@@ -46,4 +46,6 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.145098, 0.145098, 0.164706, 1 )

View File

@@ -40,3 +40,5 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -110,3 +110,5 @@ ui_end={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -24,3 +24,5 @@ config/icon="res://icon.png"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -36,3 +36,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -15,6 +15,8 @@ Language: GDScript
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/891
## Screenshots
![Screenshot](screenshots/save_load.png)

View File

@@ -36,3 +36,5 @@ multithread/thread_rid_pool_prealloc=60
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -196,3 +196,5 @@ exit={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -125,6 +125,13 @@ flip_h = true
region_enabled = true
region_rect = Rect2( 50, 0, 14, 54 )
[node name="16" type="Sprite" parent="Buttons"]
position = Vector2( 4, 64 )
scale = Vector2( 0.9, 0.9 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 0, 0, 45, 45 )
[node name="Axes" type="Node2D" parent="."]
[node name="0-" type="Sprite" parent="Axes"]

View File

@@ -23,6 +23,8 @@ onready var joypad_number = $DeviceInfo/JoyNumber
func _ready():
set_physics_process(true)
Input.connect("joy_connection_changed", self, "_on_joy_connection_changed")
# Guide button, not supported <= 3.2.3, so manually hide to account for that case.
joypad_buttons.get_child(16).hide()
func _process(_delta):
@@ -52,13 +54,15 @@ func _process(_delta):
joypad_axes.get_node(str(axis) + "-").show()
# Loop through the buttons and highlight the ones that are pressed.
for btn in range(JOY_BUTTON_0, JOY_BUTTON_MAX):
for btn in range(JOY_BUTTON_0, int(min(JOY_BUTTON_MAX, 24))):
if Input.is_joy_button_pressed(joy_num, btn):
button_grid.get_node(str(btn)).add_color_override("font_color", Color.white)
joypad_buttons.get_node(str(btn)).show()
button_grid.get_child(btn).add_color_override("font_color", Color.white)
if btn < 17:
joypad_buttons.get_child(btn).show()
else:
button_grid.get_node(str(btn)).add_color_override("font_color", Color(0.2, 0.1, 0.3, 1))
joypad_buttons.get_node(str(btn)).hide()
button_grid.get_child(btn).add_color_override("font_color", Color(0.2, 0.1, 0.3, 1))
if btn < 17:
joypad_buttons.get_child(btn).hide()
# Called whenever a joypad has been connected or disconnected.

View File

@@ -19,7 +19,7 @@ __meta__ = {
}
[node name="JoypadDiagram" parent="." instance=ExtResource( 2 )]
position = Vector2( 415, 180 )
position = Vector2( 415, 170 )
scale = Vector2( 0.5, 0.5 )
[node name="DeviceInfo" type="HBoxContainer" parent="."]
@@ -569,7 +569,7 @@ anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -250.0
margin_top = -140.0
margin_top = -150.0
__meta__ = {
"_edit_use_anchors_": false
}
@@ -588,7 +588,7 @@ __meta__ = {
[node name="ButtonGrid" type="GridContainer" parent="Buttons"]
margin_top = 24.0
margin_right = 250.0
margin_bottom = 68.0
margin_bottom = 92.0
rect_min_size = Vector2( 200, 0 )
columns = 8
__meta__ = {
@@ -601,6 +601,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "0"
align = 1
valign = 1
@@ -615,6 +616,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "1"
align = 1
valign = 1
@@ -629,6 +631,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "2"
align = 1
valign = 1
@@ -643,6 +646,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "3"
align = 1
valign = 1
@@ -657,6 +661,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "4"
align = 1
valign = 1
@@ -671,6 +676,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "5"
align = 1
valign = 1
@@ -685,6 +691,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "6"
align = 1
valign = 1
@@ -699,6 +706,7 @@ margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "7"
align = 1
valign = 1
@@ -713,6 +721,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "8"
align = 1
valign = 1
@@ -728,6 +737,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "9"
align = 1
valign = 1
@@ -743,6 +753,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "10"
align = 1
valign = 1
@@ -758,6 +769,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "11"
align = 1
valign = 1
@@ -773,6 +785,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "12"
align = 1
valign = 1
@@ -788,6 +801,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "13"
align = 1
valign = 1
@@ -803,6 +817,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "14"
align = 1
valign = 1
@@ -818,6 +833,7 @@ margin_bottom = 44.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "15"
align = 1
valign = 1
@@ -825,6 +841,133 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="16" type="Label" parent="Buttons/ButtonGrid"]
margin_top = 48.0
margin_right = 27.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "16"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="17" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 31.0
margin_top = 48.0
margin_right = 58.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "17"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="18" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 62.0
margin_top = 48.0
margin_right = 89.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "18"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="19" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 93.0
margin_top = 48.0
margin_right = 120.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "19"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="20" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 124.0
margin_top = 48.0
margin_right = 151.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "20"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="21" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 155.0
margin_top = 48.0
margin_right = 182.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "21"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="22" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 186.0
margin_top = 48.0
margin_right = 213.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "22"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="23" type="Label" parent="Buttons/ButtonGrid"]
margin_left = 217.0
margin_top = 48.0
margin_right = 244.0
margin_bottom = 68.0
rect_min_size = Vector2( 0, 20 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0.2, 0.1, 0.3, 1 )
text = "23"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Vibration" type="VBoxContainer" parent="."]
anchor_top = 1.0
anchor_bottom = 1.0

View File

@@ -44,3 +44,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -30,9 +30,10 @@ func _input(event):
map.inverted = joy_mapping_axis_invert.pressed
if joy_mapping_full_axis.pressed:
map.axis = JoyMapping.AXIS.FULL
elif motion.axis_value > 0:
map.axis = JoyMapping.AXIS.HALF_PLUS
else:
var plus = motion.axis_value > 0
map.axis = JoyMapping.AXIS.HALF_PLUS if plus else JoyMapping.AXIS.HALF_MINUS
map.axis = JoyMapping.AXIS.HALF_MINUS
joy_mapping_text.text = map.to_human_string()
cur_mapping[steps[cur_step]] = map
elif event is InputEventJoypadButton and event.pressed:

View File

@@ -38,4 +38,6 @@ config/icon="res://icon.png"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"

View File

@@ -39,6 +39,13 @@ func datetime_to_string(date):
})
func scan_midi_devices():
OS.open_midi_inputs()
var devices = OS.get_connected_midi_inputs().join(", ")
OS.close_midi_inputs()
return devices
func add_header(header):
rtl.append_bbcode("\n[b][u][color=#6df]{header}[/color][/u][/b]\n".format({
header = header,
@@ -58,7 +65,7 @@ func _ready():
for i in OS.get_audio_driver_count():
audio_drivers.push_back(OS.get_audio_driver_name(i))
add_line("Available drivers", audio_drivers.join(", "))
add_line("MIDI inputs", OS.get_connected_midi_inputs().join(", "))
add_line("MIDI inputs", scan_midi_devices())
add_header("Date")
add_line("Date and time (local)", datetime_to_string(OS.get_datetime()))

View File

@@ -34,4 +34,6 @@ singletons=[ ]
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_etc=true
vram_compression/import_etc2=false
quality/filters/msaa=2

View File

@@ -79,4 +79,6 @@ move_right={
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_etc=true
vram_compression/import_etc2=false
quality/filters/msaa=2

View File

@@ -40,3 +40,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -28,5 +28,7 @@ singletons=[ ]
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=0
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )
environment/default_environment="res://default_env.tres"

View File

@@ -35,4 +35,6 @@ pointing/emulate_touch_from_mouse=true
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0.113725, 0.133333, 0.196078, 1 )

View File

@@ -26,4 +26,6 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"

View File

@@ -173,3 +173,5 @@ exit={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -37,3 +37,4 @@ singletons=[ ]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -54,3 +54,5 @@ move_up={
quality/driver/driver_name="GLES2"
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -69,4 +69,6 @@ right_move_up={
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
viewport/default_clear_color=Color( 0, 0, 0, 1 )

View File

@@ -64,3 +64,5 @@ move_up={
quality/driver/driver_name="GLES2"
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -35,3 +35,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -17,6 +17,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
The protocol is text based, and composed by a command and possibly multiple payload arguments, each separated by a new line.
Messages without payload must still end with a newline and are the following:
- `J: ` (or `J: <ROOM>`), must be sent by client immediately after connection to get a lobby assigned or join a known one.
This messages is also sent by server back to the client to notify assigned lobby, or simply a successful join.
- `I: <ID>`, sent by server to identify the client when it joins a room.
@@ -27,6 +28,7 @@ Messages without payload must still end with a newline and are the following:
When a lobby is sealed, no new client will be able to join, and the lobby will be destroyed (and clients disconnected) after 10 seconds.
Messages with payload (used to transfer WebRTC parameters) are:
- `O: <ID>`, used to send an offer.
- `A: <ID>`, used to send an answer.
- `C: <ID>`, used to send a candidate.

View File

@@ -46,3 +46,5 @@ modules/webrtc_gdnative_script="res://demo/webrtc/webrtc.gdns"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -30,3 +30,5 @@ singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

View File

@@ -1,11 +1,15 @@
extends Node
func encode_data(data, mode):
return data.to_utf8() if mode == WebSocketPeer.WRITE_MODE_TEXT else var2bytes(data)
if mode == WebSocketPeer.WRITE_MODE_TEXT:
return data.to_utf8()
return var2bytes(data)
func decode_data(data, is_string):
return data.get_string_from_utf8() if is_string else bytes2var(data)
if is_string:
return data.get_string_from_utf8()
return bytes2var(data)
func _log(node, msg):

View File

@@ -21,3 +21,5 @@ run/main_scene="res://Main.tscn"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false

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