mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-08 00:25:21 +03:00
Compare commits
15 Commits
3.5-9e68af
...
3.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
023845b0dd | ||
|
|
c0180d20d1 | ||
|
|
edee4413e3 | ||
|
|
3a23fdbe6a | ||
|
|
c8bb3b874a | ||
|
|
c8f0706055 | ||
|
|
ccc4354331 | ||
|
|
1849640ff8 | ||
|
|
3ae7f01a23 | ||
|
|
690dd395fd | ||
|
|
f85f8b2b4d | ||
|
|
7ddaf29f8d | ||
|
|
b626d3e628 | ||
|
|
a39928fc55 | ||
|
|
fe6f646c9d |
100
.github/workflows/export_html5.yml
vendored
100
.github/workflows/export_html5.yml
vendored
@@ -1,100 +0,0 @@
|
||||
name: Export projects to HTML5 and deploy to GitHub Pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
GODOT_VERSION: 3.3.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.3.3
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- 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/global_illumination/ \
|
||||
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
|
||||
4
.github/workflows/static_checks.yml
vendored
4
.github/workflows/static_checks.yml
vendored
@@ -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@v3
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
33
2d/navigation/character.gd
Normal file
33
2d/navigation/character.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Sprite
|
||||
|
||||
export(float) var character_speed = 400.0
|
||||
|
||||
onready var navigation_agent: NavigationAgent2D = $NavigationAgent2D
|
||||
onready var navigation_path_debug_line: Line2D = $Line2D
|
||||
|
||||
|
||||
func _ready():
|
||||
navigation_path_debug_line.set_as_toplevel(true)
|
||||
|
||||
|
||||
func set_target_location(target_location: Vector2):
|
||||
navigation_agent.set_target_location(target_location)
|
||||
# Alternative way to get a full navigation path with Server API.
|
||||
var navigation_map: RID = get_world_2d().get_navigation_map()
|
||||
var start_position: Vector2 = get_global_transform().get_origin()
|
||||
var target_position: Vector2 = target_location
|
||||
var optimize: bool = true
|
||||
navigation_path_debug_line.points = Navigation2DServer.map_get_path(
|
||||
navigation_map,
|
||||
start_position,
|
||||
target_position,
|
||||
optimize
|
||||
)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
var next_position: Vector2 = navigation_agent.get_next_location()
|
||||
global_position = global_position.move_toward(next_position, delta * character_speed)
|
||||
@@ -1,18 +1,19 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://navigation.gd" type="Script" id=1]
|
||||
[ext_resource path="res://map.png" type="Texture" id=2]
|
||||
[ext_resource path="res://character.png" type="Texture" id=3]
|
||||
[ext_resource path="res://character.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=1]
|
||||
vertices = PoolVector2Array( 587.833, 271.924, 530.464, 284.878, 508.256, 281.177, 497.153, 255.269, 624.926, 359.595, 648.903, 394.065, 620.443, 383.995, 669.26, 297.833, 648.903, 321.891, 650.754, 251.567, 619.293, 510.654, 676.663, 493.998, 706.272, 501.401, 669.26, 529.16, 602.638, 523.608, 587.833, 179.393, 573.028, 140.53, 645.202, 159.036, 710.106, 179.216, 630.397, 212.704, 597.086, 192.348, 471.244, 251.567, 421.277, 270.074, 428.68, 246.015, 502.704, 97.9661, 517.509, 55.4019, 537.866, 99.8167, 536.016, 175.692, 495.302, 164.588, 487.899, 85.0117, 310.24, 75.7586, 308.39, 92.4142, 345.402, 210.854, 360.207, 223.808, 297.286, 258.97, 288.033, 231.211, 319.493, 190.497, 193.651, 423.675, 245.469, 477.343, 221.41, 488.446, 147.386, 408.87, 182.548, 382.961, 145.584, 224.311, 175.145, 332.995, 202.904, 99.8167, 310.24, 62.8043, 695.169, 303.385, 682.214, 284.878, 598.937, 492.148, 571.177, 501.401, 605.437, 456.366, 621.144, 486.596, 538.077, 499.891, 395.879, 501.87, 536.407, 524.944, 371.311, 518.056, 573.028, 94.2648, 582.281, 47.9994, 667.409, 75.7586, 350.954, 447.733, 363.908, 351.501, 384.265, 351.501, 376.862, 418.123, 373.441, 436.494, 424.978, 334.845, 421.277, 360.754, 352.804, 320.04, 321.344, 338.546, 299.136, 283.028, 241.767, 327.443, 234.365, 244.165, 325.228, 486.302, 300.441, 497.494, 317.643, 447.733, 332.441, 457.494, 524.608, 359.37, 526.762, 342.248, 366.441, 467.494, 480.497, 434.779, 496.638, 439.381, 476.441, 468.494, 265.825, 407.019, 184.398, 349.65, 310.24, 112.771, 267.676, 153.485, 221.41, 171.991, 700.721, 268.223, 397.219, 188.646, 415.725, 177.543, 465.692, 179.393, 476.796, 207.152, 443.485, 192.348, 437.933, 170.14, 452.738, 166.439, 460.14, 123.875, 476.796, 149.783, 189.95, 231.211 )
|
||||
polygons = [ PoolIntArray( 0, 1, 2, 3 ), PoolIntArray( 4, 5, 6 ), PoolIntArray( 7, 8, 9 ), PoolIntArray( 10, 11, 12, 13, 14 ), PoolIntArray( 15, 16, 17, 18, 19, 20 ), PoolIntArray( 21, 3, 2, 22, 23 ), PoolIntArray( 24, 25, 26, 27, 28 ), PoolIntArray( 25, 24, 29 ), PoolIntArray( 30, 25, 29, 31 ), PoolIntArray( 32, 33, 34, 35, 36 ), PoolIntArray( 37, 38, 39, 40 ), PoolIntArray( 41, 37, 40 ), PoolIntArray( 41, 40, 42, 43 ), PoolIntArray( 44, 45, 30, 31 ), PoolIntArray( 46, 12, 11, 7, 47 ), PoolIntArray( 47, 7, 9 ), PoolIntArray( 48, 10, 14, 49 ), PoolIntArray( 50, 6, 5, 51, 48 ), PoolIntArray( 52, 50, 48, 49 ), PoolIntArray( 53, 52, 49, 54, 55 ), PoolIntArray( 17, 56, 57, 58, 18 ), PoolIntArray( 59, 60, 61, 62, 63 ), PoolIntArray( 64, 65, 61, 66 ), PoolIntArray( 66, 61, 60, 67, 68 ), PoolIntArray( 68, 67, 69, 70 ), PoolIntArray( 68, 70, 35, 34 ), PoolIntArray( 71, 53, 55, 72 ), PoolIntArray( 71, 72, 73, 74 ), PoolIntArray( 4, 6, 75, 76 ), PoolIntArray( 63, 77, 74, 59 ), PoolIntArray( 78, 2, 1, 76, 75, 79, 80 ), PoolIntArray( 78, 80, 63, 62 ), PoolIntArray( 81, 59, 74, 73 ), PoolIntArray( 81, 73, 41, 82 ), PoolIntArray( 44, 31, 83, 84, 85 ), PoolIntArray( 18, 86, 47, 9, 19 ), PoolIntArray( 15, 20, 3, 21 ), PoolIntArray( 23, 22, 87, 88 ), PoolIntArray( 89, 28, 27, 90, 91 ), PoolIntArray( 89, 91, 92, 93 ), PoolIntArray( 36, 94, 95, 93, 92 ), PoolIntArray( 36, 92, 88 ), PoolIntArray( 36, 88, 87, 32 ), PoolIntArray( 36, 35, 85, 84 ), PoolIntArray( 42, 44, 85, 96 ), PoolIntArray( 42, 96, 43 ), PoolIntArray( 41, 43, 82 ) ]
|
||||
outlines = [ PoolVector2Array( 221.41, 488.446, 147.386, 408.87, 145.584, 224.311, 202.904, 99.8167, 310.24, 62.8043, 310.24, 75.7586, 517.509, 55.4019, 537.866, 99.8167, 536.016, 175.692, 476.796, 207.152, 443.485, 192.348, 437.933, 170.14, 415.725, 177.543, 428.68, 246.015, 471.244, 251.567, 587.833, 179.393, 573.028, 140.53, 645.202, 159.036, 573.028, 94.2648, 582.281, 47.9994, 667.409, 75.7586, 710.106, 179.216, 700.721, 268.223, 682.214, 284.878, 695.169, 303.385, 706.272, 501.401, 669.26, 529.16, 602.638, 523.608, 571.177, 501.401, 536.407, 524.944, 371.311, 518.056, 300.441, 497.494, 317.643, 447.733, 182.548, 382.961, 193.651, 423.675, 245.469, 477.343 ), PoolVector2Array( 350.954, 447.733, 363.908, 351.501, 321.344, 338.546, 241.767, 327.443, 234.365, 244.165, 288.033, 231.211, 221.41, 171.991, 189.95, 231.211, 175.145, 332.995, 184.398, 349.65, 265.825, 407.019 ), PoolVector2Array( 267.676, 153.485, 310.24, 112.771, 308.39, 92.4142, 487.899, 85.0117, 502.704, 97.9661, 495.302, 164.588, 465.692, 179.393, 452.738, 166.439, 476.796, 149.783, 460.14, 123.875, 319.493, 190.497 ), PoolVector2Array( 397.219, 188.646, 345.402, 210.854, 360.207, 223.808, 297.286, 258.97, 299.136, 283.028, 352.804, 320.04, 424.978, 334.845, 421.277, 360.754, 384.265, 351.501, 376.862, 418.123, 480.497, 434.779, 508.256, 281.177, 421.277, 270.074 ), PoolVector2Array( 497.153, 255.269, 597.086, 192.348, 630.397, 212.704, 650.754, 251.567, 648.903, 321.891, 669.26, 297.833, 676.663, 493.998, 619.293, 510.654, 598.937, 492.148, 621.144, 486.596, 648.903, 394.065, 624.926, 359.595, 526.762, 342.248, 530.464, 284.878, 587.833, 271.924 ), PoolVector2Array( 325.228, 486.302, 332.441, 457.494, 366.441, 467.494, 373.441, 436.494, 476.441, 468.494, 496.638, 439.381, 524.608, 359.37, 620.443, 383.995, 605.437, 456.366, 538.077, 499.891, 395.879, 501.87 ) ]
|
||||
|
||||
[node name="Navigation2D" type="Node2D"]
|
||||
[node name="NavigationDemo" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Navmesh" type="NavigationPolygonInstance" parent="."]
|
||||
[node name="NavigationPolygonInstance" type="NavigationPolygonInstance" parent="."]
|
||||
navpoly = SubResource( 1 )
|
||||
|
||||
[node name="Map" type="Sprite" parent="."]
|
||||
@@ -24,6 +25,13 @@ position = Vector2( 228.464, 132.594 )
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 3 )
|
||||
offset = Vector2( 0, -26 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="Character"]
|
||||
|
||||
[node name="Line2D" type="Line2D" parent="Character"]
|
||||
width = 4.0
|
||||
default_color = Color( 1, 0, 0, 1 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2( 420, 300 )
|
||||
|
||||
@@ -1,76 +1,10 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
export(float) var character_speed = 400.0
|
||||
var path = []
|
||||
|
||||
var map
|
||||
|
||||
onready var character = $Character
|
||||
|
||||
|
||||
func _ready():
|
||||
# use call deferred to make sure the entire SceneTree Nodes are setup
|
||||
# else yield on 'physics_frame' in a _ready() might get stuck
|
||||
call_deferred("setup_navserver")
|
||||
|
||||
|
||||
func _process(delta):
|
||||
var walk_distance = character_speed * delta
|
||||
move_along_path(walk_distance)
|
||||
|
||||
|
||||
# The "click" event is a custom input action defined in
|
||||
# Project > Project Settings > Input Map tab.
|
||||
func _unhandled_input(event):
|
||||
if not event.is_action_pressed("click"):
|
||||
return
|
||||
_update_navigation_path(character.position, get_local_mouse_position())
|
||||
|
||||
|
||||
func setup_navserver():
|
||||
|
||||
# create a new navigation map
|
||||
map = Navigation2DServer.map_create()
|
||||
Navigation2DServer.map_set_active(map, true)
|
||||
|
||||
# create a new navigation region and add it to the map
|
||||
var region = Navigation2DServer.region_create()
|
||||
Navigation2DServer.region_set_transform(region, Transform())
|
||||
Navigation2DServer.region_set_map(region, map)
|
||||
|
||||
# sets navigation mesh for the region
|
||||
var navigation_poly = NavigationMesh.new()
|
||||
navigation_poly = $Navmesh.navpoly
|
||||
Navigation2DServer.region_set_navpoly(region, navigation_poly)
|
||||
|
||||
# wait for Navigation2DServer sync to adapt to made changes
|
||||
yield(get_tree(), "physics_frame")
|
||||
|
||||
|
||||
func move_along_path(distance):
|
||||
var last_point = character.position
|
||||
while path.size():
|
||||
var distance_between_points = last_point.distance_to(path[0])
|
||||
# The position to move to falls between two points.
|
||||
if distance <= distance_between_points:
|
||||
character.position = last_point.linear_interpolate(path[0], distance / distance_between_points)
|
||||
return
|
||||
# The position is past the end of the segment.
|
||||
distance -= distance_between_points
|
||||
last_point = path[0]
|
||||
path.remove(0)
|
||||
# The character reached the end of the path.
|
||||
character.position = last_point
|
||||
set_process(false)
|
||||
|
||||
|
||||
func _update_navigation_path(start_position, end_position):
|
||||
# map_get_path is part of the avigation2DServer class.
|
||||
# It returns a PoolVector2Array of points that lead you
|
||||
# from the start_position to the end_position.
|
||||
path = Navigation2DServer.map_get_path(map,start_position, end_position, true)
|
||||
# The first point is always the start_position.
|
||||
# We don't need it in this example as it corresponds to the character's position.
|
||||
path.remove(0)
|
||||
set_process(true)
|
||||
character.set_target_location(get_global_mouse_position())
|
||||
|
||||
@@ -34,7 +34,7 @@ func _process(_delta):
|
||||
func _unhandled_input(event):
|
||||
if event.is_action_pressed("click"):
|
||||
var global_mouse_pos = get_global_mouse_position()
|
||||
if Input.is_key_pressed(KEY_SHIFT):
|
||||
if Input.is_key_pressed(KEY_SHIFT) and get_parent().get_node("TileMap").check_start_position(global_mouse_pos):
|
||||
global_position = global_mouse_pos
|
||||
else:
|
||||
_target_position = global_mouse_pos
|
||||
|
||||
@@ -127,6 +127,14 @@ func is_outside_map_bounds(point):
|
||||
return point.x < 0 or point.y < 0 or point.x >= map_size.x or point.y >= map_size.y
|
||||
|
||||
|
||||
func check_start_position(world_start):
|
||||
var start_point = world_to_map(world_start)
|
||||
if start_point in obstacles:
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
|
||||
func get_astar_path(world_start, world_end):
|
||||
self.path_start_position = world_to_map(world_start)
|
||||
self.path_end_position = world_to_map(world_end)
|
||||
|
||||
@@ -22,7 +22,7 @@ window/size/width=640
|
||||
window/size/height=400
|
||||
window/dpi/allow_hidpi=true
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="expand"
|
||||
window/stretch/aspect="keep"
|
||||
stretch_2d=true
|
||||
|
||||
[gdnative]
|
||||
|
||||
44
3d/navmesh/character.gd
Normal file
44
3d/navmesh/character.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
extends Spatial
|
||||
|
||||
const Line3D = preload("res://line3d.gd")
|
||||
|
||||
|
||||
export(float) var character_speed = 10.0
|
||||
export var show_path = true
|
||||
|
||||
onready var _nav_agent = $NavigationAgent
|
||||
onready var _nav_path_line = $Line3D
|
||||
|
||||
|
||||
func _ready():
|
||||
_nav_path_line.set_as_toplevel(true)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if _nav_agent.is_navigation_finished():
|
||||
return
|
||||
var next_position = _nav_agent.get_next_location()
|
||||
var offset = next_position - global_translation
|
||||
global_translation = global_translation.move_toward(next_position, delta * character_speed)
|
||||
|
||||
# Make the robot look at the direction we're traveling.
|
||||
# Clamp y to 0 so the robot only looks left and right, not up/down.
|
||||
offset.y = 0
|
||||
look_at(global_translation + offset, Vector3.UP)
|
||||
|
||||
|
||||
func set_target_location(target_location: Vector3):
|
||||
_nav_agent.set_target_location(target_location)
|
||||
# get a full navigation path with the NavigationServer API
|
||||
if show_path:
|
||||
var start_position = global_transform.origin
|
||||
var target_position = target_location
|
||||
var optimize = true
|
||||
var navigation_map = get_world().get_navigation_map()
|
||||
var path = NavigationServer.map_get_path(
|
||||
navigation_map,
|
||||
start_position,
|
||||
target_position,
|
||||
optimize)
|
||||
_nav_path_line.draw_path(path)
|
||||
|
||||
23
3d/navmesh/line3d.gd
Normal file
23
3d/navmesh/line3d.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends ImmediateGeometry
|
||||
|
||||
|
||||
var _material := SpatialMaterial.new()
|
||||
|
||||
|
||||
func _ready():
|
||||
_material.flags_unshaded = true
|
||||
_material.flags_use_point_size = true
|
||||
_material.albedo_color = Color.white
|
||||
|
||||
|
||||
func draw_path(path):
|
||||
set_material_override(_material)
|
||||
clear()
|
||||
begin(Mesh.PRIMITIVE_POINTS, null)
|
||||
add_vertex(path[0])
|
||||
add_vertex(path[path.size() - 1])
|
||||
end()
|
||||
begin(Mesh.PRIMITIVE_LINE_STRIP, null)
|
||||
for x in path:
|
||||
add_vertex(x)
|
||||
end()
|
||||
31
3d/navmesh/navigation.gd
Normal file
31
3d/navmesh/navigation.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends Spatial
|
||||
|
||||
|
||||
var _cam_rotation = 0.0
|
||||
|
||||
onready var _camera = $CameraBase/Camera as Camera
|
||||
onready var _robot = $RobotBase as Spatial
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent):
|
||||
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.pressed:
|
||||
# get closest point on navmesh for the current mouse cursor position
|
||||
var mouse_cursor_position = event.position
|
||||
var camera_ray_length = 1000.0
|
||||
var camera_ray_start = _camera.project_ray_origin(mouse_cursor_position)
|
||||
var camera_ray_end = camera_ray_start + _camera.project_ray_normal(mouse_cursor_position) * camera_ray_length
|
||||
var navigation_map = get_world().get_navigation_map()
|
||||
|
||||
var closest_point_on_navmesh = NavigationServer.map_get_closest_point_to_segment(
|
||||
navigation_map,
|
||||
camera_ray_start,
|
||||
camera_ray_end
|
||||
)
|
||||
_robot.set_target_location(closest_point_on_navmesh)
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
if event.button_mask & (BUTTON_MASK_MIDDLE + BUTTON_MASK_RIGHT):
|
||||
_cam_rotation += event.relative.x * 0.005
|
||||
$CameraBase.set_rotation(Vector3.UP * _cam_rotation)
|
||||
print("Camera Rotation: ", _cam_rotation)
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
extends Spatial
|
||||
|
||||
|
||||
const SPEED = 10.0
|
||||
|
||||
var camrot = 0.0
|
||||
var m = SpatialMaterial.new()
|
||||
|
||||
var map
|
||||
|
||||
var path = []
|
||||
var show_path = true
|
||||
|
||||
onready var robot = get_node("RobotBase")
|
||||
onready var camera = get_node("CameraBase/Camera")
|
||||
|
||||
|
||||
func _ready():
|
||||
set_process_input(true)
|
||||
m.flags_unshaded = true
|
||||
m.flags_use_point_size = true
|
||||
m.albedo_color = Color.white
|
||||
|
||||
# use call deferred to make sure the entire SceneTree Nodes are setup
|
||||
# else yield on 'physics_frame' in a _ready() might get stuck
|
||||
call_deferred("setup_navserver")
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
var direction = Vector3()
|
||||
|
||||
# We need to scale the movement speed by how much delta has passed,
|
||||
# otherwise the motion won't be smooth.
|
||||
var step_size = delta * SPEED
|
||||
|
||||
if path.size() > 0:
|
||||
# Direction is the difference between where we are now
|
||||
# and where we want to go.
|
||||
var destination = path[0]
|
||||
direction = destination - robot.translation
|
||||
|
||||
# If the next node is closer than we intend to 'step', then
|
||||
# take a smaller step. Otherwise we would go past it and
|
||||
# potentially go through a wall or over a cliff edge!
|
||||
if step_size > direction.length():
|
||||
step_size = direction.length()
|
||||
# We should also remove this node since we're about to reach it.
|
||||
path.remove(0)
|
||||
|
||||
# Move the robot towards the path node, by how far we want to travel.
|
||||
# Note: For a KinematicBody, we would instead use move_and_slide
|
||||
# so collisions work properly.
|
||||
robot.translation += direction.normalized() * step_size
|
||||
|
||||
# Lastly let's make sure we're looking in the direction we're traveling.
|
||||
# Clamp y to 0 so the robot only looks left and right, not up/down.
|
||||
direction.y = 0
|
||||
if direction:
|
||||
# Direction is relative, so apply it to the robot's location to
|
||||
# get a point we can actually look at.
|
||||
var look_at_point = robot.translation + direction.normalized()
|
||||
# Make the robot look at the point.
|
||||
robot.look_at(look_at_point, Vector3.UP)
|
||||
|
||||
|
||||
func setup_navserver():
|
||||
# create a new navigation map
|
||||
map = NavigationServer.map_create()
|
||||
NavigationServer.map_set_up(map, Vector3.UP)
|
||||
NavigationServer.map_set_active(map, true)
|
||||
|
||||
# create a new navigation region and add it to the map
|
||||
var region = NavigationServer.region_create()
|
||||
NavigationServer.region_set_transform(region, Transform())
|
||||
NavigationServer.region_set_map(region, map)
|
||||
|
||||
# sets navigation mesh for the region
|
||||
var navigation_mesh = NavigationMesh.new()
|
||||
navigation_mesh = $NavigationMeshInstance_Level.navmesh
|
||||
NavigationServer.region_set_navmesh(region, navigation_mesh)
|
||||
|
||||
# wait for NavigationServer sync to adapt to made changes
|
||||
yield(get_tree(), "physics_frame")
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.pressed:
|
||||
var from = camera.project_ray_origin(event.position)
|
||||
var to = from + camera.project_ray_normal(event.position) * 1000
|
||||
var target_point = NavigationServer.map_get_closest_point_to_segment(map, from, to)
|
||||
var optimize_path = true
|
||||
|
||||
# Set the path between the robots current location and our target.
|
||||
path = NavigationServer.map_get_path(map,robot.translation, target_point, optimize_path)
|
||||
|
||||
if show_path:
|
||||
draw_path(path)
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
if event.button_mask & (BUTTON_MASK_MIDDLE + BUTTON_MASK_RIGHT):
|
||||
camrot += event.relative.x * 0.005
|
||||
get_node("CameraBase").set_rotation(Vector3(0, camrot, 0))
|
||||
print("Camera Rotation: ", camrot)
|
||||
|
||||
|
||||
func draw_path(path_array):
|
||||
var im = get_node("Draw")
|
||||
im.set_material_override(m)
|
||||
im.clear()
|
||||
im.begin(Mesh.PRIMITIVE_POINTS, null)
|
||||
im.add_vertex(path_array[0])
|
||||
im.add_vertex(path_array[path_array.size() - 1])
|
||||
im.end()
|
||||
im.begin(Mesh.PRIMITIVE_LINE_STRIP, null)
|
||||
for x in path:
|
||||
im.add_vertex(x)
|
||||
im.end()
|
||||
@@ -1,7 +1,9 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://navmesh.gd" type="Script" id=1]
|
||||
[ext_resource path="res://character.gd" type="Script" id=1]
|
||||
[ext_resource path="res://line3d.gd" type="Script" id=2]
|
||||
[ext_resource path="res://default_env.tres" type="Environment" id=3]
|
||||
[ext_resource path="res://navigation.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="NavigationMesh" id=1]
|
||||
vertices = PoolVector3Array( 0.442188, 2.35475, 1.48594, 1.04219, 2.75475, 2.38594, 1.94219, 1.55475, 1.48594, 1.34219, 0.554745, -0.0140624, -0.757813, 0.354745, 2.98594, -0.157812, 0.354745, 2.38594, -0.457812, 0.354745, 1.48594, -1.95781, 0.354745, 2.68594, 12.4422, 2.35475, -1.81406, 10.0422, 2.35475, 0.285938, 10.3422, 2.35475, 2.98594, -6.45781, 3.95475, -0.914063, -5.85781, 4.15475, -0.614062, -4.95781, 3.95475, -1.81406, -4.35781, 2.55475, -3.61406, -5.25781, 2.55475, -5.11406, -6.45781, 3.35475, -3.91406, -4.65781, 3.35475, -2.71406, 1.94219, 1.55475, 1.48594, 2.54219, 0.354745, 1.78594, 3.74219, 0.354745, 1.78594, 4.04219, 0.554745, 0.285938, 1.34219, 0.554745, -0.0140624, 0.142188, 0.354745, -1.81406, -0.757813, 0.754745, -4.21406, -2.25781, 0.954745, -3.01406, -1.50781, 0.754745, -3.61406, 9.44219, 2.95475, 5.38594, 10.3422, 2.35475, 8.08594, 10.9422, 2.35475, 9.28594, 12.4422, 2.35475, 8.98594, 12.4422, 2.35475, -1.81406, 10.3422, 2.35475, 2.98594, 9.44219, 2.95475, 5.38594, 9.14219, 2.35475, 5.98594, 9.14219, 2.35475, 7.78594, 10.3422, 2.35475, 8.08594, 10.3422, 2.35475, 2.98594, 9.74219, 2.75475, 3.28594, 9.44219, 2.95475, 5.38594, 0.142188, 0.354745, -1.81406, 1.34219, 0.554745, -0.0140624, 4.04219, 0.554745, 0.285938, 6.14219, 1.95475, -1.81406, 3.14219, 0.354745, -1.81406, 5.09219, 1.55475, -0.764062, 6.14219, 1.95475, -1.81406, 4.04219, 0.554745, 0.285938, 10.0422, 2.35475, 0.285938, 12.4422, 2.35475, -1.81406, 7.71719, 2.35475, -1.81406, 5.09219, 1.55475, -0.764062, 5.54219, 1.75475, 0.285938, 7.04219, 2.35475, 0.285938, 11.8422, 2.35475, 11.0859, 12.4422, 2.35475, 8.98594, 10.9422, 2.35475, 9.28594, 10.6422, 2.35475, 10.1859, 10.6422, 2.35475, 10.1859, 0.142188, 8.35474, 10.4859, 0.142188, 7.95475, 11.0859, 11.8422, 2.35475, 11.0859, 7.14219, 2.35475, 10.2859, 6.8279, 2.35475, 11.0859, -1.95781, 1.15475, -5.11406, -5.25781, 2.55475, -5.11406, -4.35781, 2.55475, -3.61406, -2.25781, 0.954745, -3.01406, -0.757813, 0.754745, -4.21406, -3.30781, 1.75475, -3.31406, -1.50781, 0.754745, -3.61406, -1.95781, 0.354745, 2.68594, -0.457812, 0.354745, 1.48594, 1.34219, 0.554745, -0.0140624, 0.142188, 0.354745, -1.81406, -2.25781, 0.954745, -3.01406, -3.15781, 4.95475, -0.0140624, -4.35781, 4.95475, 1.18594, -4.95781, 4.95475, 2.68594, -3.15781, 4.95475, 2.98594, -1.65781, 4.95475, 1.18594, -1.65781, 4.75475, -0.614062, 3.14219, 4.95475, 0.285938, 1.34219, 4.95475, -0.614062, 0.142188, 4.55475, 0.885938, 2.54219, 4.95475, 2.38594, -3.15781, 4.95475, -0.0140624, -4.95781, 3.95475, -1.81406, -5.85781, 4.15475, -0.614062, -4.35781, 4.95475, 1.18594, 3.14219, 4.95475, 4.48594, 4.64219, 4.95475, 5.38594, 4.94219, 4.95475, 3.28594, 3.14219, 4.95475, 0.285938, 2.54219, 4.95475, 2.38594, 9.44219, 2.95475, 5.38594, 9.74219, 2.75475, 3.28594, 4.94219, 4.95475, 3.28594, 4.64219, 4.95475, 5.38594, 6.24219, 4.95475, 5.38594, 7.84219, 4.15475, 5.38594, 6.54219, 4.95475, 3.28594, -1.65781, 4.75475, -0.614062, -1.65781, 4.95475, 1.18594, 0.142188, 4.55475, 0.885938, 1.34219, 4.95475, -0.614062, -0.157812, 4.55475, -0.614062, 0.142188, 7.95475, 11.0859, 0.142188, 8.35474, 10.4859, -0.157812, 8.35474, 8.98594, -0.0078125, 8.35474, 10.0359, -2.25781, 8.35474, 11.0859, 0.142188, 7.95475, 11.0859, -0.157812, 8.35474, 8.98594, -2.85781, 8.35474, 6.58594, -5.55781, 8.35474, 7.78594, -5.55781, 8.35474, 8.38594, -1.05781, 8.35474, 11.0859, -0.0078125, 8.35474, 10.0359, -2.85781, 8.35474, 6.58594, 1.04219, 2.75475, 2.38594, 0.442188, 2.35475, 1.48594, -5.55781, 8.35474, 7.78594, -0.907812, 5.55475, 4.48594, -3.15781, 7.35475, 5.26594, -4.35781, 8.35474, 6.52594, 0.142188, 0.354745, 3.58594, -0.757813, 0.354745, 2.98594, -1.95781, 0.354745, 2.68594, 3.74219, 0.354745, 1.78594, 2.54219, 0.354745, 1.78594, 0.142188, 0.354745, 3.58594, 4.04219, 0.554745, 5.68594, 9.14219, 2.35475, 7.78594, 9.14219, 2.35475, 5.98594, 4.04219, 0.554745, 5.68594, -1.95781, 0.354745, 7.78594, 2.79933, 0.354745, 7.78594, 5.97076, 1.95475, 7.78594, 7.44219, 2.35475, 5.88594, 5.74219, 1.75475, 5.78594, 0.142188, 0.354745, 3.58594, -1.95781, 0.354745, 2.68594, -1.95781, 0.354745, 7.78594, 4.04219, 0.554745, 5.68594, 4.64219, 4.95475, 5.38594, 3.14219, 4.95475, 4.48594, 2.84219, 4.95475, 5.68594, 4.04219, 4.95475, 7.18594, 4.64219, 4.95475, 5.38594, 2.84219, 4.95475, 5.68594, 1.34219, 4.95475, 7.18594, 2.54219, 4.95475, 8.68594, 1.34219, 4.95475, 7.18594, -1.35781, 4.95475, 7.48594, -1.35781, 4.75475, 9.28594, 2.54219, 4.95475, 8.68594, -0.0078125, 4.55475, 7.33594, -4.35781, 4.95475, 7.48594, -1.35781, 4.75475, 9.28594, -1.35781, 4.95475, 7.48594, -3.45781, 4.95475, 5.38594, -5.25781, 4.95475, 5.38594, -3.45781, 4.95475, 5.38594, -3.15781, 4.95475, 2.98594, -4.95781, 4.95475, 2.68594, -5.25781, 4.95475, 5.38594 )
|
||||
@@ -89,7 +91,7 @@ surfaces/2 = {
|
||||
|
||||
[node name="Navigation" type="Spatial"]
|
||||
_import_path = NodePath(".")
|
||||
script = ExtResource( 1 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="NavigationMeshInstance_Level" type="NavigationMeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0452547, 0 )
|
||||
@@ -101,9 +103,6 @@ transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, -0.0452547, 0 )
|
||||
use_in_baked_light = true
|
||||
mesh = SubResource( 3 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
_import_path = NodePath("AnimationPlayer")
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 0.623013, -0.733525, 0.271654, 0.321394, 0.55667, 0.766044, -0.713134, -0.389948, 0.582563, 10.0773, 5.02381, 0 )
|
||||
shadow_enabled = true
|
||||
@@ -113,8 +112,6 @@ directional_shadow_bias_split_scale = 0.1
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = ExtResource( 3 )
|
||||
|
||||
[node name="Draw" type="ImmediateGeometry" parent="."]
|
||||
|
||||
[node name="CameraBase" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.07475, 0, 1.96678 )
|
||||
|
||||
@@ -125,9 +122,15 @@ fov = 50.0
|
||||
near = 0.1
|
||||
|
||||
[node name="RobotBase" type="Position3D" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Robot" type="MeshInstance" parent="RobotBase"]
|
||||
_import_path = NodePath("Sphere")
|
||||
transform = Transform( -0.5, 0, -7.54979e-08, 0, 1, 0, 7.54979e-08, 0, -0.5, 0, 1, 0 )
|
||||
use_in_baked_light = true
|
||||
mesh = SubResource( 7 )
|
||||
|
||||
[node name="NavigationAgent" type="NavigationAgent" parent="RobotBase"]
|
||||
|
||||
[node name="Line3D" type="ImmediateGeometry" parent="RobotBase"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 129 B |
@@ -1,37 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.s3tc.stex"
|
||||
path.etc="res://.import/particle.png-c2ba3d91e96c62035d672392a1197218.etc.stex"
|
||||
metadata={
|
||||
"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.etc.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
||||
22
README.md
22
README.md
@@ -6,22 +6,12 @@ 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 Godot's `3.x` branch.
|
||||
- The [`4.0-dev`](https://github.com/godotengine/godot-demo-projects/tree/4.0-dev) branch is compatible with Godot's `master` branch (currently 4.0-beta).
|
||||
- If you are using an older version of Godot, use the appropriate branch for your Godot version:
|
||||
|
||||
- [`3.4`](https://github.com/godotengine/godot-demo-projects/tree/3.4)
|
||||
branch for Godot 3.4.x.
|
||||
- [`3.3`](https://github.com/godotengine/godot-demo-projects/tree/3.3)
|
||||
branch for Godot 3.3.x.
|
||||
- [`3.2`](https://github.com/godotengine/godot-demo-projects/tree/3.2)
|
||||
branch for Godot 3.2.x.
|
||||
- [`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
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ Language: GDScript
|
||||
|
||||
Renderer: GLES 2
|
||||
|
||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/1634
|
||||
|
||||
## Technical notes
|
||||
|
||||
The demo works with the following project settings:
|
||||
|
||||
@@ -33,7 +33,7 @@ func _refresh_shader_params():
|
||||
|
||||
func _on_DocumentationButton_pressed():
|
||||
#warning-ignore:return_value_discarded
|
||||
OS.shell_open("https://docs.godotengine.org/en/latest/classes/class_opensimplexnoise.html")
|
||||
OS.shell_open("https://docs.godotengine.org/en/3.6/classes/class_opensimplexnoise.html")
|
||||
|
||||
|
||||
func _on_RandomSeedButton_pressed():
|
||||
|
||||
@@ -16,9 +16,6 @@ margin_top = 24.0
|
||||
margin_right = -24.0
|
||||
margin_bottom = -24.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SeamlessNoiseTexture" type="TextureRect" parent="."]
|
||||
material = ExtResource( 2 )
|
||||
@@ -26,39 +23,34 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -196.0
|
||||
margin_left = -256.0
|
||||
margin_top = -256.0
|
||||
margin_right = 316.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 256.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ButtonsContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -137.0
|
||||
margin_bottom = 44.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
margin_left = -200.0
|
||||
margin_bottom = 48.0
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="DocumentationButton" type="Button" parent="ButtonsContainer"]
|
||||
margin_right = 137.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 20.0
|
||||
grow_horizontal = 0
|
||||
text = "API Documentation"
|
||||
text = "API Documentation 3.6"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="RandomSeedButton" type="Button" parent="ButtonsContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 137.0
|
||||
margin_bottom = 44.0
|
||||
margin_top = 28.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 48.0
|
||||
grow_horizontal = 0
|
||||
text = "Random Seed"
|
||||
__meta__ = {
|
||||
@@ -66,14 +58,12 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="ParameterContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 280.0
|
||||
margin_bottom = 136.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
margin_right = 200.0
|
||||
margin_bottom = 152.0
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="SeedSpinBox" type="SpinBox" parent="ParameterContainer"]
|
||||
margin_right = 280.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 24.0
|
||||
min_value = -2.14748e+09
|
||||
max_value = 2.14748e+09
|
||||
@@ -82,34 +72,35 @@ allow_lesser = true
|
||||
prefix = "Seed:"
|
||||
|
||||
[node name="LacunaritySpinBox" type="SpinBox" parent="ParameterContainer"]
|
||||
margin_top = 28.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 52.0
|
||||
margin_top = 32.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 56.0
|
||||
step = 0.1
|
||||
allow_greater = true
|
||||
prefix = "Lacunarity:"
|
||||
|
||||
[node name="PeriodSpinBox" type="SpinBox" parent="ParameterContainer"]
|
||||
margin_top = 56.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 80.0
|
||||
margin_top = 64.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 88.0
|
||||
min_value = -100000.0
|
||||
max_value = 100000.0
|
||||
allow_greater = true
|
||||
prefix = "Period:"
|
||||
|
||||
[node name="PersistenceSpinBox" type="SpinBox" parent="ParameterContainer"]
|
||||
margin_top = 84.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 108.0
|
||||
margin_top = 96.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 120.0
|
||||
max_value = 1000.0
|
||||
step = 0.05
|
||||
allow_greater = true
|
||||
prefix = "Persistance:"
|
||||
prefix = "Persistence:"
|
||||
|
||||
[node name="OctavesSpinBox" type="SpinBox" parent="ParameterContainer"]
|
||||
margin_top = 112.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 136.0
|
||||
margin_top = 128.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 152.0
|
||||
min_value = 1.0
|
||||
max_value = 9.0
|
||||
value = 1.0
|
||||
@@ -118,15 +109,13 @@ prefix = "Octaves:"
|
||||
[node name="ClipContainer" type="VBoxContainer" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -52.0
|
||||
margin_right = 280.0
|
||||
margin_top = -56.0
|
||||
margin_right = 200.0
|
||||
grow_vertical = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="MinClipSpinBox" type="SpinBox" parent="ClipContainer"]
|
||||
margin_right = 280.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 24.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
@@ -135,9 +124,9 @@ value = -1.0
|
||||
prefix = "Min:"
|
||||
|
||||
[node name="MaxClipSpinBox" type="SpinBox" parent="ClipContainer"]
|
||||
margin_top = 28.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 52.0
|
||||
margin_top = 32.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 56.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
@@ -11,8 +11,12 @@ func explode():
|
||||
return
|
||||
for p in in_area:
|
||||
if p.has_method("exploded"):
|
||||
# Exploded has a master keyword, so it will only be received by the master.
|
||||
p.rpc("exploded", from_player)
|
||||
# Checks if there is wall in between bomb and the object
|
||||
var world_state = get_world_2d().direct_space_state
|
||||
var result = world_state.intersect_ray(position, p.position)
|
||||
if not result.collider is TileMap:
|
||||
# Exploded has a master keyword, so it will only be received by the master.
|
||||
p.rpc("exploded", from_player)
|
||||
|
||||
|
||||
func done():
|
||||
|
||||
@@ -81,6 +81,10 @@ func _on_Host_pressed():
|
||||
|
||||
|
||||
func _on_Disconnect_pressed():
|
||||
if peer is WebSocketServer:
|
||||
peer.stop()
|
||||
elif peer is WebSocketClient:
|
||||
peer.disconnect_from_host()
|
||||
_close_network()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user