From 4fceb866f73373d91ce031474f9e2e74061725b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20C=2E=20R=C4=83dulescu?= Date: Mon, 3 Feb 2020 18:07:43 +0200 Subject: [PATCH 1/3] Use beginner 2d platformer visual style --- project/assets/sprites/background.png | Bin 0 -> 25173 bytes project/assets/sprites/background.png.import | 34 +++++++++++++++++ project/demos/Arrive/ArriveDemo.gd | 4 +- project/demos/Arrive/ArriveDemo.tscn | 24 ++++++++---- .../AvoidCollisions/AvoidCollisionsDemo.tscn | 14 +++++-- project/demos/AvoidCollisions/Avoider.gd | 6 +-- project/demos/AvoidCollisions/Avoider.tscn | 10 ++--- project/demos/AvoidCollisions/Spawner.gd | 15 ++++---- project/demos/Face/FaceDemo.tscn | 35 ++++++++++++------ project/demos/Face/Turret.gd | 4 +- project/demos/FollowPath/FollowPathDemo.tscn | 24 ++++++++---- .../GroupBehaviors/GroupBehaviorsDemo.tscn | 10 ++++- project/demos/GroupBehaviors/Member.gd | 6 ++- project/demos/GroupBehaviors/Member.tscn | 8 ++-- .../demos/PursueSeek/PursueVSSeekDemo.tscn | 14 +++++-- project/demos/SeekFlee/Boundary.gd | 4 +- project/demos/SeekFlee/Player.gd | 5 ++- project/demos/SeekFlee/SeekFleeDemo.tscn | 15 ++++---- project/demos/SeekFlee/Seeker.tscn | 10 ++--- project/demos/Utils/CircleDraw.gd | 26 +++++++++++++ 20 files changed, 193 insertions(+), 75 deletions(-) create mode 100644 project/assets/sprites/background.png create mode 100644 project/assets/sprites/background.png.import create mode 100644 project/demos/Utils/CircleDraw.gd diff --git a/project/assets/sprites/background.png b/project/assets/sprites/background.png new file mode 100644 index 0000000000000000000000000000000000000000..ad7e8ba7e8da722876971620db68de9dec412643 GIT binary patch literal 25173 zcmeHQ3v?4@+AboC;3B(T4pwZl`?G+`u3ap(XiG+v1usC?MFjzgZly&kgi>l+nwjvg z*D5sYf(tFQQF|!LEmXGD-X`h-S%2C_sBIS8WPo6&B{V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7ZdNr3asU6Jr1DyBSZ+QAoiJfyYM*?k(uye-E-LOU@MzXj0euZZo&Qiox4@+z)WSEwB@OcO~;nq%*gF zlKE9sFy_(2{H7U@^ZhH2kcHuX5uY?eTv3P*79>v4eQ9^CZtqgeS74jbZRlq3>o-=x zrGbqDTbB*3_uo?MVaY>qX&+n>n3V;$?u8p%h_ub5@bqDGTh=7I|D@>2S^MhRohP@i z1{MfDpVps}`e1EK&r>PDN_U~n3GT9qJ3E0*a~9Tp3*54W{fpd!<-LtMw(#E&;#T-w zh~k6A_;!hYxBSweb4RB1epo#x53^XO%g|Zf7c@_Q>~b*oKv0*x(;a%Ns@$&r4uas) zZXf{#rVOT*$W%55=mf5Z`B)ZsMC-k+siyG>veR# zLgRhB_e4Ly(28%i_kz{C7cMn}C+pnee!v8bX?IdvCotsMvZ{t8lNw*{^*P#CW*xEH7ZfhX9$QJ^Pp`@&xghz91P4uxmbnQrW3Q-|l|3n&E1QcI#u6SXjL?}b zPuu|T-|1w*O--fY_*IDAAe5C;16=|^c#FcZM8nfnj5@ACqz|SBUu(AH_b!`LMwMvw z>1bl!fZ?8#9v6r-HH?6vd!Q-xkkcSP=y52dUZw3&F#edt88h~ zEGep6O=ZvqGPaf}?*P)B8?cNYJ2>TCC0*+`ze_SP zv{8&Vx2s-kAjcQ@c3+2FX!j)O;_6+$zR-;}cy726#(PhskTqb<0?TAhZ8I5ZSMLdK zyXF^R^A$sbRkDe#RQ!1FA7snR0z?;^=|y48S1&E_mtKqyjGvhbJu>V1G6Hf=3(|))x;Fmj6=Duz#R`a5f5nmL7Qvh#s zF_1&ug3pRqD8CgvH6hd;RHzvky)Nk4rFt^+ARRxs%%3my>dfx(nEG(A!UX?Z!OP(s zFfdndFoNP(r*B^FWs7gi4om00Bl0SWgXcT7sANn407ihyD_x)aANc%*>MVBr`>(%L U);!7vJysdH?_b literal 0 HcmV?d00001 diff --git a/project/assets/sprites/background.png.import b/project/assets/sprites/background.png.import new file mode 100644 index 0000000..8d1c5f6 --- /dev/null +++ b/project/assets/sprites/background.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background.png-dde469fb1f19281f3784b52d4bea96cd.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/sprites/background.png" +dest_files=[ "res://.import/background.png-dde469fb1f19281f3784b52d4bea96cd.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 diff --git a/project/demos/Arrive/ArriveDemo.gd b/project/demos/Arrive/ArriveDemo.gd index a412870..6a8e86e 100644 --- a/project/demos/Arrive/ArriveDemo.gd +++ b/project/demos/Arrive/ArriveDemo.gd @@ -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 const COLORS := { - deceleration_radius = Color(0.9, 1, 0, 0.1), - arrival_tolerance = Color(0.5, 0.7, 0.9, 0.2) + deceleration_radius = Color(1.0, 0.419, 0.592, 0.5), + arrival_tolerance = Color(0.278, 0.231, 0.47, 0.3) } onready var arriver := $Arriver diff --git a/project/demos/Arrive/ArriveDemo.tscn b/project/demos/Arrive/ArriveDemo.tscn index 948a36f..07cfa90 100644 --- a/project/demos/Arrive/ArriveDemo.tscn +++ b/project/demos/Arrive/ArriveDemo.tscn @@ -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://assets/theme/gdquest.theme" type="Theme" id=2] [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] radius = 16.0 @@ -11,6 +12,13 @@ radius = 16.0 [node name="ArriveDemo" type="Node2D"] 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="."] show_behind_parent = true position = Vector2( 512, 300 ) @@ -18,10 +26,10 @@ script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="Arriver"] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="Arriver"] -modulate = Color( 0.952941, 0.172549, 0.0431373, 1 ) -texture = ExtResource( 4 ) +script = ExtResource( 6 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) +stroke = 4.0 [node name="GUI" type="PanelContainer" parent="."] anchor_right = 1.0 @@ -45,7 +53,7 @@ margin_bottom = 71.0 rect_min_size = Vector2( 0, 55 ) bbcode_enabled = true 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 -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 diff --git a/project/demos/AvoidCollisions/AvoidCollisionsDemo.tscn b/project/demos/AvoidCollisions/AvoidCollisionsDemo.tscn index 1e22796..2525f2d 100644 --- a/project/demos/AvoidCollisions/AvoidCollisionsDemo.tscn +++ b/project/demos/AvoidCollisions/AvoidCollisionsDemo.tscn @@ -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/AvoidCollisionsDemo.gd" type="Script" id=2] [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/sprites/background.png" type="Texture" id=5] [node name="AvoidCollisionsDemo" type="Node2D"] script = ExtResource( 2 ) 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="."] script = ExtResource( 1 ) avoider_template = ExtResource( 3 ) -normal_color = Color( 0.94902, 0.0588235, 0.0588235, 1 ) -highlight_color = Color( 0.0901961, 0.929412, 0.929412, 1 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) [node name="GUI" type="PanelContainer" parent="."] margin_right = 1024.0 diff --git a/project/demos/AvoidCollisions/Avoider.gd b/project/demos/AvoidCollisions/Avoider.gd index de899ad..ad87840 100644 --- a/project/demos/AvoidCollisions/Avoider.gd +++ b/project/demos/AvoidCollisions/Avoider.gd @@ -9,7 +9,8 @@ var _radius: float var _accel := GSTTargetAcceleration.new() var _velocity := Vector2.ZERO 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 agent := GSTSteeringAgent.new() @@ -18,12 +19,11 @@ onready var avoid := GSTAvoidCollisions.new(agent, proximity) onready var target := GSTAgentLocation.new() onready var seek := GSTSeek.new(agent, target) onready var priority := GSTPriority.new(agent, 0.0001) -onready var sprite := $Sprite func _draw() -> void: 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: diff --git a/project/demos/AvoidCollisions/Avoider.tscn b/project/demos/AvoidCollisions/Avoider.tscn index 0e3386f..f550a14 100644 --- a/project/demos/AvoidCollisions/Avoider.tscn +++ b/project/demos/AvoidCollisions/Avoider.tscn @@ -1,6 +1,6 @@ [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] [sub_resource type="CircleShape2D" id=1] @@ -11,7 +11,7 @@ script = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="."] -modulate = Color( 0.94902, 0.211765, 0.0901961, 1 ) -texture = ExtResource( 1 ) +script = ExtResource( 1 ) +inner_color = Color( 0.890196, 0.411765, 0.337255, 1 ) +outer_color = Color( 1, 0.709804, 0.439216, 1 ) +stroke = 4.0 diff --git a/project/demos/AvoidCollisions/Spawner.gd b/project/demos/AvoidCollisions/Spawner.gd index 8960d9f..035be60 100644 --- a/project/demos/AvoidCollisions/Spawner.gd +++ b/project/demos/AvoidCollisions/Spawner.gd @@ -2,14 +2,15 @@ extends Node2D export var avoider_template: PackedScene -export var normal_color := Color() -export var highlight_color := Color() +export var inner_color := Color() +export var outer_color := Color() var boundaries: Vector2 func _ready() -> void: - boundaries = Vector2(ProjectSettings["display/window/size/width"], + boundaries = Vector2( + ProjectSettings["display/window/size/width"], ProjectSettings["display/window/size/height"]) var rng: = RandomNumberGenerator.new() var avoiders := [] @@ -28,7 +29,9 @@ func _ready() -> void: ) avoider_agents.append(avoider.agent) 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) for child in get_children(): child.set_proximity_agents(avoider_agents) @@ -58,8 +61,4 @@ func set_proximity_radius(value: float) -> void: func set_draw_proximity(value: bool) -> void: var child := get_child(0) child.draw_proximity = value - if not value: - child.sprite.modulate = normal_color - else: - child.sprite.modulate = highlight_color child.update() diff --git a/project/demos/Face/FaceDemo.tscn b/project/demos/Face/FaceDemo.tscn index 5108dd5..a7865b6 100644 --- a/project/demos/Face/FaceDemo.tscn +++ b/project/demos/Face/FaceDemo.tscn @@ -3,9 +3,9 @@ [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/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/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] radius = 16.0 @@ -19,16 +19,23 @@ __meta__ = { "_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="."] position = Vector2( 512, 450 ) script = ExtResource( 3 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="Player"] -modulate = Color( 0.945098, 0.215686, 0.0705882, 1 ) -texture = ExtResource( 5 ) +script = ExtResource( 8 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) +stroke = 4.0 [node name="Turret" type="KinematicBody2D" parent="."] position = Vector2( 512, 286.288 ) @@ -36,10 +43,10 @@ script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="Turret"] shape = SubResource( 2 ) - -[node name="Sprite" type="Sprite" parent="Turret"] -modulate = Color( 0.137255, 0.866667, 0.647059, 1 ) -texture = ExtResource( 4 ) +script = ExtResource( 8 ) +inner_color = Color( 0.890196, 0.411765, 0.337255, 1 ) +outer_color = Color( 1, 0.709804, 0.439216, 1 ) +stroke = 8.0 [node name="GUI" type="PanelContainer" parent="."] margin_right = 1024.0 @@ -53,10 +60,14 @@ __meta__ = { margin_right = 1024.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_top = 16.0 margin_right = 1008.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 -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" diff --git a/project/demos/Face/Turret.gd b/project/demos/Face/Turret.gd index d1d03eb..468bf54 100644 --- a/project/demos/Face/Turret.gd +++ b/project/demos/Face/Turret.gd @@ -7,6 +7,7 @@ var agent := GSTSteeringAgent.new() var _accel := GSTTargetAcceleration.new() var _angular_drag := 0.1 var _cannon: Rect2 +var _color: Color onready var collision_shape := $CollisionShape2D @@ -14,6 +15,7 @@ onready var collision_shape := $CollisionShape2D func _ready() -> void: var radius = collision_shape.shape.radius _cannon = Rect2(Vector2(-5, 0), Vector2(10, -radius*2)) + _color = collision_shape.outer_color func _physics_process(delta: float) -> void: @@ -29,7 +31,7 @@ func _physics_process(delta: float) -> void: func _draw() -> void: - draw_rect(_cannon, Color.cadetblue) + draw_rect(_cannon, _color) func setup( diff --git a/project/demos/FollowPath/FollowPathDemo.tscn b/project/demos/FollowPath/FollowPathDemo.tscn index 05b440b..500cd75 100644 --- a/project/demos/FollowPath/FollowPathDemo.tscn +++ b/project/demos/FollowPath/FollowPathDemo.tscn @@ -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://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/FollowPathDemo.gd" type="Script" id=4] [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] radius = 16.0 @@ -12,6 +13,13 @@ radius = 16.0 [node name="FollowPathDemo" type="Node2D"] 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="."] script = ExtResource( 1 ) @@ -21,10 +29,10 @@ script = ExtResource( 3 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="PathFollower"] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="PathFollower"] -modulate = Color( 0.960784, 0.231373, 0.0392157, 1 ) -texture = ExtResource( 2 ) +script = ExtResource( 6 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) +stroke = 4.0 [node name="GUI" type="PanelContainer" parent="."] margin_right = 1024.0 @@ -46,7 +54,7 @@ margin_bottom = 100.0 rect_min_size = Vector2( 0, 84 ) bbcode_enabled = true 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 -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 diff --git a/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn b/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn index fe8461c..9e7cd2d 100644 --- a/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn +++ b/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn @@ -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/Spawner.gd" type="Script" id=2] [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/sprites/background.png" type="Texture" id=5] [node name="GroupBehaviorsDemo" type="Node2D"] script = ExtResource( 3 ) cohesion_strength = 0.2 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="."] position = Vector2( 512, 300 ) script = ExtResource( 2 ) diff --git a/project/demos/GroupBehaviors/Member.gd b/project/demos/GroupBehaviors/Member.gd index 92ebf53..43eca39 100644 --- a/project/demos/GroupBehaviors/Member.gd +++ b/project/demos/GroupBehaviors/Member.gd @@ -12,6 +12,8 @@ var draw_proximity := false var _color := Color.red var _velocity := Vector2() +onready var collision_shape := $CollisionShape2D + func setup( linear_speed_max: float, @@ -22,7 +24,7 @@ func setup( separation_strength: float ) -> void: _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_speed_max = linear_speed_max @@ -37,7 +39,7 @@ func setup( func _draw() -> void: 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: diff --git a/project/demos/GroupBehaviors/Member.tscn b/project/demos/GroupBehaviors/Member.tscn index fbd24df..0baef77 100644 --- a/project/demos/GroupBehaviors/Member.tscn +++ b/project/demos/GroupBehaviors/Member.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [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] radius = 16.0 @@ -11,6 +11,6 @@ script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="."] -texture = ExtResource( 2 ) +script = ExtResource( 3 ) +outer_color = Color( 0.301961, 0.65098, 1, 1 ) +stroke = 4.0 diff --git a/project/demos/PursueSeek/PursueVSSeekDemo.tscn b/project/demos/PursueSeek/PursueVSSeekDemo.tscn index 8f6c051..3086e09 100644 --- a/project/demos/PursueSeek/PursueVSSeekDemo.tscn +++ b/project/demos/PursueSeek/PursueVSSeekDemo.tscn @@ -1,4 +1,4 @@ -[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/Player.gd" type="Script" id=2] @@ -6,6 +6,7 @@ [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/sprites/triangle.png" type="Texture" id=6] +[ext_resource path="res://assets/sprites/background.png" type="Texture" id=7] [node name="PursueVSSeekDemo" type="Node2D"] script = ExtResource( 4 ) @@ -16,6 +17,13 @@ linear_speed_max = 240.0 linear_accel_max = 40.0 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="."] script = ExtResource( 3 ) @@ -43,7 +51,7 @@ script = ExtResource( 1 ) polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) [node name="Sprite" type="Sprite" parent="BoundaryManager/Pursuer"] -modulate = Color( 0.756863, 0.952941, 0.054902, 1 ) +modulate = Color( 1, 0.937255, 0.0235294, 1 ) texture = ExtResource( 6 ) [node name="Seeker" type="KinematicBody2D" parent="BoundaryManager"] @@ -80,7 +88,7 @@ margin_bottom = 100.0 rect_min_size = Vector2( 0, 84 ) bbcode_enabled = true 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=yellow]yellow Pursuer[/color] and the [color=lime]green Seeker[/color] follow the [color=red]red \"Ship\"[/color] around" text = "Pursue vs. Seek Demo Move the player around with WASD and notice the yellow Pursuer and the green Seeker follow diff --git a/project/demos/SeekFlee/Boundary.gd b/project/demos/SeekFlee/Boundary.gd index 37ac21e..c986800 100644 --- a/project/demos/SeekFlee/Boundary.gd +++ b/project/demos/SeekFlee/Boundary.gd @@ -2,6 +2,8 @@ extends StaticBody2D # Draws the bounding box of the static body wall. +const COLOR := Color("8fde5d") + var rect: Rect2 @@ -11,4 +13,4 @@ func _ready() -> void: func _draw() -> void: - draw_rect(rect, Color.yellowgreen) + draw_rect(rect, COLOR) diff --git a/project/demos/SeekFlee/Player.gd b/project/demos/SeekFlee/Player.gd index 85eaa6b..f0de8b7 100644 --- a/project/demos/SeekFlee/Player.gd +++ b/project/demos/SeekFlee/Player.gd @@ -16,5 +16,6 @@ func _physics_process(delta: float) -> void: func _get_movement() -> Vector2: - 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")) + 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")) diff --git a/project/demos/SeekFlee/SeekFleeDemo.tscn b/project/demos/SeekFlee/SeekFleeDemo.tscn index 7e9dab0..0195541 100644 --- a/project/demos/SeekFlee/SeekFleeDemo.tscn +++ b/project/demos/SeekFlee/SeekFleeDemo.tscn @@ -6,7 +6,7 @@ [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://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] [sub_resource type="CircleShape2D" id=1] radius = 32.0 @@ -22,6 +22,7 @@ script = ExtResource( 3 ) __meta__ = { "_editor_description_": "A toy demo to demonstrate the usage for the Seek and Flee steering behaviors." } +behavior_mode = 0 [node name="Camera2D" type="Camera2D" parent="."] current = true @@ -32,10 +33,10 @@ script = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="Player"] -modulate = Color( 0.952941, 0.290196, 0.0588235, 1 ) -texture = ExtResource( 7 ) +script = ExtResource( 7 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) +stroke = 4.0 [node name="LeftBoundary" type="StaticBody2D" parent="."] position = Vector2( -512, 0 ) @@ -99,6 +100,6 @@ margin_bottom = 100.0 rect_min_size = Vector2( 0, 84 ) bbcode_enabled = true 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 -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." diff --git a/project/demos/SeekFlee/Seeker.tscn b/project/demos/SeekFlee/Seeker.tscn index 3ffce34..9452469 100644 --- a/project/demos/SeekFlee/Seeker.tscn +++ b/project/demos/SeekFlee/Seeker.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [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] radius = 16.0 @@ -13,7 +13,7 @@ script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="."] -modulate = Color( 0.113725, 0.635294, 0.94902, 1 ) -texture = ExtResource( 2 ) +script = ExtResource( 2 ) +inner_color = Color( 0.890196, 0.411765, 0.337255, 1 ) +outer_color = Color( 1, 0.709804, 0.439216, 1 ) +stroke = 4.0 diff --git a/project/demos/Utils/CircleDraw.gd b/project/demos/Utils/CircleDraw.gd new file mode 100644 index 0000000..47b51b1 --- /dev/null +++ b/project/demos/Utils/CircleDraw.gd @@ -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() From 3f58cc49214b131d1483c014f99fb4e7eca76aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20C=2E=20R=C4=83dulescu?= Date: Tue, 4 Feb 2020 12:10:07 +0200 Subject: [PATCH 2/3] Finish look and feel of the toy demos Based on the 2D Beginner Project look, these demos now have the colorful GDQuest "theme" to them. This had the effect of removing the circle and triangle/ship sprites as everything is drawn in Godot directly. --- project/assets/sprites/large_circle.png | Bin 2345 -> 0 bytes .../assets/sprites/large_circle.png.import | 34 -------------- project/assets/sprites/small_circle.png | Bin 1918 -> 0 bytes .../assets/sprites/small_circle.png.import | 34 -------------- project/assets/sprites/triangle.png | Bin 2752 -> 0 bytes project/assets/sprites/triangle.png.import | 34 -------------- .../demos/PursueSeek/PursueVSSeekDemo.tscn | 43 ++++++++++++------ project/demos/Quickstart/Bullet.tscn | 11 ++--- project/demos/Quickstart/QuickStartDemo.tscn | 34 ++++++++++---- project/demos/Utils/Line2DDraw.gd | 14 ++++++ 10 files changed, 74 insertions(+), 130 deletions(-) delete mode 100644 project/assets/sprites/large_circle.png delete mode 100644 project/assets/sprites/large_circle.png.import delete mode 100644 project/assets/sprites/small_circle.png delete mode 100644 project/assets/sprites/small_circle.png.import delete mode 100644 project/assets/sprites/triangle.png delete mode 100644 project/assets/sprites/triangle.png.import create mode 100644 project/demos/Utils/Line2DDraw.gd diff --git a/project/assets/sprites/large_circle.png b/project/assets/sprites/large_circle.png deleted file mode 100644 index e69cc1136fbcf0d2212cc72a7c558f88d58869d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2345 zcmcImc~BEq9A2;pf~hEq$I!a2bwp*^BO%FdjRcYis6oMamA2E(?gkc;Y?|GefZ74H zWxPh~RTYoXqLreI)@oa2T0B~Bt%Z8@K&w=%9XzX2wYF~|q)w+=|LM-W-M9O`_x--# zvA=n<$7N@zqWeWd5Twe=H0Oe+Q5jL4!Tm$w%_i{Z;>nyMK~PMbGQyyhtNK7t#9qNR zS)ObiL$jhQnc+k`pB!*`02+dZrv^L>Tg1z-ozEBC2ITtgFA!MZ49KJuD{l3e_yQrb z#LJH_$+od2MJ&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Y(L>`cp^Sq=l}8e%;?L{-I%^BJb&^2jiJqvccxw}Ut3lnP3H{!9{sv_rl|ObUAYCj zw9nrD!Wi7J??T&qPc`iQcGt#*V?P&lZVU7sy2F>wHh60yjd%ai Ri`~{2GEiIZo7lFy|8LTpfx-X) diff --git a/project/assets/sprites/small_circle.png.import b/project/assets/sprites/small_circle.png.import deleted file mode 100644 index 560c875..0000000 --- a/project/assets/sprites/small_circle.png.import +++ /dev/null @@ -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 diff --git a/project/assets/sprites/triangle.png b/project/assets/sprites/triangle.png deleted file mode 100644 index 5d8b0262cfc7bf42ed1968428fc5c3000aafd7a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2752 zcmcImdsGuw9=<_DAXN1C;z}8USNY zYvYqFN%94llG1Z=f>My&Y`u|20}wJN+lVXENeiSP)mnp;-S@XfHl!t_>_nj)ksBjO zjW#ORL@v%<7_ZDtS4s%>oY_!FHbxWZNed2T>vaY*mMvuu@?!Mdxec?SL5L+?$_{fH zgp%a3Py}TnAt6`9QKAAKB$jYd5hCFUf*>A(ieW?yqkIm6Vu%RiOQ7M4OaosG%&BSwsDX zAEU2Fy)j}DCK9($rg)0djU*~|gawL-fC3Y>27<~m&vfb;hLbYfLQ2^@gon`C;-LI^ zREVJnCZL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L+&lY~vpknx|{pL*U zjt{*Z&ng>tzc+Xs5?b{KpC@^ndW&w}3aRB!+XrT?Sv|AwP-l)KxC6T<-@GER0&Kg} yjr|aIJAVJZD;GX?a7q(qBh~32g{Z;HL!VJ+3!-9cik~_EF{2|F%BsTC^8W)CH42FU diff --git a/project/assets/sprites/triangle.png.import b/project/assets/sprites/triangle.png.import deleted file mode 100644 index e63a133..0000000 --- a/project/assets/sprites/triangle.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/triangle.png-fa05d9e46946b626c9973edf66af1138.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/sprites/triangle.png" -dest_files=[ "res://.import/triangle.png-fa05d9e46946b626c9973edf66af1138.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 diff --git a/project/demos/PursueSeek/PursueVSSeekDemo.tscn b/project/demos/PursueSeek/PursueVSSeekDemo.tscn index 3086e09..a8049bd 100644 --- a/project/demos/PursueSeek/PursueVSSeekDemo.tscn +++ b/project/demos/PursueSeek/PursueVSSeekDemo.tscn @@ -5,7 +5,7 @@ [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://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"] @@ -38,9 +38,14 @@ side_thruster_strength = 20.0 [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Player"] polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) -[node name="Sprite" type="Sprite" parent="BoundaryManager/Player"] -modulate = Color( 0.968627, 0.188235, 0.0352941, 1 ) -texture = ExtResource( 6 ) +[node name="Line2D" type="Line2D" parent="BoundaryManager/Player"] +points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 ) +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"] position = Vector2( 980, 550 ) @@ -50,9 +55,14 @@ script = ExtResource( 1 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Pursuer"] polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) -[node name="Sprite" type="Sprite" parent="BoundaryManager/Pursuer"] -modulate = Color( 1, 0.937255, 0.0235294, 1 ) -texture = ExtResource( 6 ) +[node name="Line2D" type="Line2D" parent="BoundaryManager/Pursuer"] +points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 ) +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"] position = Vector2( 980, 150 ) @@ -64,9 +74,14 @@ use_seek = true [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BoundaryManager/Seeker"] polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) -[node name="Sprite" type="Sprite" parent="BoundaryManager/Seeker"] -modulate = Color( 0.278431, 0.815686, 0.14902, 1 ) -texture = ExtResource( 6 ) +[node name="Line2D" type="Line2D" parent="BoundaryManager/Seeker"] +points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 ) +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="."] margin_right = 1024.0 @@ -88,9 +103,9 @@ margin_bottom = 100.0 rect_min_size = Vector2( 0, 84 ) bbcode_enabled = true bbcode_text = "Pursue vs. Seek Demo -Move the player around with WASD and notice the [color=yellow]yellow Pursuer[/color] and the [color=lime]green Seeker[/color] follow -the [color=red]red \"Ship\"[/color] around" +Move the player around with WASD and notice the [color=#ffb570]orange Pursuer[/color] and the [color=aqua]blue Seeker[/color] follow +the [color=lime]green \"Ship\"[/color] around" text = "Pursue vs. Seek Demo -Move the player around with WASD and notice the yellow Pursuer and the green Seeker follow -the red \"Ship\" around" +Move the player around with WASD and notice the orange Pursuer and the blue Seeker follow +the green \"Ship\" around" scroll_active = false diff --git a/project/demos/Quickstart/Bullet.tscn b/project/demos/Quickstart/Bullet.tscn index d3b4a89..7f6d9b4 100644 --- a/project/demos/Quickstart/Bullet.tscn +++ b/project/demos/Quickstart/Bullet.tscn @@ -1,6 +1,6 @@ [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] [sub_resource type="CircleShape2D" id=1] @@ -13,11 +13,10 @@ script = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="."] -modulate = Color( 0.141176, 0.188235, 0.901961, 1 ) -scale = Vector2( 0.25, 0.25 ) -texture = ExtResource( 1 ) +script = ExtResource( 1 ) +inner_color = Color( 0.235294, 0.639216, 0.439216, 1 ) +outer_color = Color( 0.560784, 0.870588, 0.364706, 1 ) +stroke = 2.0 [node name="Lifetime" type="Timer" parent="."] process_mode = 0 diff --git a/project/demos/Quickstart/QuickStartDemo.tscn b/project/demos/Quickstart/QuickStartDemo.tscn index 13f70bf..86a73a5 100644 --- a/project/demos/Quickstart/QuickStartDemo.tscn +++ b/project/demos/Quickstart/QuickStartDemo.tscn @@ -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/Player.gd" type="Script" id=3] [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="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=[ "Player", ]] @@ -19,9 +27,14 @@ bullet = ExtResource( 4 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Player"] polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) -[node name="Sprite" type="Sprite" parent="Player"] -modulate = Color( 0.968627, 0.188235, 0.0352941, 1 ) -texture = ExtResource( 1 ) +[node name="Line2D" type="Line2D" parent="Player"] +points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 ) +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="."] position = Vector2( 807.798, 141.773 ) @@ -33,8 +46,13 @@ script = ExtResource( 2 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Agent"] polygon = PoolVector2Array( 0, -32, -24, 32, 24, 32 ) -[node name="Sprite" type="Sprite" parent="Agent"] -modulate = Color( 0.478431, 0.87451, 0.0784314, 1 ) -texture = ExtResource( 1 ) +[node name="Line2D" type="Line2D" parent="Agent"] +points = PoolVector2Array( 0, 32, 24, 32, 0, -32, -24, 32, 0, 32 ) +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="."] diff --git a/project/demos/Utils/Line2DDraw.gd b/project/demos/Utils/Line2DDraw.gd new file mode 100644 index 0000000..4dcc666 --- /dev/null +++ b/project/demos/Utils/Line2DDraw.gd @@ -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() From 52ca9ade747da1481e78fac39ad222a01e04280d Mon Sep 17 00:00:00 2001 From: Francois Belair Date: Tue, 4 Feb 2020 12:35:46 -0500 Subject: [PATCH 3/3] Make window always on top, add missing background --- project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn | 4 ++-- project/demos/SeekFlee/SeekFleeDemo.tscn | 11 +++++++++-- project/project.godot | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn b/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn index 9e7cd2d..806f484 100644 --- a/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn +++ b/project/demos/GroupBehaviors/GroupBehaviorsDemo.tscn @@ -43,7 +43,7 @@ margin_bottom = 100.0 rect_min_size = Vector2( 0, 84 ) bbcode_enabled = true 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 -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 diff --git a/project/demos/SeekFlee/SeekFleeDemo.tscn b/project/demos/SeekFlee/SeekFleeDemo.tscn index 0195541..6cfe436 100644 --- a/project/demos/SeekFlee/SeekFleeDemo.tscn +++ b/project/demos/SeekFlee/SeekFleeDemo.tscn @@ -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/Player.gd" type="Script" id=2] @@ -7,6 +7,7 @@ [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/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] radius = 32.0 @@ -22,7 +23,13 @@ script = ExtResource( 3 ) __meta__ = { "_editor_description_": "A toy demo to demonstrate the usage for the Seek and Flee steering behaviors." } -behavior_mode = 0 + +[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="."] current = true diff --git a/project/project.godot b/project/project.godot index dfc6310..d615c5b 100644 --- a/project/project.godot +++ b/project/project.godot @@ -161,6 +161,10 @@ _global_script_class_icons={ config/name="SteeringToolkit" config/icon="res://icon.png" +[display] + +window/size/always_on_top=true + [input] sf_left={