mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-12-24 05:37:15 +01:00
Merge pull request #14 from GDQuest/feature/demos-look
Use beginner 2d platformer visual style
This commit is contained in:
commit
0c3929be16
BIN
project/assets/sprites/background.png
Normal file
BIN
project/assets/sprites/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/triangle.png-fa05d9e46946b626c9973edf66af1138.stex"
|
path="res://.import/background.png-dde469fb1f19281f3784b52d4bea96cd.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/sprites/triangle.png"
|
source_file="res://assets/sprites/background.png"
|
||||||
dest_files=[ "res://.import/triangle.png-fa05d9e46946b626c9973edf66af1138.stex" ]
|
dest_files=[ "res://.import/background.png-dde469fb1f19281f3784b52d4bea96cd.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
@ -1,34 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/large_circle.png-31c2e25548cad683b9cdbdea4df32e13.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/sprites/large_circle.png"
|
|
||||||
dest_files=[ "res://.import/large_circle.png-31c2e25548cad683b9cdbdea4df32e13.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
@ -1,34 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture"
|
|
||||||
path="res://.import/small_circle.png-e9ef462acf0465fde3767e7b0877ff44.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://assets/sprites/small_circle.png"
|
|
||||||
dest_files=[ "res://.import/small_circle.png-e9ef462acf0465fde3767e7b0877ff44.stex" ]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=false
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
@ -7,8 +7,8 @@ export(float, 0, 100, 0.1) var arrival_tolerance := 25.0 setget set_arrival_tole
|
|||||||
export(float, 0, 500, 10) var deceleration_radius := 125.0 setget set_deceleration_radius
|
export(float, 0, 500, 10) var deceleration_radius := 125.0 setget set_deceleration_radius
|
||||||
|
|
||||||
const COLORS := {
|
const COLORS := {
|
||||||
deceleration_radius = Color(0.9, 1, 0, 0.1),
|
deceleration_radius = Color(1.0, 0.419, 0.592, 0.5),
|
||||||
arrival_tolerance = Color(0.5, 0.7, 0.9, 0.2)
|
arrival_tolerance = Color(0.278, 0.231, 0.47, 0.3)
|
||||||
}
|
}
|
||||||
|
|
||||||
onready var arriver := $Arriver
|
onready var arriver := $Arriver
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/Arrive/Arriver.gd" type="Script" id=1]
|
[ext_resource path="res://demos/Arrive/Arriver.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=2]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=2]
|
||||||
[ext_resource path="res://demos/Arrive/ArriveDemo.gd" type="Script" id=3]
|
[ext_resource path="res://demos/Arrive/ArriveDemo.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=4]
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=5]
|
||||||
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=6]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
@ -11,6 +12,13 @@ radius = 16.0
|
|||||||
[node name="ArriveDemo" type="Node2D"]
|
[node name="ArriveDemo" type="Node2D"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Arriver" type="KinematicBody2D" parent="."]
|
[node name="Arriver" type="KinematicBody2D" parent="."]
|
||||||
show_behind_parent = true
|
show_behind_parent = true
|
||||||
position = Vector2( 512, 300 )
|
position = Vector2( 512, 300 )
|
||||||
@ -18,10 +26,10 @@ script = ExtResource( 1 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Arriver"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Arriver"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 6 )
|
||||||
[node name="Sprite" type="Sprite" parent="Arriver"]
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
modulate = Color( 0.952941, 0.172549, 0.0431373, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
texture = ExtResource( 4 )
|
stroke = 4.0
|
||||||
|
|
||||||
[node name="GUI" type="PanelContainer" parent="."]
|
[node name="GUI" type="PanelContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -45,7 +53,7 @@ margin_bottom = 71.0
|
|||||||
rect_min_size = Vector2( 0, 55 )
|
rect_min_size = Vector2( 0, 55 )
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
bbcode_text = "Arrive Demo
|
bbcode_text = "Arrive Demo
|
||||||
Mouse click to make the [color=red]red \"Player\"[/color] move to the [color=yellow]yellow target[/color]"
|
Mouse click to make the [color=lime]green \"Player\"[/color] move to the [color=fuchsia]purple target[/color]"
|
||||||
text = "Arrive Demo
|
text = "Arrive Demo
|
||||||
Mouse click to make the red \"Player\" move to the yellow target"
|
Mouse click to make the green \"Player\" move to the purple target"
|
||||||
scroll_active = false
|
scroll_active = false
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/AvoidCollisions/Spawner.gd" type="Script" id=1]
|
[ext_resource path="res://demos/AvoidCollisions/Spawner.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/AvoidCollisions/AvoidCollisionsDemo.gd" type="Script" id=2]
|
[ext_resource path="res://demos/AvoidCollisions/AvoidCollisionsDemo.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://demos/AvoidCollisions/Avoider.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://demos/AvoidCollisions/Avoider.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=4]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=4]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=5]
|
||||||
|
|
||||||
[node name="AvoidCollisionsDemo" type="Node2D"]
|
[node name="AvoidCollisionsDemo" type="Node2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
proximity_radius = 100.0
|
proximity_radius = 100.0
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Spawner" type="Node2D" parent="."]
|
[node name="Spawner" type="Node2D" parent="."]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
avoider_template = ExtResource( 3 )
|
avoider_template = ExtResource( 3 )
|
||||||
normal_color = Color( 0.94902, 0.0588235, 0.0588235, 1 )
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
highlight_color = Color( 0.0901961, 0.929412, 0.929412, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
|
|
||||||
[node name="GUI" type="PanelContainer" parent="."]
|
[node name="GUI" type="PanelContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
|
@ -9,7 +9,8 @@ var _radius: float
|
|||||||
var _accel := GSTTargetAcceleration.new()
|
var _accel := GSTTargetAcceleration.new()
|
||||||
var _velocity := Vector2.ZERO
|
var _velocity := Vector2.ZERO
|
||||||
var _direction := Vector2()
|
var _direction := Vector2()
|
||||||
var _drag: = 0.1
|
var _drag := 0.1
|
||||||
|
var _color := Color(0.4, 1.0, 0.89, 0.3)
|
||||||
|
|
||||||
onready var collision := $CollisionShape2D
|
onready var collision := $CollisionShape2D
|
||||||
onready var agent := GSTSteeringAgent.new()
|
onready var agent := GSTSteeringAgent.new()
|
||||||
@ -18,12 +19,11 @@ onready var avoid := GSTAvoidCollisions.new(agent, proximity)
|
|||||||
onready var target := GSTAgentLocation.new()
|
onready var target := GSTAgentLocation.new()
|
||||||
onready var seek := GSTSeek.new(agent, target)
|
onready var seek := GSTSeek.new(agent, target)
|
||||||
onready var priority := GSTPriority.new(agent, 0.0001)
|
onready var priority := GSTPriority.new(agent, 0.0001)
|
||||||
onready var sprite := $Sprite
|
|
||||||
|
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
if draw_proximity:
|
if draw_proximity:
|
||||||
draw_circle(Vector2.ZERO, proximity.radius, Color(0, 1, 0, 0.1))
|
draw_circle(Vector2.ZERO, proximity.radius, _color)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=1]
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/AvoidCollisions/Avoider.gd" type="Script" id=2]
|
[ext_resource path="res://demos/AvoidCollisions/Avoider.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
@ -11,7 +11,7 @@ script = ExtResource( 2 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
inner_color = Color( 0.890196, 0.411765, 0.337255, 1 )
|
||||||
modulate = Color( 0.94902, 0.211765, 0.0901961, 1 )
|
outer_color = Color( 1, 0.709804, 0.439216, 1 )
|
||||||
texture = ExtResource( 1 )
|
stroke = 4.0
|
||||||
|
@ -2,14 +2,15 @@ extends Node2D
|
|||||||
|
|
||||||
|
|
||||||
export var avoider_template: PackedScene
|
export var avoider_template: PackedScene
|
||||||
export var normal_color := Color()
|
export var inner_color := Color()
|
||||||
export var highlight_color := Color()
|
export var outer_color := Color()
|
||||||
|
|
||||||
var boundaries: Vector2
|
var boundaries: Vector2
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
boundaries = Vector2(ProjectSettings["display/window/size/width"],
|
boundaries = Vector2(
|
||||||
|
ProjectSettings["display/window/size/width"],
|
||||||
ProjectSettings["display/window/size/height"])
|
ProjectSettings["display/window/size/height"])
|
||||||
var rng: = RandomNumberGenerator.new()
|
var rng: = RandomNumberGenerator.new()
|
||||||
var avoiders := []
|
var avoiders := []
|
||||||
@ -28,7 +29,9 @@ func _ready() -> void:
|
|||||||
)
|
)
|
||||||
avoider_agents.append(avoider.agent)
|
avoider_agents.append(avoider.agent)
|
||||||
avoider.set_random_nonoverlapping_position(avoiders, 16)
|
avoider.set_random_nonoverlapping_position(avoiders, 16)
|
||||||
avoider.sprite.modulate = normal_color if i != 0 or not owner.draw_proximity else highlight_color
|
if i == 0:
|
||||||
|
avoider.collision.inner_color = inner_color
|
||||||
|
avoider.collision.outer_color = outer_color
|
||||||
avoiders.append(avoider)
|
avoiders.append(avoider)
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
child.set_proximity_agents(avoider_agents)
|
child.set_proximity_agents(avoider_agents)
|
||||||
@ -58,8 +61,4 @@ func set_proximity_radius(value: float) -> void:
|
|||||||
func set_draw_proximity(value: bool) -> void:
|
func set_draw_proximity(value: bool) -> void:
|
||||||
var child := get_child(0)
|
var child := get_child(0)
|
||||||
child.draw_proximity = value
|
child.draw_proximity = value
|
||||||
if not value:
|
|
||||||
child.sprite.modulate = normal_color
|
|
||||||
else:
|
|
||||||
child.sprite.modulate = highlight_color
|
|
||||||
child.update()
|
child.update()
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
[ext_resource path="res://demos/Face/Turret.gd" type="Script" id=1]
|
[ext_resource path="res://demos/Face/Turret.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/Face/FaceDemo.gd" type="Script" id=2]
|
[ext_resource path="res://demos/Face/FaceDemo.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://demos/Face/Player.gd" type="Script" id=3]
|
[ext_resource path="res://demos/Face/Player.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://assets/sprites/large_circle.png" type="Texture" id=4]
|
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=5]
|
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=6]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=6]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=7]
|
||||||
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=8]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
@ -19,16 +19,23 @@ __meta__ = {
|
|||||||
"_editor_description_": "A demo showing the usage of the Face steering behavior."
|
"_editor_description_": "A demo showing the usage of the Face steering behavior."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 7 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D" parent="."]
|
[node name="Player" type="KinematicBody2D" parent="."]
|
||||||
position = Vector2( 512, 450 )
|
position = Vector2( 512, 450 )
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 8 )
|
||||||
[node name="Sprite" type="Sprite" parent="Player"]
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
modulate = Color( 0.945098, 0.215686, 0.0705882, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
texture = ExtResource( 5 )
|
stroke = 4.0
|
||||||
|
|
||||||
[node name="Turret" type="KinematicBody2D" parent="."]
|
[node name="Turret" type="KinematicBody2D" parent="."]
|
||||||
position = Vector2( 512, 286.288 )
|
position = Vector2( 512, 286.288 )
|
||||||
@ -36,10 +43,10 @@ script = ExtResource( 1 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Turret"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Turret"]
|
||||||
shape = SubResource( 2 )
|
shape = SubResource( 2 )
|
||||||
|
script = ExtResource( 8 )
|
||||||
[node name="Sprite" type="Sprite" parent="Turret"]
|
inner_color = Color( 0.890196, 0.411765, 0.337255, 1 )
|
||||||
modulate = Color( 0.137255, 0.866667, 0.647059, 1 )
|
outer_color = Color( 1, 0.709804, 0.439216, 1 )
|
||||||
texture = ExtResource( 4 )
|
stroke = 8.0
|
||||||
|
|
||||||
[node name="GUI" type="PanelContainer" parent="."]
|
[node name="GUI" type="PanelContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
@ -53,10 +60,14 @@ __meta__ = {
|
|||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 87.0
|
margin_bottom = 87.0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="GUI/MarginContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="GUI/MarginContainer"]
|
||||||
margin_left = 16.0
|
margin_left = 16.0
|
||||||
margin_top = 16.0
|
margin_top = 16.0
|
||||||
margin_right = 1008.0
|
margin_right = 1008.0
|
||||||
margin_bottom = 71.0
|
margin_bottom = 71.0
|
||||||
|
rect_min_size = Vector2( 0, 55 )
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "Face Demo
|
||||||
|
Move the [color=lime]green player[/color] around with WASD and notice the [color=#ffb570]orange turret[/color] orient itself"
|
||||||
text = "Face Demo
|
text = "Face Demo
|
||||||
Move the player around with WASD and notice the turret orient itself"
|
Move the green player around with WASD and notice the orange turret orient itself"
|
||||||
|
@ -7,6 +7,7 @@ var agent := GSTSteeringAgent.new()
|
|||||||
var _accel := GSTTargetAcceleration.new()
|
var _accel := GSTTargetAcceleration.new()
|
||||||
var _angular_drag := 0.1
|
var _angular_drag := 0.1
|
||||||
var _cannon: Rect2
|
var _cannon: Rect2
|
||||||
|
var _color: Color
|
||||||
|
|
||||||
onready var collision_shape := $CollisionShape2D
|
onready var collision_shape := $CollisionShape2D
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ onready var collision_shape := $CollisionShape2D
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var radius = collision_shape.shape.radius
|
var radius = collision_shape.shape.radius
|
||||||
_cannon = Rect2(Vector2(-5, 0), Vector2(10, -radius*2))
|
_cannon = Rect2(Vector2(-5, 0), Vector2(10, -radius*2))
|
||||||
|
_color = collision_shape.outer_color
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
@ -29,7 +31,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
draw_rect(_cannon, Color.cadetblue)
|
draw_rect(_cannon, _color)
|
||||||
|
|
||||||
|
|
||||||
func setup(
|
func setup(
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/FollowPath/Drawer.gd" type="Script" id=1]
|
[ext_resource path="res://demos/FollowPath/Drawer.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=2]
|
|
||||||
[ext_resource path="res://demos/FollowPath/PathFollower.gd" type="Script" id=3]
|
[ext_resource path="res://demos/FollowPath/PathFollower.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://demos/FollowPath/FollowPathDemo.gd" type="Script" id=4]
|
[ext_resource path="res://demos/FollowPath/FollowPathDemo.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
||||||
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=6]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=7]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
@ -12,6 +13,13 @@ radius = 16.0
|
|||||||
[node name="FollowPathDemo" type="Node2D"]
|
[node name="FollowPathDemo" type="Node2D"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 7 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Drawer" type="Node2D" parent="."]
|
[node name="Drawer" type="Node2D" parent="."]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
@ -21,10 +29,10 @@ script = ExtResource( 3 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PathFollower"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="PathFollower"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 6 )
|
||||||
[node name="Sprite" type="Sprite" parent="PathFollower"]
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
modulate = Color( 0.960784, 0.231373, 0.0392157, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
texture = ExtResource( 2 )
|
stroke = 4.0
|
||||||
|
|
||||||
[node name="GUI" type="PanelContainer" parent="."]
|
[node name="GUI" type="PanelContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
@ -46,7 +54,7 @@ margin_bottom = 100.0
|
|||||||
rect_min_size = Vector2( 0, 84 )
|
rect_min_size = Vector2( 0, 84 )
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
bbcode_text = "Follow Path Demo
|
bbcode_text = "Follow Path Demo
|
||||||
Use the mouse to draw a path on screen and watch the [color=red]red \"Agent\"[/color] follow it to the end."
|
Use the mouse to draw a path on screen and watch the [color=lime]green \"Agent\"[/color] follow it to the end."
|
||||||
text = "Follow Path Demo
|
text = "Follow Path Demo
|
||||||
Use the mouse to draw a path on screen and watch the red \"Agent\" follow it to the end."
|
Use the mouse to draw a path on screen and watch the green \"Agent\" follow it to the end."
|
||||||
scroll_active = false
|
scroll_active = false
|
||||||
|
@ -1,15 +1,23 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/GroupBehaviors/Member.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://demos/GroupBehaviors/Member.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://demos/GroupBehaviors/Spawner.gd" type="Script" id=2]
|
[ext_resource path="res://demos/GroupBehaviors/Spawner.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://demos/GroupBehaviors/GroupBehaviorsDemo.gd" type="Script" id=3]
|
[ext_resource path="res://demos/GroupBehaviors/GroupBehaviorsDemo.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=4]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=4]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=5]
|
||||||
|
|
||||||
[node name="GroupBehaviorsDemo" type="Node2D"]
|
[node name="GroupBehaviorsDemo" type="Node2D"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
cohesion_strength = 0.2
|
cohesion_strength = 0.2
|
||||||
separation_strength = 4.5
|
separation_strength = 4.5
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Spawner" type="Node2D" parent="."]
|
[node name="Spawner" type="Node2D" parent="."]
|
||||||
position = Vector2( 512, 300 )
|
position = Vector2( 512, 300 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
@ -35,7 +43,7 @@ margin_bottom = 100.0
|
|||||||
rect_min_size = Vector2( 0, 84 )
|
rect_min_size = Vector2( 0, 84 )
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
bbcode_text = "Group Behavior Demo
|
bbcode_text = "Group Behavior Demo
|
||||||
Each of the \"Agents\" are both attempting to stay separated and within reach of their nearest group's center of mass."
|
Each of the \"Agents\" are both attempting to stay separated from each other but within reach of their nearest group's center of mass."
|
||||||
text = "Group Behavior Demo
|
text = "Group Behavior Demo
|
||||||
Each of the \"Agents\" are both attempting to stay separated and within reach of their nearest group's center of mass."
|
Each of the \"Agents\" are both attempting to stay separated from each other but within reach of their nearest group's center of mass."
|
||||||
scroll_active = false
|
scroll_active = false
|
||||||
|
@ -12,6 +12,8 @@ var draw_proximity := false
|
|||||||
var _color := Color.red
|
var _color := Color.red
|
||||||
var _velocity := Vector2()
|
var _velocity := Vector2()
|
||||||
|
|
||||||
|
onready var collision_shape := $CollisionShape2D
|
||||||
|
|
||||||
|
|
||||||
func setup(
|
func setup(
|
||||||
linear_speed_max: float,
|
linear_speed_max: float,
|
||||||
@ -22,7 +24,7 @@ func setup(
|
|||||||
separation_strength: float
|
separation_strength: float
|
||||||
) -> void:
|
) -> void:
|
||||||
_color = Color(rand_range(0.5, 1), rand_range(0.25, 1), rand_range(0, 1))
|
_color = Color(rand_range(0.5, 1), rand_range(0.25, 1), rand_range(0, 1))
|
||||||
$Sprite.modulate = _color
|
collision_shape.inner_color = _color
|
||||||
|
|
||||||
agent.linear_acceleration_max = linear_accel_max
|
agent.linear_acceleration_max = linear_accel_max
|
||||||
agent.linear_speed_max = linear_speed_max
|
agent.linear_speed_max = linear_speed_max
|
||||||
@ -37,7 +39,7 @@ func setup(
|
|||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
if draw_proximity:
|
if draw_proximity:
|
||||||
draw_circle(Vector2.ZERO, proximity.radius, Color(0, 1, 0, 0.1))
|
draw_circle(Vector2.ZERO, proximity.radius, Color(0.4, 1.0, 0.89, 0.3))
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/GroupBehaviors/Member.gd" type="Script" id=1]
|
[ext_resource path="res://demos/GroupBehaviors/Member.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=2]
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=3]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
@ -11,6 +11,6 @@ script = ExtResource( 1 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 3 )
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
outer_color = Color( 0.301961, 0.65098, 1, 1 )
|
||||||
texture = ExtResource( 2 )
|
stroke = 4.0
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/PursueSeek/Pursuer.gd" type="Script" id=1]
|
[ext_resource path="res://demos/PursueSeek/Pursuer.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/PursueSeek/Player.gd" type="Script" id=2]
|
[ext_resource path="res://demos/PursueSeek/Player.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://demos/PursueSeek/BoundaryManager.gd" type="Script" id=3]
|
[ext_resource path="res://demos/PursueSeek/BoundaryManager.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://demos/PursueSeek/PursueVSSeekDemo.gd" type="Script" id=4]
|
[ext_resource path="res://demos/PursueSeek/PursueVSSeekDemo.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
||||||
[ext_resource path="res://assets/sprites/triangle.png" type="Texture" id=6]
|
[ext_resource path="res://demos/Utils/Line2DDraw.gd" type="Script" id=6]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=7]
|
||||||
|
|
||||||
[node name="PursueVSSeekDemo" type="Node2D"]
|
[node name="PursueVSSeekDemo" type="Node2D"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
@ -16,6 +17,13 @@ linear_speed_max = 240.0
|
|||||||
linear_accel_max = 40.0
|
linear_accel_max = 40.0
|
||||||
predict_time = 1.1
|
predict_time = 1.1
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 7 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="BoundaryManager" type="Node2D" parent="."]
|
[node name="BoundaryManager" type="Node2D" parent="."]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
@ -30,9 +38,14 @@ side_thruster_strength = 20.0
|
|||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Player"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Player"]
|
||||||
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="BoundaryManager/Player"]
|
[node name="Line2D" type="Line2D" parent="BoundaryManager/Player"]
|
||||||
modulate = Color( 0.968627, 0.188235, 0.0352941, 1 )
|
points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 )
|
||||||
texture = ExtResource( 6 )
|
width = 8.0
|
||||||
|
default_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
|
joint_mode = 2
|
||||||
|
antialiased = true
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
|
|
||||||
[node name="Pursuer" type="KinematicBody2D" parent="BoundaryManager"]
|
[node name="Pursuer" type="KinematicBody2D" parent="BoundaryManager"]
|
||||||
position = Vector2( 980, 550 )
|
position = Vector2( 980, 550 )
|
||||||
@ -42,9 +55,14 @@ script = ExtResource( 1 )
|
|||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Pursuer"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Pursuer"]
|
||||||
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="BoundaryManager/Pursuer"]
|
[node name="Line2D" type="Line2D" parent="BoundaryManager/Pursuer"]
|
||||||
modulate = Color( 0.756863, 0.952941, 0.054902, 1 )
|
points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 )
|
||||||
texture = ExtResource( 6 )
|
width = 8.0
|
||||||
|
default_color = Color( 1, 0.709804, 0.439216, 1 )
|
||||||
|
joint_mode = 2
|
||||||
|
antialiased = true
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
inner_color = Color( 0.890196, 0.411765, 0.337255, 1 )
|
||||||
|
|
||||||
[node name="Seeker" type="KinematicBody2D" parent="BoundaryManager"]
|
[node name="Seeker" type="KinematicBody2D" parent="BoundaryManager"]
|
||||||
position = Vector2( 980, 150 )
|
position = Vector2( 980, 150 )
|
||||||
@ -56,9 +74,14 @@ use_seek = true
|
|||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Seeker"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Seeker"]
|
||||||
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="BoundaryManager/Seeker"]
|
[node name="Line2D" type="Line2D" parent="BoundaryManager/Seeker"]
|
||||||
modulate = Color( 0.278431, 0.815686, 0.14902, 1 )
|
points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 )
|
||||||
texture = ExtResource( 6 )
|
width = 8.0
|
||||||
|
default_color = Color( 0.301961, 0.65098, 1, 1 )
|
||||||
|
joint_mode = 2
|
||||||
|
antialiased = true
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
inner_color = Color( 0.294118, 0.356863, 0.670588, 1 )
|
||||||
|
|
||||||
[node name="GUI" type="PanelContainer" parent="."]
|
[node name="GUI" type="PanelContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
@ -80,9 +103,9 @@ margin_bottom = 100.0
|
|||||||
rect_min_size = Vector2( 0, 84 )
|
rect_min_size = Vector2( 0, 84 )
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
bbcode_text = "Pursue vs. Seek Demo
|
bbcode_text = "Pursue vs. Seek Demo
|
||||||
Move the player around with WASD and notice the [color=yellow]yellow Pursuer[/color] and the [color=green]green Seeker[/color] follow
|
Move the player around with WASD and notice the [color=#ffb570]orange Pursuer[/color] and the [color=aqua]blue Seeker[/color] follow
|
||||||
the [color=red]red \"Ship\"[/color] around"
|
the [color=lime]green \"Ship\"[/color] around"
|
||||||
text = "Pursue vs. Seek Demo
|
text = "Pursue vs. Seek Demo
|
||||||
Move the player around with WASD and notice the yellow Pursuer and the green Seeker follow
|
Move the player around with WASD and notice the orange Pursuer and the blue Seeker follow
|
||||||
the red \"Ship\" around"
|
the green \"Ship\" around"
|
||||||
scroll_active = false
|
scroll_active = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=1]
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/Quickstart/Bullet.gd" type="Script" id=2]
|
[ext_resource path="res://demos/Quickstart/Bullet.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
@ -13,11 +13,10 @@ script = ExtResource( 2 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
modulate = Color( 0.141176, 0.188235, 0.901961, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
scale = Vector2( 0.25, 0.25 )
|
stroke = 2.0
|
||||||
texture = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="Lifetime" type="Timer" parent="."]
|
[node name="Lifetime" type="Timer" parent="."]
|
||||||
process_mode = 0
|
process_mode = 0
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/sprites/triangle.png" type="Texture" id=1]
|
[ext_resource path="res://demos/Utils/Line2DDraw.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/Quickstart/Agent.gd" type="Script" id=2]
|
[ext_resource path="res://demos/Quickstart/Agent.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://demos/Quickstart/Player.gd" type="Script" id=3]
|
[ext_resource path="res://demos/Quickstart/Player.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://demos/Quickstart/Bullet.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://demos/Quickstart/Bullet.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=5]
|
||||||
|
|
||||||
[node name="QuickStartDemo" type="Node2D"]
|
[node name="QuickStartDemo" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D" parent="." groups=[
|
[node name="Player" type="KinematicBody2D" parent="." groups=[
|
||||||
"Player",
|
"Player",
|
||||||
]]
|
]]
|
||||||
@ -19,9 +27,14 @@ bullet = ExtResource( 4 )
|
|||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Player"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Player"]
|
||||||
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="Player"]
|
[node name="Line2D" type="Line2D" parent="Player"]
|
||||||
modulate = Color( 0.968627, 0.188235, 0.0352941, 1 )
|
points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 )
|
||||||
texture = ExtResource( 1 )
|
width = 8.0
|
||||||
|
default_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
|
joint_mode = 2
|
||||||
|
antialiased = true
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
|
|
||||||
[node name="Agent" type="KinematicBody2D" parent="."]
|
[node name="Agent" type="KinematicBody2D" parent="."]
|
||||||
position = Vector2( 807.798, 141.773 )
|
position = Vector2( 807.798, 141.773 )
|
||||||
@ -33,8 +46,13 @@ script = ExtResource( 2 )
|
|||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Agent"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Agent"]
|
||||||
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="Agent"]
|
[node name="Line2D" type="Line2D" parent="Agent"]
|
||||||
modulate = Color( 0.478431, 0.87451, 0.0784314, 1 )
|
points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 )
|
||||||
texture = ExtResource( 1 )
|
width = 8.0
|
||||||
|
default_color = Color( 1, 0.709804, 0.439216, 1 )
|
||||||
|
joint_mode = 2
|
||||||
|
antialiased = true
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
inner_color = Color( 0.890196, 0.411765, 0.337255, 1 )
|
||||||
|
|
||||||
[node name="Bullets" type="Node2D" parent="."]
|
[node name="Bullets" type="Node2D" parent="."]
|
||||||
|
@ -2,6 +2,8 @@ extends StaticBody2D
|
|||||||
# Draws the bounding box of the static body wall.
|
# Draws the bounding box of the static body wall.
|
||||||
|
|
||||||
|
|
||||||
|
const COLOR := Color("8fde5d")
|
||||||
|
|
||||||
var rect: Rect2
|
var rect: Rect2
|
||||||
|
|
||||||
|
|
||||||
@ -11,4 +13,4 @@ func _ready() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
draw_rect(rect, Color.yellowgreen)
|
draw_rect(rect, COLOR)
|
||||||
|
@ -16,5 +16,6 @@ func _physics_process(delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _get_movement() -> Vector2:
|
func _get_movement() -> Vector2:
|
||||||
return Vector2( Input.get_action_strength("sf_right") - Input.get_action_strength("sf_left"),
|
return Vector2(
|
||||||
|
Input.get_action_strength("sf_right") - Input.get_action_strength("sf_left"),
|
||||||
Input.get_action_strength("sf_down") - Input.get_action_strength("sf_up"))
|
Input.get_action_strength("sf_down") - Input.get_action_strength("sf_up"))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=11 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/SeekFlee/Boundary.gd" type="Script" id=1]
|
[ext_resource path="res://demos/SeekFlee/Boundary.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://demos/SeekFlee/Player.gd" type="Script" id=2]
|
[ext_resource path="res://demos/SeekFlee/Player.gd" type="Script" id=2]
|
||||||
@ -6,7 +6,8 @@
|
|||||||
[ext_resource path="res://demos/SeekFlee/Spawner.gd" type="Script" id=4]
|
[ext_resource path="res://demos/SeekFlee/Spawner.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
[ext_resource path="res://assets/theme/gdquest.theme" type="Theme" id=5]
|
||||||
[ext_resource path="res://demos/SeekFlee/Seeker.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://demos/SeekFlee/Seeker.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://assets/sprites/large_circle.png" type="Texture" id=7]
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=7]
|
||||||
|
[ext_resource path="res://assets/sprites/background.png" type="Texture" id=8]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 32.0
|
radius = 32.0
|
||||||
@ -23,6 +24,13 @@ __meta__ = {
|
|||||||
"_editor_description_": "A toy demo to demonstrate the usage for the Seek and Flee steering behaviors."
|
"_editor_description_": "A toy demo to demonstrate the usage for the Seek and Flee steering behaviors."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="BackgroudLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = -1
|
||||||
|
|
||||||
|
[node name="Background" type="Sprite" parent="BackgroudLayer"]
|
||||||
|
texture = ExtResource( 8 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
current = true
|
current = true
|
||||||
|
|
||||||
@ -32,10 +40,10 @@ script = ExtResource( 2 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 7 )
|
||||||
[node name="Sprite" type="Sprite" parent="Player"]
|
inner_color = Color( 0.235294, 0.639216, 0.439216, 1 )
|
||||||
modulate = Color( 0.952941, 0.290196, 0.0588235, 1 )
|
outer_color = Color( 0.560784, 0.870588, 0.364706, 1 )
|
||||||
texture = ExtResource( 7 )
|
stroke = 4.0
|
||||||
|
|
||||||
[node name="LeftBoundary" type="StaticBody2D" parent="."]
|
[node name="LeftBoundary" type="StaticBody2D" parent="."]
|
||||||
position = Vector2( -512, 0 )
|
position = Vector2( -512, 0 )
|
||||||
@ -99,6 +107,6 @@ margin_bottom = 100.0
|
|||||||
rect_min_size = Vector2( 0, 84 )
|
rect_min_size = Vector2( 0, 84 )
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
bbcode_text = "Seek & Flee Demo
|
bbcode_text = "Seek & Flee Demo
|
||||||
Move the [color=red]red \"Player\"[/color] around with WASD and notice the [color=blue]blue \"Enemies\"[/color] try to seek to or flee from the player."
|
Move the [color=lime]green \"Player\"[/color] around with WASD and notice the [color=#ffb570]orange \"Enemies\"[/color] try to seek to or flee from the player."
|
||||||
text = "Seek & Flee Demo
|
text = "Seek & Flee Demo
|
||||||
Move the red \"Player\" around with WASD and notice the blue \"Enemies\" try to seek to or flee from the player."
|
Move the green \"Player\" around with WASD and notice the orange \"Enemies\" try to seek to or flee from the player."
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://demos/SeekFlee/Seeker.gd" type="Script" id=1]
|
[ext_resource path="res://demos/SeekFlee/Seeker.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/sprites/small_circle.png" type="Texture" id=2]
|
[ext_resource path="res://demos/Utils/CircleDraw.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 16.0
|
radius = 16.0
|
||||||
@ -13,7 +13,7 @@ script = ExtResource( 1 )
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
inner_color = Color( 0.890196, 0.411765, 0.337255, 1 )
|
||||||
modulate = Color( 0.113725, 0.635294, 0.94902, 1 )
|
outer_color = Color( 1, 0.709804, 0.439216, 1 )
|
||||||
texture = ExtResource( 2 )
|
stroke = 4.0
|
||||||
|
26
project/demos/Utils/CircleDraw.gd
Normal file
26
project/demos/Utils/CircleDraw.gd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
tool
|
||||||
|
extends CollisionShape2D
|
||||||
|
|
||||||
|
export(Color) var inner_color := Color() setget set_inner_color
|
||||||
|
export(Color) var outer_color := Color() setget set_outer_color
|
||||||
|
export(float) var stroke := 0.0 setget set_stroke
|
||||||
|
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
draw_circle(Vector2.ZERO, shape.radius + stroke, outer_color)
|
||||||
|
draw_circle(Vector2.ZERO, shape.radius, inner_color)
|
||||||
|
|
||||||
|
|
||||||
|
func set_inner_color(val: Color) -> void:
|
||||||
|
inner_color = val
|
||||||
|
update()
|
||||||
|
|
||||||
|
|
||||||
|
func set_outer_color(val: Color) -> void:
|
||||||
|
outer_color = val
|
||||||
|
update()
|
||||||
|
|
||||||
|
|
||||||
|
func set_stroke(val: float) -> void:
|
||||||
|
stroke = val
|
||||||
|
update()
|
14
project/demos/Utils/Line2DDraw.gd
Normal file
14
project/demos/Utils/Line2DDraw.gd
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
tool
|
||||||
|
extends Line2D
|
||||||
|
|
||||||
|
|
||||||
|
export(Color) var inner_color := Color() setget set_inner_color
|
||||||
|
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
draw_colored_polygon(points, inner_color)
|
||||||
|
|
||||||
|
|
||||||
|
func set_inner_color(val: Color) -> void:
|
||||||
|
inner_color = val
|
||||||
|
update()
|
@ -161,6 +161,10 @@ _global_script_class_icons={
|
|||||||
config/name="SteeringToolkit"
|
config/name="SteeringToolkit"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/always_on_top=true
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
sf_left={
|
sf_left={
|
||||||
|
Loading…
Reference in New Issue
Block a user