瀏覽代碼

Lots of changes. Big additions are to a new 'arrow' and a 'BladeSaw'

master
Bryan Miller 4 年之前
父節點
當前提交
11c66aad28
共有 22 個檔案被更改,包括 402 行新增16 行删除
  1. +3
    -0
      .import/marm.png-129e7630465431c74aeee9f2cda65caa.md5
  2. 二進制
      .import/marm.png-129e7630465431c74aeee9f2cda65caa.stex
  3. +3
    -0
      .import/nstar.png-279148b53e5add0a2272421ac913ac94.md5
  4. 二進制
      .import/nstar.png-279148b53e5add0a2272421ac913ac94.stex
  5. +2
    -2
      .import/placeholder.png-60c11fd3c8ec00ed7c1bd361096f92dc.md5
  6. 二進制
      .import/placeholder.png-60c11fd3c8ec00ed7c1bd361096f92dc.stex
  7. 二進制
      Data/Graphics/marm.png
  8. +34
    -0
      Data/Graphics/marm.png.import
  9. 二進制
      Data/Graphics/nstar.png
  10. +34
    -0
      Data/Graphics/nstar.png.import
  11. 二進制
      Data/Graphics/placeholder.png
  12. +23
    -0
      Data/Objects/Glowdot.tscn
  13. +4
    -3
      Data/Objects/Liquid.tscn
  14. +96
    -0
      Data/Objects/PulseArrow.tscn
  15. +31
    -9
      Data/Scenes/World.tscn
  16. +47
    -0
      Data/Scripts/BladeSaw.gd
  17. +1
    -1
      Data/Scripts/Controller.gd
  18. +80
    -0
      Data/Scripts/Glowdot.gd
  19. +1
    -0
      Data/Scripts/Liquid.gd
  20. +17
    -0
      Data/Scripts/PulseArrow.gd
  21. +23
    -0
      Data/Shaders/Glowdot.shader
  22. +3
    -1
      project.godot

+ 3
- 0
.import/marm.png-129e7630465431c74aeee9f2cda65caa.md5 查看文件

@@ -0,0 +1,3 @@
source_md5="aa6613a60574ba16e3c57d0d38468fbf"
dest_md5="ef4be6197f867fce1ae832148d814786"


二進制
.import/marm.png-129e7630465431c74aeee9f2cda65caa.stex 查看文件


+ 3
- 0
.import/nstar.png-279148b53e5add0a2272421ac913ac94.md5 查看文件

@@ -0,0 +1,3 @@
source_md5="0965d095ec6dc5f38b478078d7dc2184"
dest_md5="40e931f300ed189e4918619ee139c8d8"


二進制
.import/nstar.png-279148b53e5add0a2272421ac913ac94.stex 查看文件


+ 2
- 2
.import/placeholder.png-60c11fd3c8ec00ed7c1bd361096f92dc.md5 查看文件

@@ -1,3 +1,3 @@
source_md5="01869c3604b99aea38eb6b597f15f8d7"
dest_md5="b07fcc1de681e1e4fc0cc651a43f6d23"
source_md5="4fb5fa659e9c6e1ece480e0b8a6b18d5"
dest_md5="d93bef64b511746d542505099d164ec2"


二進制
.import/placeholder.png-60c11fd3c8ec00ed7c1bd361096f92dc.stex 查看文件


二進制
Data/Graphics/marm.png 查看文件

Before After
Width: 200  |  Height: 74  |  Size: 2.8KB

+ 34
- 0
Data/Graphics/marm.png.import 查看文件

@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/marm.png-129e7630465431c74aeee9f2cda65caa.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Data/Graphics/marm.png"
dest_files=[ "res://.import/marm.png-129e7630465431c74aeee9f2cda65caa.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

二進制
Data/Graphics/nstar.png 查看文件

Before After
Width: 128  |  Height: 128  |  Size: 3.0KB

+ 34
- 0
Data/Graphics/nstar.png.import 查看文件

@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/nstar.png-279148b53e5add0a2272421ac913ac94.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Data/Graphics/nstar.png"
dest_files=[ "res://.import/nstar.png-279148b53e5add0a2272421ac913ac94.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

二進制
Data/Graphics/placeholder.png 查看文件

Before After
Width: 64  |  Height: 64  |  Size: 536B Width: 64  |  Height: 64  |  Size: 1.3KB

+ 23
- 0
Data/Objects/Glowdot.tscn 查看文件

@@ -0,0 +1,23 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Data/Graphics/placeholder.png" type="Texture" id=1]
[ext_resource path="res://Data/Scripts/Glowdot.gd" type="Script" id=2]
[ext_resource path="res://Data/Shaders/Glowdot.shader" type="Shader" id=3]

[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 3 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[node name="Glowdot" type="Sprite"]
material = SubResource( 2 )
texture = ExtResource( 1 )
script = ExtResource( 2 )

[node name="Pulse" type="Tween" parent="."]

[node name="PulseIn" type="Timer" parent="."]

[node name="PulseOut" type="Timer" parent="."]
[connection signal="timeout" from="PulseIn" to="." method="_on_PulseIn_timeout"]
[connection signal="timeout" from="PulseOut" to="." method="_on_PulseOut_timeout"]

+ 4
- 3
Data/Objects/Liquid.tscn 查看文件

@@ -6,10 +6,10 @@

[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 3 )
shader_param/sprite_scale = Vector2( 1, 1 )
shader_param/sprite_scale = Vector2( 2.96, 1 )
shader_param/distortion = 16.265
shader_param/liquid_color_main = Color( 0, 0.0862745, 0.603922, 1 )
shader_param/liquid_color_surface = Color( 0.517647, 0.572549, 1, 1 )
shader_param/liquid_color_main = Color( 0.180908, 0.250748, 0.8125, 1 )
shader_param/liquid_color_surface = Color( 0.576471, 0.760784, 0.996078, 1 )
shader_param/liquid_surface_thickness = 0.12
shader_param/wave_amp = 0.25
shader_param/wave_freq = 1.0
@@ -36,6 +36,7 @@ orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale = 2.0
scale_curve = SubResource( 4 )
color = Color( 0.576471, 0.760784, 0.996078, 1 )

[node name="Liquid" type="Sprite"]
material = SubResource( 1 )

+ 96
- 0
Data/Objects/PulseArrow.tscn 查看文件

@@ -0,0 +1,96 @@
[gd_scene load_steps=9 format=2]

[ext_resource path="res://Data/Scripts/PulseArrow.gd" type="Script" id=1]
[ext_resource path="res://Data/Objects/Glowdot.tscn" type="PackedScene" id=3]

[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;

uniform vec4 primary_color:hint_color = vec4(1.0, 0.8, 0.0, 1.0);
uniform float fade_offset:hint_range(0.0, 0.5) = 0.1;

float ramp(float v, float f_min, float f_max){
float res = (v - f_min) / (f_max - f_min);
return max(0.0, min(res, 1.0));
}

void fragment(){
float mask = length(vec2(0.5, 0.5) - (UV.xy));
float fade = 1.0 - ramp(mask, fade_offset, 0.5);
if (mask > 0.5){
mask = 0.0;
} else {mask = 1.0;}
if (mask == 1.0){
COLOR = vec4(primary_color.rgb, fade);
} else {
COLOR = vec4(primary_color.rgb, mask);
}
}"

[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[sub_resource type="ShaderMaterial" id=3]
shader = SubResource( 1 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[sub_resource type="ShaderMaterial" id=4]
shader = SubResource( 1 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[sub_resource type="ShaderMaterial" id=5]
shader = SubResource( 1 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[sub_resource type="ShaderMaterial" id=6]
shader = SubResource( 1 )
shader_param/primary_color = Color( 1, 0.8, 0, 1 )
shader_param/fade_offset = 0.15

[node name="PulseArrow" type="Node2D"]
script = ExtResource( 1 )

[node name="Dot" parent="." instance=ExtResource( 3 )]
material = SubResource( 2 )
position = Vector2( 0, -0.698334 )
pulse_in_time = 0.5
pulse_out_time = 0.5
pulse_out = 0.75

[node name="Dot21" parent="." instance=ExtResource( 3 )]
material = SubResource( 3 )
position = Vector2( -53.772, 35.6152 )
pulse_in_time = 0.5
pulse_out_time = 0.5
pulse_out = 0.75
pulse_offset = 0.35

[node name="Dot31" parent="." instance=ExtResource( 3 )]
material = SubResource( 4 )
position = Vector2( -110.337, 66.3421 )
pulse_in_time = 0.5
pulse_out_time = 0.5
pulse_out = 0.75
pulse_offset = 0.6

[node name="Dot22" parent="." instance=ExtResource( 3 )]
material = SubResource( 5 )
position = Vector2( 52.3753, 35.6152 )
pulse_in_time = 0.5
pulse_out_time = 0.5
pulse_out = 0.75
pulse_offset = 0.35

[node name="Dot32" parent="." instance=ExtResource( 3 )]
material = SubResource( 6 )
position = Vector2( 106.147, 66.3421 )
pulse_in_time = 0.5
pulse_out_time = 0.5
pulse_out = 0.75
pulse_offset = 0.6

+ 31
- 9
Data/Scenes/World.tscn 查看文件

@@ -1,8 +1,11 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://icon.png" type="Texture" id=1]
[ext_resource path="res://Data/Objects/PulseArrow.tscn" type="PackedScene" id=1]
[ext_resource path="res://Data/Objects/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Data/Objects/Liquid.tscn" type="PackedScene" id=3]
[ext_resource path="res://Data/Graphics/placeholder.png" type="Texture" id=4]
[ext_resource path="res://Data/Scripts/BladeSaw.gd" type="Script" id=5]
[ext_resource path="res://Data/Graphics/nstar.png" type="Texture" id=6]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 32, 32 )
@@ -24,7 +27,7 @@ shape = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="Ground/StaticBody2D"]
self_modulate = Color( 0, 0, 0, 1 )
texture = ExtResource( 1 )
texture = ExtResource( 4 )

[node name="StaticBody2D2" type="StaticBody2D" parent="Ground"]
position = Vector2( 117.555, 225.357 )
@@ -36,7 +39,7 @@ shape = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="Ground/StaticBody2D2"]
self_modulate = Color( 0, 0, 0, 1 )
texture = ExtResource( 1 )
texture = ExtResource( 4 )

[node name="StaticBody2D3" type="StaticBody2D" parent="Ground"]
position = Vector2( 165.809, 209.444 )
@@ -48,7 +51,7 @@ shape = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="Ground/StaticBody2D3"]
self_modulate = Color( 0, 0, 0, 1 )
texture = ExtResource( 1 )
texture = ExtResource( 4 )

[node name="StaticBody2D4" type="StaticBody2D" parent="Ground"]
position = Vector2( 352.586, 167.485 )
@@ -60,7 +63,7 @@ shape = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="Ground/StaticBody2D4"]
self_modulate = Color( 0, 0, 0, 1 )
texture = ExtResource( 1 )
texture = ExtResource( 4 )

[node name="Blue Barrier" type="StaticBody2D" parent="Ground"]
position = Vector2( 258.724, 168.376 )
@@ -73,11 +76,30 @@ collision_mask = 0
shape = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="Ground/Blue Barrier"]
self_modulate = Color( 0, 0.180392, 1, 1 )
texture = ExtResource( 1 )
modulate = Color( 0.380392, 0.54902, 1, 1 )
texture = ExtResource( 4 )

[node name="Liquid" parent="." instance=ExtResource( 3 )]
position = Vector2( 109.92, 197.289 )
scale = Vector2( 2.96, 1 )
liquid_body_color = Color( 0, 0.0901961, 0.815686, 1 )
liquid_body_color = Color( 0.180908, 0.250748, 0.8125, 1 )
liquid_surface_color = Color( 0.576471, 0.760784, 0.996078, 1 )

[node name="PulseArrow" parent="." instance=ExtResource( 1 )]
position = Vector2( 250.511, 119.095 )
scale = Vector2( 0.1, 0.1 )
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 )

[node name="BladeSaw" type="KinematicBody2D" parent="."]
position = Vector2( 252.7, 41.8 )
collision_layer = 2
script = ExtResource( 5 )
degrees_per_second = 180.0
active = false

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BladeSaw"]
position = Vector2( 0.291977, -0.407814 )
polygon = PoolVector2Array( -0.190857, -62.8828, 15.1022, -32.9085, 45.8921, -43.1038, 35.9007, -11.7022, 63.632, 2.77521, 33.6577, 17.4565, 43.2413, 46.2074, 13.4709, 37.2355, 0.0130463, 63.9473, -13.8526, 37.4394, -43.623, 46.6152, -34.0394, 17.8643, -64.0137, 2.5713, -36.0785, -11.4983, -47.0894, -43.3077, -15.4839, -32.9085 )

[node name="Sprite" type="Sprite" parent="BladeSaw"]
texture = ExtResource( 6 )

+ 47
- 0
Data/Scripts/BladeSaw.gd 查看文件

@@ -0,0 +1,47 @@
extends KinematicBody2D

export var degrees_per_second:float = 180.0
export var ease_in:float = 0.2
export var ease_out:float = 0.4
export var active:bool = true setget _set_active

var _easing_in = false
var _easing_out = false
var _easing = 0.0
var _running = false


func _set_active(b):
if active != b:
if active:
_easing_out = true
_easing = ease_out
else:
_easing_in = true
_easing = ease_in
active = b

# Called when the node enters the scene tree for the first time.
func _ready():
set_physics_process(true)
if active and _easing == 0.0:
_running = true

func _physics_process(delta):
if _easing_in or _easing_out:
_easing -= delta
if _easing <= 0.0:
_running = _easing_in
_easing_in = false
_easing_out = false
_easing = 0.0
else:
var adj
if _easing_in:
adj = 1.0 - (_easing / ease_in)
else:
adj = 1.0 - (_easing / ease_out)
rotate(deg2rad(degrees_per_second * adj * delta))
if _running:
rotate(deg2rad(degrees_per_second * delta))


+ 1
- 1
Data/Scripts/Controller.gd 查看文件

@@ -20,7 +20,7 @@ var max_comfort_distance = 10
export var base_tangential_accel = 32 setget _set_base_tangential_accel

# The base force applied when being pushed.
export var base_push_force = 128 setget _set_base_push_force
export var base_push_force = 64 setget _set_base_push_force


# Mood = r: <aggression>, g: <neediness>, b: <contentment>

+ 80
- 0
Data/Scripts/Glowdot.gd 查看文件

@@ -0,0 +1,80 @@
extends Sprite

const TRANS = Tween.TRANS_LINEAR
const EASE = Tween.EASE_IN_OUT

export var pulse_color:Color setget _set_pulse_color, _get_pulse_color
export var pulse_in_time:float = 0.5
export var pulse_out_time:float = 0.5
export var pulse_in:float = 0.1
export var pulse_out:float = 0.9
export var pulse_offset:float = 0.1 setget _set_pulse_offset, _get_pulse_offset

var _running = false


func _camp(v, o_min, o_max):
# Reduces v (clamped to 0 and 1) to the values between o_min and o_max
return o_min + ((o_max - o_min) * clamp(v, 0.0, 1.0))

func _ramp(v, f_min, f_max):
# Expands v, spreading the values between f_min and f_max to be between 0 and 1.
if f_min == f_max:
return f_min
return clamp((v - f_min) / (f_max - f_min), 0.0, 1.0)

func _set_pulse_offset(v):
material.set_shader_param("fade_offset", _camp(v, 0.1, 0.5))

func _get_pulse_offset():
if self.get_name() == "Dot21":
print("PING")
return _ramp(material.get_shader_param("fade_offset"), 0.1, 0.5)

func _set_pulse_color(c):
material.set_shader_param("primary_color", c)

func _get_pulse_color():
return material.get_shader_param("primary_color")

func _ready():
material.set_shader_param("primary_color", pulse_color)

func start():
_running = true
_on_PulseOut_timeout()

func stop():
$PulseOut.stop()
$PulseIn.stop()
_running = false

func _interpolate_to(v, t):
$Pulse.interpolate_property(self, "pulse_offset", self.pulse_offset, v, t, TRANS, EASE)
$Pulse.start()


func _on_PulseIn_timeout():
if _running:
#print(self.get_name(), " Pulse Out Time: ", $PulseOut.wait_time)
$PulseIn.stop()
if _get_pulse_offset() == pulse_in:
$PulseOut.wait_time = pulse_out_time
else:
$PulseOut.wait_time = (1.0 - ((_get_pulse_offset() - pulse_in) / (pulse_out / pulse_in))) * pulse_out_time
_interpolate_to(pulse_out, $PulseOut.wait_time)
$PulseOut.start()


func _on_PulseOut_timeout():
if _running:
#print(self.get_name(), " Pulse In Time: ", $PulseOut.wait_time)
$PulseOut.stop()
if _get_pulse_offset() == pulse_out:
$PulseIn.wait_time = pulse_in_time
else:
# Adjust time due to current offset.
$PulseIn.wait_time = (_get_pulse_offset() - pulse_in) / (pulse_out / pulse_in) * pulse_in_time
_interpolate_to(pulse_in, $PulseIn.wait_time)
$PulseIn.start()

+ 1
- 0
Data/Scripts/Liquid.gd 查看文件

@@ -1,3 +1,4 @@
#tool
extends Sprite

export var liquid_body_color:Color setget _set_liquid_body_color, _get_liquid_body_color

+ 17
- 0
Data/Scripts/PulseArrow.gd 查看文件

@@ -0,0 +1,17 @@
extends Node2D

export var pulse_color:Color = Color(1.0, 0.8, 0.0, 1.0)


func _ready():
$Dot.pulse_color = pulse_color
$Dot.start()
$Dot21.pulse_color = pulse_color
$Dot21.start()
$Dot22.pulse_color = pulse_color
$Dot22.start()
$Dot31.pulse_color = pulse_color
$Dot31.start()
$Dot32.pulse_color = pulse_color
$Dot32.start()


+ 23
- 0
Data/Shaders/Glowdot.shader 查看文件

@@ -0,0 +1,23 @@
shader_type canvas_item;

uniform vec4 primary_color:hint_color = vec4(1.0, 0.8, 0.0, 1.0);
uniform float fade_offset:hint_range(0.0, 0.5) = 0.1;

float ramp(float v, float f_min, float f_max){
float res = (v - f_min) / (f_max - f_min);
return max(0.0, min(res, 1.0));
}

void fragment(){
float mask = length(vec2(0.5, 0.5) - (UV.xy));
float fade = 1.0 - ramp(mask, fade_offset, 0.5);
if (mask > 0.5){
mask = 0.0;
} else {mask = 1.0;}
if (mask == 1.0){
COLOR = vec4(primary_color.rgb, fade);
} else {
COLOR = vec4(primary_color.rgb, mask);
}
}

+ 3
- 1
project.godot 查看文件

@@ -23,7 +23,7 @@ config/icon="res://icon.png"

window/size/width=1366
window/size/height=768
window/stretch/mode="viewport"
window/stretch/mode="2d"
window/stretch/aspect="expand"

[input]
@@ -53,5 +53,7 @@ ButtonB={

[rendering]

quality/intended_usage/framebuffer_allocation=0
quality/intended_usage/framebuffer_allocation.mobile=1
environment/default_clear_color=Color( 0.207843, 0.164706, 0.215686, 1 )
environment/default_environment="res://default_env.tres"

Loading…
取消
儲存