diff options
Diffstat (limited to 'demos/2d/isometric_light')
24 files changed, 1670 insertions, 2 deletions
diff --git a/demos/2d/isometric_light/character_shader.tres b/demos/2d/isometric_light/character_shader.tres new file mode 100644 index 0000000000..8737e52e33 --- /dev/null +++ b/demos/2d/isometric_light/character_shader.tres @@ -0,0 +1,12 @@ +[gd_resource type="CanvasItemMaterial" load_steps=2 format=1] + +[sub_resource type="CanvasItemShader" id=1] + +_code = { "fragment":"//there is no albedo (all shading is normal)\nuniform color col;\nCOLOR=col;\n//sample normal texture\nvec4 ntex = tex(TEXTURE,UV);\n//take the alpha from the normal texture\nCOLOR.a=ntex.a;\n//adjust normalmap from [0..1] to [-1..1]\nntex.rgb = ntex.rgb * vec3(-2,-2,1) - vec3(-1,-1,0);\n//half size of the tile \nvec2 tile_vec=vec2(47,22);\n//rotation to convert the normal to pseudo 3d coordinates\n//this could be optimized\nfloat r = asin(tile_vec.y / tile_vec.x);\nmat3 rot_mat = mat3( vec3(1,0,0), vec3(0,cos(r),-sin(r)), vec3(0,sin(r),cos(r)));\n\n//pass the normal\nNORMAL = rot_mat * ntex.rgb;\n\n\n\n\n", "fragment_ofs":0, "light":"//apply the normal as simple diffuse (same as default code)\nvec3 light_normal = normalize(vec3(LIGHT_VEC,-LIGHT_HEIGHT));\nLIGHT=LIGHT_COLOR*COLOR*max(dot(-light_normal,NORMAL),0.0);\n//substract light position to be always aligned to the bottom of the sprite\n//this makes lighting on it look like a billboard\nLIGHT_VEC.y-=VAR1.y;\n", "light_ofs":0, "vertex":"// pass the local sprite coordinates through a varying\n// the red cross in the sprite is the 0,0\nVAR1.xy=SRC_VERTEX;", "vertex_ofs":0 } + +[resource] + +shader/shader = SubResource( 1 ) +shader/shading_mode = 0 +shader_param/col = Color( 1, 0.836638, 0.693806, 1 ) + diff --git a/demos/2d/isometric_light/character_shder.res b/demos/2d/isometric_light/character_shder.res Binary files differdeleted file mode 100644 index 17cd9ad287..0000000000 --- a/demos/2d/isometric_light/character_shder.res +++ /dev/null diff --git a/demos/2d/isometric_light/column.scn b/demos/2d/isometric_light/column.scn Binary files differdeleted file mode 100644 index 03f3c2c976..0000000000 --- a/demos/2d/isometric_light/column.scn +++ /dev/null diff --git a/demos/2d/isometric_light/column.tscn b/demos/2d/isometric_light/column.tscn new file mode 100644 index 0000000000..6693e39b85 --- /dev/null +++ b/demos/2d/isometric_light/column.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=5 format=1] + +[ext_resource path="res://wall_shader.tres" type="CanvasItemMaterial" id=1] +[ext_resource path="res://faceColor.png" type="Texture" id=2] + +[sub_resource type="CircleShape2D" id=1] + +custom_solver_bias = 0.0 +radius = 20.0 + +[sub_resource type="OccluderPolygon2D" id=2] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -16.1183, 62.9508, 4.32091, 74.9223, 23.3002, 65.2867 ) + +[node name="column" type="StaticBody2D"] + +input/pickable = false +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 1.36365, 7.83751 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="Sprite" type="Sprite" parent="."] + +material/material = ExtResource( 1 ) +transform/pos = Vector2( 0.487671, 0.487679 ) +texture = ExtResource( 2 ) +offset = Vector2( -4.37984, -50.8523 ) +region = true +region_rect = Rect2( 569, 179, 48, 154 ) + +[node name="occluder" type="LightOccluder2D" parent="."] + +transform/pos = Vector2( -3.90138, -50.97 ) +occluder = SubResource( 2 ) +light_mask = 1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] + +transform/pos = Vector2( 1.36365, 7.83751 ) +shape = SubResource( 1 ) +trigger = false +_update_shape_index = -1 + + diff --git a/demos/2d/isometric_light/cubio.gd b/demos/2d/isometric_light/cubio.gd index 508cd3728c..a26d5ae6fb 100644 --- a/demos/2d/isometric_light/cubio.gd +++ b/demos/2d/isometric_light/cubio.gd @@ -19,7 +19,7 @@ func _input(event): if (event.type == InputEvent.MOUSE_BUTTON and event.button_index == 1 and event.pressed and shoot_countdown <= 0): var pos = get_canvas_transform().affine_inverse()*event.pos var dir = (pos - get_global_pos()).normalized() - var bullet = preload("res://shoot.scn").instance() + var bullet = preload("res://shoot.tscn").instance() bullet.advance_dir = dir bullet.set_pos(get_global_pos() + dir*60) get_parent().add_child(bullet) diff --git a/demos/2d/isometric_light/cubio.scn b/demos/2d/isometric_light/cubio.scn Binary files differdeleted file mode 100644 index 55e2185247..0000000000 --- a/demos/2d/isometric_light/cubio.scn +++ /dev/null diff --git a/demos/2d/isometric_light/cubio.tscn b/demos/2d/isometric_light/cubio.tscn new file mode 100644 index 0000000000..164f4d3549 --- /dev/null +++ b/demos/2d/isometric_light/cubio.tscn @@ -0,0 +1,327 @@ +[gd_scene load_steps=173 format=1] + +[ext_resource path="res://cubio.gd" type="Script" id=1] +[ext_resource path="res://character_shader.tres" type="CanvasItemMaterial" id=2] +[ext_resource path="res://cubio/idle0001.png" type="Texture" id=3] +[ext_resource path="res://cubio/idle0002.png" type="Texture" id=4] +[ext_resource path="res://cubio/idle0003.png" type="Texture" id=5] +[ext_resource path="res://cubio/idle0004.png" type="Texture" id=6] +[ext_resource path="res://cubio/idle0005.png" type="Texture" id=7] +[ext_resource path="res://cubio/idle0006.png" type="Texture" id=8] +[ext_resource path="res://cubio/idle0007.png" type="Texture" id=9] +[ext_resource path="res://cubio/idle0008.png" type="Texture" id=10] +[ext_resource path="res://cubio/idle0009.png" type="Texture" id=11] +[ext_resource path="res://cubio/idle0010.png" type="Texture" id=12] +[ext_resource path="res://cubio/idle0011.png" type="Texture" id=13] +[ext_resource path="res://cubio/idle0012.png" type="Texture" id=14] +[ext_resource path="res://cubio/idle0013.png" type="Texture" id=15] +[ext_resource path="res://cubio/idle0014.png" type="Texture" id=16] +[ext_resource path="res://cubio/idle0015.png" type="Texture" id=17] +[ext_resource path="res://cubio/idle0016.png" type="Texture" id=18] +[ext_resource path="res://cubio/idle0017.png" type="Texture" id=19] +[ext_resource path="res://cubio/idle0018.png" type="Texture" id=20] +[ext_resource path="res://cubio/idle0019.png" type="Texture" id=21] +[ext_resource path="res://cubio/idle0020.png" type="Texture" id=22] +[ext_resource path="res://cubio/idle0021.png" type="Texture" id=23] +[ext_resource path="res://cubio/idle0022.png" type="Texture" id=24] +[ext_resource path="res://cubio/idle0023.png" type="Texture" id=25] +[ext_resource path="res://cubio/idle0024.png" type="Texture" id=26] +[ext_resource path="res://cubio/idle0025.png" type="Texture" id=27] +[ext_resource path="res://cubio/idle0026.png" type="Texture" id=28] +[ext_resource path="res://cubio/idle0027.png" type="Texture" id=29] +[ext_resource path="res://cubio/idle0028.png" type="Texture" id=30] +[ext_resource path="res://cubio/idle0029.png" type="Texture" id=31] +[ext_resource path="res://cubio/idle0030.png" type="Texture" id=32] +[ext_resource path="res://cubio/idle0031.png" type="Texture" id=33] +[ext_resource path="res://cubio/idle0032.png" type="Texture" id=34] +[ext_resource path="res://cubio/idle0033.png" type="Texture" id=35] +[ext_resource path="res://cubio/idle0034.png" type="Texture" id=36] +[ext_resource path="res://cubio/idle0035.png" type="Texture" id=37] +[ext_resource path="res://cubio/idle0036.png" type="Texture" id=38] +[ext_resource path="res://cubio/idle0037.png" type="Texture" id=39] +[ext_resource path="res://cubio/idle0038.png" type="Texture" id=40] +[ext_resource path="res://cubio/idle0039.png" type="Texture" id=41] +[ext_resource path="res://cubio/idle0040.png" type="Texture" id=42] +[ext_resource path="res://cubio/idle0041.png" type="Texture" id=43] +[ext_resource path="res://cubio/idle0042.png" type="Texture" id=44] +[ext_resource path="res://cubio/idle0043.png" type="Texture" id=45] +[ext_resource path="res://cubio/idle0044.png" type="Texture" id=46] +[ext_resource path="res://cubio/idle0045.png" type="Texture" id=47] +[ext_resource path="res://cubio/idle0046.png" type="Texture" id=48] +[ext_resource path="res://cubio/idle0047.png" type="Texture" id=49] +[ext_resource path="res://cubio/idle0048.png" type="Texture" id=50] +[ext_resource path="res://cubio/idle0049.png" type="Texture" id=51] +[ext_resource path="res://cubio/idle0050.png" type="Texture" id=52] +[ext_resource path="res://cubio/idle0051.png" type="Texture" id=53] +[ext_resource path="res://cubio/idle0052.png" type="Texture" id=54] +[ext_resource path="res://cubio/idle0053.png" type="Texture" id=55] +[ext_resource path="res://cubio/idle0054.png" type="Texture" id=56] +[ext_resource path="res://cubio/idle0055.png" type="Texture" id=57] +[ext_resource path="res://cubio/idle0056.png" type="Texture" id=58] +[ext_resource path="res://cubio/idle0057.png" type="Texture" id=59] +[ext_resource path="res://cubio/idle0058.png" type="Texture" id=60] +[ext_resource path="res://cubio/idle0059.png" type="Texture" id=61] +[ext_resource path="res://cubio/idle0060.png" type="Texture" id=62] +[ext_resource path="res://cubio/norm-b-0001.png" type="Texture" id=63] +[ext_resource path="res://cubio/norm-b-0002.png" type="Texture" id=64] +[ext_resource path="res://cubio/norm-b-0003.png" type="Texture" id=65] +[ext_resource path="res://cubio/norm-b-0004.png" type="Texture" id=66] +[ext_resource path="res://cubio/norm-b-0005.png" type="Texture" id=67] +[ext_resource path="res://cubio/norm-b-0006.png" type="Texture" id=68] +[ext_resource path="res://cubio/norm-b-0007.png" type="Texture" id=69] +[ext_resource path="res://cubio/norm-b-0008.png" type="Texture" id=70] +[ext_resource path="res://cubio/norm-b-0009.png" type="Texture" id=71] +[ext_resource path="res://cubio/norm-b-0010.png" type="Texture" id=72] +[ext_resource path="res://cubio/norm-b-0011.png" type="Texture" id=73] +[ext_resource path="res://cubio/norm-b-0012.png" type="Texture" id=74] +[ext_resource path="res://cubio/norm-b-0013.png" type="Texture" id=75] +[ext_resource path="res://cubio/norm-b-0014.png" type="Texture" id=76] +[ext_resource path="res://cubio/norm-b-0015.png" type="Texture" id=77] +[ext_resource path="res://cubio/norm-b-0016.png" type="Texture" id=78] +[ext_resource path="res://cubio/norm-b-0017.png" type="Texture" id=79] +[ext_resource path="res://cubio/norm-b-0018.png" type="Texture" id=80] +[ext_resource path="res://cubio/norm-b-0019.png" type="Texture" id=81] +[ext_resource path="res://cubio/norm-b-0020.png" type="Texture" id=82] +[ext_resource path="res://cubio/norm-bl-0001.png" type="Texture" id=83] +[ext_resource path="res://cubio/norm-bl-0002.png" type="Texture" id=84] +[ext_resource path="res://cubio/norm-bl-0003.png" type="Texture" id=85] +[ext_resource path="res://cubio/norm-bl-0004.png" type="Texture" id=86] +[ext_resource path="res://cubio/norm-bl-0005.png" type="Texture" id=87] +[ext_resource path="res://cubio/norm-bl-0006.png" type="Texture" id=88] +[ext_resource path="res://cubio/norm-bl-0007.png" type="Texture" id=89] +[ext_resource path="res://cubio/norm-bl-0008.png" type="Texture" id=90] +[ext_resource path="res://cubio/norm-bl-0009.png" type="Texture" id=91] +[ext_resource path="res://cubio/norm-bl-0010.png" type="Texture" id=92] +[ext_resource path="res://cubio/norm-bl-0011.png" type="Texture" id=93] +[ext_resource path="res://cubio/norm-bl-0012.png" type="Texture" id=94] +[ext_resource path="res://cubio/norm-bl-0013.png" type="Texture" id=95] +[ext_resource path="res://cubio/norm-bl-0014.png" type="Texture" id=96] +[ext_resource path="res://cubio/norm-bl-0015.png" type="Texture" id=97] +[ext_resource path="res://cubio/norm-bl-0016.png" type="Texture" id=98] +[ext_resource path="res://cubio/norm-bl-0017.png" type="Texture" id=99] +[ext_resource path="res://cubio/norm-bl-0018.png" type="Texture" id=100] +[ext_resource path="res://cubio/norm-bl-0019.png" type="Texture" id=101] +[ext_resource path="res://cubio/norm-bl-0020.png" type="Texture" id=102] +[ext_resource path="res://cubio/norm-l-0001.png" type="Texture" id=103] +[ext_resource path="res://cubio/norm-l-0002.png" type="Texture" id=104] +[ext_resource path="res://cubio/norm-l-0003.png" type="Texture" id=105] +[ext_resource path="res://cubio/norm-l-0004.png" type="Texture" id=106] +[ext_resource path="res://cubio/norm-l-0005.png" type="Texture" id=107] +[ext_resource path="res://cubio/norm-l-0006.png" type="Texture" id=108] +[ext_resource path="res://cubio/norm-l-0007.png" type="Texture" id=109] +[ext_resource path="res://cubio/norm-l-0008.png" type="Texture" id=110] +[ext_resource path="res://cubio/norm-l-0009.png" type="Texture" id=111] +[ext_resource path="res://cubio/norm-l-0010.png" type="Texture" id=112] +[ext_resource path="res://cubio/norm-l-0011.png" type="Texture" id=113] +[ext_resource path="res://cubio/norm-l-0012.png" type="Texture" id=114] +[ext_resource path="res://cubio/norm-l-0013.png" type="Texture" id=115] +[ext_resource path="res://cubio/norm-l-0014.png" type="Texture" id=116] +[ext_resource path="res://cubio/norm-l-0015.png" type="Texture" id=117] +[ext_resource path="res://cubio/norm-l-0016.png" type="Texture" id=118] +[ext_resource path="res://cubio/norm-l-0017.png" type="Texture" id=119] +[ext_resource path="res://cubio/norm-l-0018.png" type="Texture" id=120] +[ext_resource path="res://cubio/norm-l-0019.png" type="Texture" id=121] +[ext_resource path="res://cubio/norm-l-0020.png" type="Texture" id=122] +[ext_resource path="res://cubio/norm-u-0001.png" type="Texture" id=123] +[ext_resource path="res://cubio/norm-u-0002.png" type="Texture" id=124] +[ext_resource path="res://cubio/norm-u-0003.png" type="Texture" id=125] +[ext_resource path="res://cubio/norm-u-0004.png" type="Texture" id=126] +[ext_resource path="res://cubio/norm-u-0005.png" type="Texture" id=127] +[ext_resource path="res://cubio/norm-u-0006.png" type="Texture" id=128] +[ext_resource path="res://cubio/norm-u-0007.png" type="Texture" id=129] +[ext_resource path="res://cubio/norm-u-0008.png" type="Texture" id=130] +[ext_resource path="res://cubio/norm-u-0009.png" type="Texture" id=131] +[ext_resource path="res://cubio/norm-u-0010.png" type="Texture" id=132] +[ext_resource path="res://cubio/norm-u-0011.png" type="Texture" id=133] +[ext_resource path="res://cubio/norm-u-0012.png" type="Texture" id=134] +[ext_resource path="res://cubio/norm-u-0013.png" type="Texture" id=135] +[ext_resource path="res://cubio/norm-u-0014.png" type="Texture" id=136] +[ext_resource path="res://cubio/norm-u-0015.png" type="Texture" id=137] +[ext_resource path="res://cubio/norm-u-0016.png" type="Texture" id=138] +[ext_resource path="res://cubio/norm-u-0017.png" type="Texture" id=139] +[ext_resource path="res://cubio/norm-u-0018.png" type="Texture" id=140] +[ext_resource path="res://cubio/norm-u-0019.png" type="Texture" id=141] +[ext_resource path="res://cubio/norm-u-0020.png" type="Texture" id=142] +[ext_resource path="res://cubio/norm-ul-0001.png" type="Texture" id=143] +[ext_resource path="res://cubio/norm-ul-0002.png" type="Texture" id=144] +[ext_resource path="res://cubio/norm-ul-0003.png" type="Texture" id=145] +[ext_resource path="res://cubio/norm-ul-0004.png" type="Texture" id=146] +[ext_resource path="res://cubio/norm-ul-0005.png" type="Texture" id=147] +[ext_resource path="res://cubio/norm-ul-0006.png" type="Texture" id=148] +[ext_resource path="res://cubio/norm-ul-0007.png" type="Texture" id=149] +[ext_resource path="res://cubio/norm-ul-0008.png" type="Texture" id=150] +[ext_resource path="res://cubio/norm-ul-0009.png" type="Texture" id=151] +[ext_resource path="res://cubio/norm-ul-0010.png" type="Texture" id=152] +[ext_resource path="res://cubio/norm-ul-0011.png" type="Texture" id=153] +[ext_resource path="res://cubio/norm-ul-0012.png" type="Texture" id=154] +[ext_resource path="res://cubio/norm-ul-0013.png" type="Texture" id=155] +[ext_resource path="res://cubio/norm-ul-0014.png" type="Texture" id=156] +[ext_resource path="res://cubio/norm-ul-0015.png" type="Texture" id=157] +[ext_resource path="res://cubio/norm-ul-0016.png" type="Texture" id=158] +[ext_resource path="res://cubio/norm-ul-0017.png" type="Texture" id=159] +[ext_resource path="res://cubio/norm-ul-0018.png" type="Texture" id=160] +[ext_resource path="res://cubio/norm-ul-0019.png" type="Texture" id=161] +[ext_resource path="res://cubio/norm-ul-0020.png" type="Texture" id=162] +[ext_resource path="res://light2.png" type="Texture" id=163] +[ext_resource path="res://shadow_blob.png" type="Texture" id=164] + +[sub_resource type="CircleShape2D" id=1] + +custom_solver_bias = 0.0 +radius = 20.0 + +[sub_resource type="SpriteFrames" id=2] + +frames = [ ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ), ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ), ExtResource( 30 ), ExtResource( 31 ), ExtResource( 32 ), ExtResource( 33 ), ExtResource( 34 ), ExtResource( 35 ), ExtResource( 36 ), ExtResource( 37 ), ExtResource( 38 ), ExtResource( 39 ), ExtResource( 40 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 43 ), ExtResource( 44 ), ExtResource( 45 ), ExtResource( 46 ), ExtResource( 47 ), ExtResource( 48 ), ExtResource( 49 ), ExtResource( 50 ), ExtResource( 51 ), ExtResource( 52 ), ExtResource( 53 ), ExtResource( 54 ), ExtResource( 55 ), ExtResource( 56 ), ExtResource( 57 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 62 ), ExtResource( 63 ), ExtResource( 64 ), ExtResource( 65 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 68 ), ExtResource( 69 ), ExtResource( 70 ), ExtResource( 71 ), ExtResource( 72 ), ExtResource( 73 ), ExtResource( 74 ), ExtResource( 75 ), ExtResource( 76 ), ExtResource( 77 ), ExtResource( 78 ), ExtResource( 79 ), ExtResource( 80 ), ExtResource( 81 ), ExtResource( 82 ), ExtResource( 83 ), ExtResource( 84 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 88 ), ExtResource( 89 ), ExtResource( 90 ), ExtResource( 91 ), ExtResource( 92 ), ExtResource( 93 ), ExtResource( 94 ), ExtResource( 95 ), ExtResource( 96 ), ExtResource( 97 ), ExtResource( 98 ), ExtResource( 99 ), ExtResource( 100 ), ExtResource( 101 ), ExtResource( 102 ), ExtResource( 103 ), ExtResource( 104 ), ExtResource( 105 ), ExtResource( 106 ), ExtResource( 107 ), ExtResource( 108 ), ExtResource( 109 ), ExtResource( 110 ), ExtResource( 111 ), ExtResource( 112 ), ExtResource( 113 ), ExtResource( 114 ), ExtResource( 115 ), ExtResource( 116 ), ExtResource( 117 ), ExtResource( 118 ), ExtResource( 119 ), ExtResource( 120 ), ExtResource( 121 ), ExtResource( 122 ), ExtResource( 123 ), ExtResource( 124 ), ExtResource( 125 ), ExtResource( 126 ), ExtResource( 127 ), ExtResource( 128 ), ExtResource( 129 ), ExtResource( 130 ), ExtResource( 131 ), ExtResource( 132 ), ExtResource( 133 ), ExtResource( 134 ), ExtResource( 135 ), ExtResource( 136 ), ExtResource( 137 ), ExtResource( 138 ), ExtResource( 139 ), ExtResource( 140 ), ExtResource( 141 ), ExtResource( 142 ), ExtResource( 143 ), ExtResource( 144 ), ExtResource( 145 ), ExtResource( 146 ), ExtResource( 147 ), ExtResource( 148 ), ExtResource( 149 ), ExtResource( 150 ), ExtResource( 151 ), ExtResource( 152 ), ExtResource( 153 ), ExtResource( 154 ), ExtResource( 155 ), ExtResource( 156 ), ExtResource( 157 ), ExtResource( 158 ), ExtResource( 159 ), ExtResource( 160 ), ExtResource( 161 ), ExtResource( 162 ) ] + +[sub_resource type="Animation" id=3] + +resource/name = "bottom" +length = 0.95 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 ] } + +[sub_resource type="Animation" id=4] + +length = 0.95 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 ] } + +[sub_resource type="Animation" id=5] + +length = 3.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59 ] } + +[sub_resource type="Animation" id=6] + +length = 0.95 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ] } + +[sub_resource type="Animation" id=7] + +length = 0.95 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ] } + +[sub_resource type="Animation" id=8] + +length = 0.95 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("frames:frame") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159 ] } + +[node name="cubio" type="KinematicBody2D"] + +visibility/light_mask = 2 +input/pickable = false +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, -0.397217, -9.30363 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +collision/margin = 0.08 +script/script = ExtResource( 1 ) + +[node name="frames" type="AnimatedSprite" parent="."] + +material/material = ExtResource( 2 ) +frames = SubResource( 2 ) +frame = 140 +offset = Vector2( 0.397217, -52.4323 ) + +[node name="shape" type="CollisionShape2D" parent="."] + +transform/pos = Vector2( -0.397217, -9.30363 ) +shape = SubResource( 1 ) +trigger = false +_update_shape_index = -1 + +[node name="camera" type="Camera2D" parent="."] + +anchor_mode = 1 +rotating = false +current = true +zoom = Vector2( 1, 1 ) +limit/left = -10000000 +limit/top = -10000000 +limit/right = 10000000 +limit/bottom = 10000000 +drag_margin/h_enabled = true +drag_margin/v_enabled = true +smoothing/enable = false +smoothing/speed = 5.0 +drag_margin/left = 0.2 +drag_margin/top = 0.2 +drag_margin/right = 0.2 +drag_margin/bottom = 0.2 + +[node name="anim" type="AnimationPlayer" parent="."] + +playback/process_mode = 1 +playback/default_blend_time = 0.0 +root/root = NodePath("..") +anims/bottom = SubResource( 3 ) +anims/bottom_left = SubResource( 4 ) +anims/idle = SubResource( 5 ) +anims/left = SubResource( 6 ) +anims/top = SubResource( 7 ) +anims/top_left = SubResource( 8 ) +playback/active = true +playback/speed = 1.0 +blend_times = [ ] +autoplay = "idle" + +[node name="Light2D" type="Light2D" parent="."] + +transform/pos = Vector2( -0.140442, 2.64355 ) +enabled = true +texture = ExtResource( 163 ) +offset = Vector2( 0, 0 ) +scale = 8.0 +color = Color( 1, 1, 1, 1 ) +energy = 1.0 +mode = 0 +range/height = 100.0 +range/z_min = -1024 +range/z_max = 1024 +range/layer_min = 0 +range/layer_max = 0 +range/item_mask = 3 +shadow/enabled = true +shadow/color = Color( 0, 0, 0, 0 ) +shadow/buffer_size = 2048 +shadow/esm_multiplier = 80.0 +shadow/item_mask = 1 + +[node name="Sprite" type="Sprite" parent="."] + +visibility/opacity = 0.3 +texture = ExtResource( 164 ) +offset = Vector2( 0, -5.72164 ) + + diff --git a/demos/2d/isometric_light/engine.cfg b/demos/2d/isometric_light/engine.cfg index a5b053aa95..e653d4750e 100644 --- a/demos/2d/isometric_light/engine.cfg +++ b/demos/2d/isometric_light/engine.cfg @@ -1,7 +1,7 @@ [application] name="Isometric 2D + Lighting" -main_scene="res://map.scn" +main_scene="res://map.tscn" icon="res://icon.png" [input] diff --git a/demos/2d/isometric_light/floor_shader.res b/demos/2d/isometric_light/floor_shader.res Binary files differdeleted file mode 100644 index c078d27b97..0000000000 --- a/demos/2d/isometric_light/floor_shader.res +++ /dev/null diff --git a/demos/2d/isometric_light/floor_shader.tres b/demos/2d/isometric_light/floor_shader.tres new file mode 100644 index 0000000000..e8f616cf1f --- /dev/null +++ b/demos/2d/isometric_light/floor_shader.tres @@ -0,0 +1,14 @@ +[gd_resource type="CanvasItemMaterial" load_steps=3 format=1] + +[ext_resource path="res://faceNormal.png" type="Texture" id=1] + +[sub_resource type="CanvasItemShader" id=1] + +_code = { "fragment":"// just pass the normal\n\nuniform texture normal;\nvec2 ywnormal=tex( normal,UV).wy * vec2(2.0,2.0) - vec2(1.0,1.0);\nNORMAL=vec3(ywnormal,sqrt(1 - (ywnormal.x * ywnormal.x) - (ywnormal.y * ywnormal.y) ));\n\n", "fragment_ofs":0, "light":"//the tile half size in pixels\nvec2 tile_vec=vec2(140,70);\nfloat z_scale = 1.0;\n//compute a 3D postion fot thelight\nvec3 light_3d = vec3(-LIGHT_VEC.x,LIGHT_HEIGHT,LIGHT_VEC.y);\n\n//rotate the normal map to the same coordinates as the pseudo 3d ponit\n//this could be optimized\nfloat r = asin(tile_vec.y/tile_vec.x);\nmat3 rot_mat = mat3( vec3(1,0,0), vec3(0,cos(r),-sin(r)), vec3(0,sin(r),cos(r)));\nvec3 n = rot_mat * NORMAL;\nn.y=-n.y;\n\n//compute diffuse light\nfloat dp = max(dot(normalize(n),-normalize(light_3d)),0);\nLIGHT=vec4(vec3(dp),1.0)*COLOR*LIGHT_COLOR;\n", "light_ofs":0, "vertex":"//pass the x1 in local sprite coordinates.\n//the sprite center (small red cross) is 0,0\nVAR1.xy=SRC_VERTEX;", "vertex_ofs":0 } + +[resource] + +shader/shader = SubResource( 1 ) +shader/shading_mode = 0 +shader_param/normal = ExtResource( 1 ) + diff --git a/demos/2d/isometric_light/map.scn b/demos/2d/isometric_light/map.scn Binary files differdeleted file mode 100644 index da3fc5654f..0000000000 --- a/demos/2d/isometric_light/map.scn +++ /dev/null diff --git a/demos/2d/isometric_light/map.tscn b/demos/2d/isometric_light/map.tscn new file mode 100644 index 0000000000..3c65f9ecfc --- /dev/null +++ b/demos/2d/isometric_light/map.tscn @@ -0,0 +1,261 @@ +[gd_scene load_steps=10 format=1] + +[ext_resource path="res://map.gd" type="Script" id=1] +[ext_resource path="res://tileset.tres" type="TileSet" id=2] +[ext_resource path="res://cubio.tscn" type="PackedScene" id=3] +[ext_resource path="res://torch.tscn" type="PackedScene" id=4] +[ext_resource path="res://column.tscn" type="PackedScene" id=5] +[ext_resource path="res://cubio/idle0001.png" type="Texture" id=6] +[ext_resource path="res://light2.png" type="Texture" id=7] + +[sub_resource type="CircleShape2D" id=1] + +custom_solver_bias = 0.0 +radius = 100.0 + +[sub_resource type="CanvasItemMaterial" id=2] + +shader/shading_mode = 1 + +[node name="node" type="Node2D"] + +transform/pos = Vector2( -0.735077, -20.5826 ) +script/script = ExtResource( 1 ) + +[node name="floor_map" type="TileMap" parent="."] + +mode = 1 +tile_set = ExtResource( 2 ) +cell/size = Vector2( 192, 88 ) +cell/quadrant_size = 16 +cell/custom_transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +cell/half_offset = 2 +cell/tile_origin = 1 +cell/y_sort = true +collision/use_kinematic = false +collision/friction = 1.0 +collision/bounce = 0.0 +collision/layers = 1 +collision/mask = 1 +occluder/light_mask = 1 +tile_data = IntArray( -1900531, 0, -1900530, 1, -1900529, 0, -1900528, 0, -1900527, 0, -1834995, 0, -1834994, 0, -1834993, 0, -1834992, 1, -1834991, 0, -1769459, 0, -1769458, 0, -1769457, 0, -1769456, 1, -1769455, 0, -1703923, 0, -1703922, 0, -1703921, 0, -1703920, 0, -1703919, 1, -1638387, 0, -1638386, 0, -1638385, 0, -1638384, 0, -1638383, 0, -1572855, 0, -1572854, 0, -1572853, 0, -1572852, 0, -1572851, 0, -1572850, 0, -1572849, 1, -1572848, 0, -1572847, 0, -1507319, 0, -1507318, 0, -1507317, 0, -1507316, 0, -1507315, 1, -1507314, 1, -1507313, 1, -1507312, 0, -1507311, 0, -1441783, 0, -1441782, 0, -1441781, 0, -1441780, 0, -1441779, 0, -1441778, 0, -1441777, 0, -1441776, 0, -1441775, 0, -1376247, 0, -1376246, 0, -1376245, 0, -1376244, 0, -1310711, 1, -1310710, 0, -1310709, 0, -1310708, 0, -1245175, 0, -1245174, 0, -1245173, 0, -1245172, 0, -1179639, 0, -1179638, 0, -1179637, 1, -1179636, 0, -1114103, 0, -1114102, 0, -1114101, 0, -1114100, 0, -1048567, 0, -1048566, 0, -1048565, 0, -1048564, 0, -983031, 0, -983030, 0, -983029, 0, -983028, 0, -917495, 0, -917494, 1, -917493, 1, -917492, 0, -851959, 0, -851958, 0, -851957, 0, -851956, 0, -786423, 0, -786422, 0, -786421, 0, -786420, 0, -720894, 0, -720893, 0, -720892, 0, -720891, 0, -720890, 0, -720889, 0, -720888, 0, -720887, 0, -720886, 0, -720885, 0, -720884, 0, -720883, 0, -720882, 0, -720881, 0, -655358, 0, -655357, 0, -655356, 0, -655355, 0, -655354, 0, -655353, 0, -655352, 0, -655351, 0, -655350, 0, -655349, 0, -655348, 0, -655347, 0, -655346, 0, -655345, 0, -589822, 0, -589821, 0, -589820, 0, -589819, 0, -589818, 0, -589817, 0, -589816, 0, -589815, 0, -589814, 0, -589813, 0, -589812, 0, -589811, 0, -589810, 0, -589809, 0, -524286, 0, -524285, 0, -524284, 1, -524283, 0, -524282, 0, -524281, 0, -524280, 0, -524279, 1, -524278, 1, -524277, 1, -524276, 1, -524275, 0, -524274, 0, -524273, 0, -458750, 0, -458749, 0, -458748, 1, -458747, 0, -458746, 0, -458745, 0, -458744, 0, -458743, 0, -458742, 0, -458741, 0, -458740, 0, -458739, 0, -458738, 1, -458737, 0, -393214, 0, -393213, 0, -393212, 0, -393211, 0, -393210, 0, -393209, 0, -393208, 0, -393207, 0, -393206, 0, -393205, 0, -393204, 0, -393203, 0, -393202, 0, -393201, 0, -262149, 0, -262148, 0, -262147, 0, -262146, 0, -262145, 0, -327680, 0, -327679, 0, -327678, 0, -327677, 0, -327676, 0, -327675, 0, -196613, 0, -196612, 0, -196611, 0, -196610, 0, -196609, 0, -262144, 0, -262143, 0, -262142, 0, -262141, 0, -262140, 0, -262139, 0, -131077, 0, -131076, 0, -131075, 0, -131074, 0, -131073, 0, -196608, 0, -196607, 0, -196606, 0, -196605, 0, -196604, 0, -196603, 0, -65541, 0, -65540, 0, -65539, 0, -65538, 0, -65537, 0, -131072, 0, -131071, 0, -131070, 0, -131069, 1, -131068, 0, -131067, 0, -5, 0, -4, 0, -3, 0, -2, 0, -1, 0, -65536, 0, -65535, 0, -65534, 0, -65533, 0, -65532, 1, -65531, 0, 65531, 0, 65532, 1, 65533, 0, 65534, 0, 65535, 1, 0, 0, 1, 0, 2, 0, 3, 0, 4, 1, 5, 0, 131067, 0, 131068, 1, 131069, 0, 131070, 0, 131071, 0, 65536, 0, 65537, 0, 65538, 0, 65539, 0, 65540, 0, 65541, 0, 196603, 0, 196604, 0, 196605, 0, 196606, 1, 196607, 0, 131072, 0, 131073, 0, 131074, 0, 131075, 0, 131076, 1, 131077, 0, 262139, 0, 262140, 0, 262141, 0, 262142, 0, 262143, 0, 196608, 0, 196609, 0, 196610, 0, 196611, 0, 196612, 0, 196613, 0, 327676, 0, 327677, 0, 327678, 0, 327679, 0, 262144, 0, 262145, 0, 262146, 0, 262147, 0, 262148, 0, 262149, 0 ) + +[node name="wall_map" type="TileMap" parent="."] + +mode = 1 +tile_set = ExtResource( 2 ) +cell/size = Vector2( 94, 43 ) +cell/quadrant_size = 16 +cell/custom_transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +cell/half_offset = 2 +cell/tile_origin = 1 +cell/y_sort = true +collision/use_kinematic = false +collision/friction = 1.0 +collision/bounce = 0.0 +collision/layers = 1 +collision/mask = 1 +occluder/light_mask = 1 +tile_data = IntArray( -3801060, 5, -3801059, 10, -3801058, 10, -3801057, 10, -3801056, 10, -3801055, 10, -3801054, 10, -3801053, 10, -3801052, 536870916, -3735524, 9, -3735516, 7, -3669988, 9, -3669980, 7, -3604452, 9, -3604444, 7, -3538916, 9, -3538908, 7, -3473380, 9, -3473372, 7, -3407844, 9, -3407836, 7, -3342308, 9, -3342300, 7, -3276772, 9, -3276764, 7, -3211236, 9, -3211228, 7, -3145709, 5, -3145708, 10, -3145707, 10, -3145706, 10, -3145705, 10, -3145704, 10, -3145703, 10, -3145702, 10, -3145701, 10, -3145692, 7, -3080173, 9, -3080156, 7, -3014637, 9, -3014634, 2, -3014620, 7, -2949101, 2, -2949084, 7, -2883565, 9, -2883558, 8, -2883557, 8, -2883556, 8, -2883555, 8, -2883554, 8, -2883553, 8, -2883552, 8, -2883551, 8, -2883550, 8, -2883549, 8, -2883548, 6, -2818029, 9, -2818023, 7, -2752493, 9, -2752487, 7, -2686957, 9, -2686955, 2, -2686951, 7, -2621421, 9, -2621415, 7, -2555885, 9, -2555879, 2, -2490349, 2, -2490343, 7, -2424813, 9, -2424807, 7, -2359277, 9, -2359274, 2, -2359271, 7, -2293741, 9, -2293735, 7, -2228205, 4, -2228199, 7, -2162669, 9, -2162668, 10, -2162667, 536870916, -2162663, 7, -2097133, 8, -2097132, 8, -2097131, 6, -2097127, 7, -2031597, 9, -2031591, 7, -1966061, 9, -1966055, 7, -1900525, 9, -1900519, 7, -1834989, 9, -1834986, 8, -1834985, 8, -1834984, 8, -1834983, 7, -1769453, 9, -1769450, 7, -1769447, 7, -1703917, 9, -1703916, 8, -1703915, 8, -1703914, 8, -1703911, 7, -1638381, 9, -1638375, 7, -1572845, 9, -1572839, 7, -1507309, 9, -1507303, 7, -1441787, 5, -1441786, 10, -1441785, 10, -1441784, 10, -1441783, 10, -1441782, 10, -1441781, 10, -1441780, 10, -1441779, 10, -1441778, 10, -1441777, 10, -1441776, 10, -1441775, 10, -1441774, 10, -1441766, 10, -1441765, 10, -1441764, 10, -1441763, 10, -1441762, 10, -1441761, 536870916, -1376251, 9, -1376225, 7, -1310715, 9, -1310689, 7, -1245179, 9, -1245153, 7, -1179643, 9, -1179617, 7, -1114107, 9, -1114081, 7, -1048571, 9, -1048545, 7, -983035, 9, -983009, 7, -917499, 9, -917473, 7, -851963, 9, -851937, 7, -786427, 9, -786401, 7, -720891, 9, -720884, 8, -720883, 8, -720882, 8, -720881, 8, -720880, 8, -720879, 8, -720878, 8, -720877, 8, -720876, 8, -720875, 8, -720874, 8, -720873, 8, -720872, 8, -720871, 8, -720870, 8, -720869, 8, -720868, 8, -720867, 8, -720866, 8, -720865, 6, -589834, 5, -589833, 10, -589832, 10, -589831, 10, -589830, 10, -589829, 10, -589828, 10, -589827, 10, -589826, 10, -589825, 10, -655360, 10, -655359, 10, -655358, 10, -655357, 10, -655356, 10, -655349, 7, -524298, 9, -589813, 7, -458762, 9, -524277, 7, -393226, 9, -458741, 7, -327690, 9, -393205, 7, -262154, 9, -262150, 5, -262149, 10, -262148, 10, -262147, 10, -262146, 10, -262145, 10, -327680, 10, -327679, 10, -327678, 10, -327677, 10, -327676, 3, -327669, 7, -196618, 9, -196614, 9, -262140, 7, -262133, 7, -131082, 9, -131078, 9, -196604, 7, -196597, 7, -65546, 9, -65542, 9, -131068, 7, -131061, 7, -10, 9, -6, 4, -5, 8, -4, 8, -3, 8, -2, 8, -65535, 8, -65534, 8, -65533, 8, -65532, 6, -65525, 7, 65526, 9, 11, 7, 131062, 9, 65547, 7, 196598, 9, 131083, 7, 262134, 9, 196619, 7, 327670, 9, 262155, 7, 393206, 9, 327691, 7, 458742, 9, 393227, 7, 524278, 4, 524279, 8, 458763, 7, 589816, 9, 524299, 7, 655352, 4, 655353, 8, 655354, 8, 655355, 8, 655356, 8, 655357, 8, 655358, 8, 655359, 8, 589824, 8, 589825, 8, 589826, 8, 589827, 8, 589828, 8, 589829, 8, 589830, 8, 589831, 8, 589832, 8, 589833, 8, 589834, 8, 589835, 6 ) +__meta__ = { "_editor_collapsed":true } + +[node name="cubio" parent="wall_map" instance=ExtResource( 3 )] + +transform/pos = Vector2( -184.284, 6.7328 ) +collision/margin = 0.08 + +[node name="toch" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( -42.0531, -74.8855 ) + +[node name="toch1" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 96.0294, -19.8329 ) + +[node name="toch2" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 954.802, -147.456 ) + +[node name="toch3" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 1247.08, 42.9454 ) + +[node name="toch4" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 1257.11, -167.498 ) + +[node name="toch5" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 1632.9, -73.9674 ) + +[node name="toch6" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 1566.09, 113.093 ) + +[node name="toch7" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 1935.2, 64.6577 ) + +[node name="toch8" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 2000.34, 258.399 ) + +[node name="toch9" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 3738.07, -328.247 ) + +[node name="toch10" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 4034.17, -585.483 ) + +[node name="toch11" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 4261.79, -472.595 ) + +[node name="toch12" parent="wall_map" instance=ExtResource( 4 )] + +transform/pos = Vector2( 4006.41, -479.998 ) + +[node name="column" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( -122.203, 119.689 ) + +[node name="column1" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 95.2993, 99.8337 ) + +[node name="column2" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 138.619, 246.039 ) + +[node name="column3" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 324.534, 82.6862 ) + +[node name="column4" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1046.53, -175.429 ) + +[node name="column5" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1347.07, -179.039 ) + +[node name="column6" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1184.62, -261.166 ) + +[node name="column7" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1520.35, -139.329 ) + +[node name="column8" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1409.34, 25.8286 ) + +[node name="column9" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1804.63, -13.8814 ) + +[node name="column10" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 1782.97, 170.229 ) + +[node name="column11" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 2223.9, 158.537 ) + +[node name="column12" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 3744.95, -480.43 ) + +[node name="column13" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 3838.62, -526.042 ) + +[node name="column14" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 3937.17, -573.283 ) + +[node name="column15" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 4123.69, -474.728 ) + +[node name="column16" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 4027.58, -427.487 ) + +[node name="column17" parent="wall_map" instance=ExtResource( 5 )] + +transform/pos = Vector2( 3935.54, -377.802 ) + +[node name="prince_area" type="Area2D" parent="wall_map"] + +transform/pos = Vector2( 4133.07, -561.046 ) +input/pickable = true +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, -37.4897 ) +shapes/0/trigger = false +gravity_vec = Vector2( 0, 1 ) +gravity = 98.0 +linear_damp = 0.1 +angular_damp = 1.0 + +[node name="prince" type="Sprite" parent="wall_map/prince_area"] + +material/material = SubResource( 2 ) +texture = ExtResource( 6 ) +offset = Vector2( -1.10803, -49.8615 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_map/prince_area"] + +transform/pos = Vector2( 0, -37.4897 ) +shape = SubResource( 1 ) +trigger = false +_update_shape_index = -1 + +[node name="Light2D" type="Light2D" parent="."] + +transform/pos = Vector2( -191.788, 32.4743 ) +enabled = true +texture = ExtResource( 7 ) +offset = Vector2( 0, 0 ) +scale = 8.0 +color = Color( 1, 1, 1, 1 ) +energy = 1.0 +mode = 0 +range/height = 60.0 +range/z_min = -1024 +range/z_max = 1024 +range/layer_min = 0 +range/layer_max = 0 +range/item_mask = 1 +shadow/enabled = true +shadow/color = Color( 0, 0, 0, 0 ) +shadow/buffer_size = 2048 +shadow/esm_multiplier = 80.0 +shadow/item_mask = 1 + +[node name="CanvasModulate" type="CanvasModulate" parent="."] + +color = Color( 0.361304, 0.36638, 0.384393, 1 ) + +[node name="message" type="Label" parent="."] + +visibility/visible = false +material/material = SubResource( 2 ) +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +margin/left = 4067.0 +margin/top = -597.0 +margin/right = 4200.0 +margin/bottom = -571.0 +text = "Thank You Cubio!\nYou saved The Prince!" +align = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[connection signal="body_enter" from="wall_map/prince_area" to="." method="_on_prince_area_body_enter"] + + diff --git a/demos/2d/isometric_light/shoot.scn b/demos/2d/isometric_light/shoot.scn Binary files differdeleted file mode 100644 index 6909ae0c71..0000000000 --- a/demos/2d/isometric_light/shoot.scn +++ /dev/null diff --git a/demos/2d/isometric_light/shoot.tscn b/demos/2d/isometric_light/shoot.tscn new file mode 100644 index 0000000000..0a49b33d0b --- /dev/null +++ b/demos/2d/isometric_light/shoot.tscn @@ -0,0 +1,172 @@ +[gd_scene load_steps=10 format=1] + +[ext_resource path="res://shoot.gd" type="Script" id=1] +[ext_resource path="res://energy.png" type="Texture" id=2] +[ext_resource path="res://shoot_halo.png" type="Texture" id=3] + +[sub_resource type="CircleShape2D" id=1] + +custom_solver_bias = 0.0 +radius = 10.0 + +[sub_resource type="CanvasItemMaterial" id=2] + +shader/shading_mode = 0 + +[sub_resource type="Animation" id=3] + +length = 1.0 +loop = false +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("explosion:config/emitting") +tracks/0/interp = 1 +tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.3 ), "transitions":FloatArray( 1, 1 ), "values":[ true, false ] } +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:visibility/opacity") +tracks/1/interp = 1 +tracks/1/keys = { "cont":true, "times":FloatArray( 0, 0.2 ), "transitions":FloatArray( 1, 1 ), "values":[ 1.0, 0.0 ] } +tracks/2/type = "value" +tracks/2/path = NodePath("energy1:config/emitting") +tracks/2/interp = 1 +tracks/2/keys = { "cont":false, "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "values":[ false ] } +tracks/3/type = "value" +tracks/3/path = NodePath("light:color") +tracks/3/interp = 1 +tracks/3/keys = { "cont":true, "times":FloatArray( 0, 0.5 ), "transitions":FloatArray( 1, 1 ), "values":[ Color( 1, 3, 2, 1 ), Color( 0, 0, 0, 0 ) ] } +tracks/4/type = "method" +tracks/4/path = NodePath(".") +tracks/4/interp = 1 +tracks/4/keys = { "times":FloatArray( 0.9 ), "transitions":FloatArray( 1 ), "values":[ { "args":[ ], "method":"queue_free" } ] } + +[sub_resource type="Animation" id=4] + +length = 1.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:transform/rot") +tracks/0/interp = 1 +tracks/0/keys = { "cont":true, "times":FloatArray( 0, 1 ), "transitions":FloatArray( 1, 1 ), "values":[ 0.0, 360.0 ] } + +[sub_resource type="ColorRamp" id=5] + +offsets = FloatArray( 0, 1 ) +colors = ColorArray( 1, 1, 1, 1, 1, 0.617074, 0.704795, 0.0653235 ) + +[sub_resource type="ColorRamp" id=6] + +offsets = FloatArray( 0, 1 ) +colors = ColorArray( 1, 1, 1, 1, 1, 0.617074, 0.704795, 0.0653235 ) + +[node name="shoot" type="KinematicBody2D"] + +input/pickable = false +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +collision/margin = 0.08 +script/script = ExtResource( 1 ) + +[node name="Sprite" type="Sprite" parent="."] + +material/material = SubResource( 2 ) +transform/pos = Vector2( -1.46303, -58.521 ) +texture = ExtResource( 2 ) + +[node name="anim" type="AnimationPlayer" parent="."] + +playback/process_mode = 1 +playback/default_blend_time = 0.0 +root/root = NodePath("..") +anims/explode = SubResource( 3 ) +anims/spin = SubResource( 4 ) +playback/active = true +playback/speed = 1.0 +blend_times = [ ] +autoplay = "" + +[node name="light" type="Light2D" parent="."] + +enabled = true +texture = ExtResource( 3 ) +offset = Vector2( 0, 0 ) +scale = 1.0 +color = Color( 1, 3, 2, 1 ) +energy = 1.0 +mode = 0 +range/height = 80.0 +range/z_min = -1024 +range/z_max = 1024 +range/layer_min = 0 +range/layer_max = 0 +range/item_mask = 1 +shadow/enabled = true +shadow/color = Color( 0, 0, 0, 0 ) +shadow/buffer_size = 2048 +shadow/esm_multiplier = 80.0 +shadow/item_mask = 1 + +[node name="shape" type="CollisionShape2D" parent="."] + +shape = SubResource( 1 ) +trigger = false +_update_shape_index = -1 + +[node name="energy1" type="Particles2D" parent="."] + +visibility/blend_mode = 1 +transform/pos = Vector2( -1.06581, -61.3015 ) +config/amount = 32 +config/lifetime = 0.6 +config/local_space = false +config/texture = ExtResource( 2 ) +params/direction = 0.0 +params/spread = 180.0 +params/linear_velocity = 60.0 +params/spin_velocity = 0.0 +params/orbit_velocity = 0.0 +params/gravity_direction = 0.0 +params/gravity_strength = 9.8 +params/radial_accel = 0.0 +params/tangential_accel = 0.0 +params/damping = 0.0 +params/initial_angle = 0.0 +params/initial_size = 0.8 +params/final_size = 0.1 +params/hue_variation = 0.0 +params/anim_speed_scale = 1.0 +params/anim_initial_pos = 0.0 +color/color_ramp = SubResource( 5 ) + +[node name="explosion" type="Particles2D" parent="."] + +visibility/blend_mode = 1 +transform/pos = Vector2( -1.06581, -61.3015 ) +config/amount = 32 +config/lifetime = 0.6 +config/emitting = false +config/local_space = false +config/explosiveness = 0.1 +config/texture = ExtResource( 2 ) +params/direction = 0.0 +params/spread = 180.0 +params/linear_velocity = 200.0 +params/spin_velocity = 0.0 +params/orbit_velocity = 0.0 +params/gravity_direction = 0.0 +params/gravity_strength = 200.0 +params/radial_accel = 0.0 +params/tangential_accel = 0.0 +params/damping = 0.0 +params/initial_angle = 0.0 +params/initial_size = 0.8 +params/final_size = 0.1 +params/hue_variation = 0.0 +params/anim_speed_scale = 1.0 +params/anim_initial_pos = 0.0 +color/color_ramp = SubResource( 6 ) + + diff --git a/demos/2d/isometric_light/tileset.res b/demos/2d/isometric_light/tileset.res Binary files differdeleted file mode 100644 index f64a4e32bd..0000000000 --- a/demos/2d/isometric_light/tileset.res +++ /dev/null diff --git a/demos/2d/isometric_light/tileset.tres b/demos/2d/isometric_light/tileset.tres new file mode 100644 index 0000000000..c6ccb9f956 --- /dev/null +++ b/demos/2d/isometric_light/tileset.tres @@ -0,0 +1,216 @@ +[gd_resource type="TileSet" load_steps=22 format=1] + +[ext_resource path="res://floor_shader.tres" type="CanvasItemMaterial" id=1] +[ext_resource path="res://faceColor.png" type="Texture" id=2] +[ext_resource path="res://wall_shader.tres" type="CanvasItemMaterial" id=3] + +[sub_resource type="OccluderPolygon2D" id=1] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=2] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, -22, 0, -44, 48, -22 ) + +[sub_resource type="OccluderPolygon2D" id=3] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=4] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, 0, 0, -22, 48, 0, 0, 22 ) + +[sub_resource type="OccluderPolygon2D" id=5] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=6] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, 22, 0, -22 ) + +[sub_resource type="OccluderPolygon2D" id=7] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, -48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=8] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, 0, 0, -22, 0, 22 ) + +[sub_resource type="OccluderPolygon2D" id=9] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, -22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=10] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, -22, 48, 0, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=11] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=12] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, 22, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=13] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=14] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, 22, 0, 0, 48, -22, 48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=15] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=16] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, -22, 0, 0, 0, 22, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=17] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, -22 ) + +[sub_resource type="ConvexPolygonShape2D" id=18] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, -44, 0, -22, -48, 0, -48, -22 ) + +[resource] + +0/name = "floor1" +0/texture = ExtResource( 2 ) +0/tex_offset = Vector2( 0, 28 ) +0/material = ExtResource( 1 ) +0/region = Rect2( 311, 760, 197, 151 ) +0/occluder_offset = Vector2( 98.5, 75.5 ) +0/navigation_offset = Vector2( 98.5, 75.5 ) +0/shape_offset = Vector2( 0, 0 ) +0/shapes = [ ] +1/name = "floor2" +1/texture = ExtResource( 2 ) +1/tex_offset = Vector2( 0, 28 ) +1/material = ExtResource( 1 ) +1/region = Rect2( 591, 772, 197, 151 ) +1/occluder_offset = Vector2( 98.5, 75.5 ) +1/navigation_offset = Vector2( 98.5, 75.5 ) +1/shape_offset = Vector2( 0, 0 ) +1/shapes = [ ] +2/name = "block" +2/texture = ExtResource( 2 ) +2/tex_offset = Vector2( 0, -60 ) +2/material = ExtResource( 3 ) +2/region = Rect2( 844, 527, 138, 180 ) +2/occluder_offset = Vector2( 69, 90 ) +2/occluder = SubResource( 3 ) +2/navigation_offset = Vector2( 69, 90 ) +2/shape_offset = Vector2( 69, 90 ) +2/shapes = [ SubResource( 4 ) ] +3/name = "q_right" +3/texture = ExtResource( 2 ) +3/tex_offset = Vector2( 0, -60 ) +3/material = ExtResource( 3 ) +3/region = Rect2( 665, 528, 139, 178 ) +3/occluder_offset = Vector2( 69.5, 89 ) +3/occluder = SubResource( 5 ) +3/navigation_offset = Vector2( 69.5, 89 ) +3/shape_offset = Vector2( 69.5, 89 ) +3/shapes = [ SubResource( 6 ) ] +4/name = "q_left" +4/texture = ExtResource( 2 ) +4/tex_offset = Vector2( 0, -60 ) +4/material = ExtResource( 3 ) +4/region = Rect2( 292, 528, 139, 178 ) +4/occluder_offset = Vector2( 69.5, 89 ) +4/occluder = SubResource( 7 ) +4/navigation_offset = Vector2( 69.5, 89 ) +4/shape_offset = Vector2( 69.5, 89 ) +4/shapes = [ SubResource( 8 ) ] +5/name = "q_top" +5/texture = ExtResource( 2 ) +5/tex_offset = Vector2( 0, -60 ) +5/material = ExtResource( 3 ) +5/region = Rect2( 479, 528, 139, 178 ) +5/occluder_offset = Vector2( 69.5, 89 ) +5/occluder = SubResource( 9 ) +5/navigation_offset = Vector2( 69.5, 89 ) +5/shape_offset = Vector2( 69.5, 89 ) +5/shapes = [ SubResource( 10 ) ] +6/name = "q_bottom" +6/texture = ExtResource( 2 ) +6/tex_offset = Vector2( 0, -60 ) +6/material = ExtResource( 3 ) +6/region = Rect2( 103, 528, 139, 178 ) +6/occluder_offset = Vector2( 69.5, 89 ) +6/occluder = SubResource( 11 ) +6/navigation_offset = Vector2( 69.5, 89 ) +6/shape_offset = Vector2( 69.5, 89 ) +6/shapes = [ SubResource( 12 ) ] +7/name = "s_right_bottom" +7/texture = ExtResource( 2 ) +7/tex_offset = Vector2( 0, -62 ) +7/material = ExtResource( 3 ) +7/region = Rect2( 480, 350, 139, 178 ) +7/occluder_offset = Vector2( 69.5, 89 ) +7/occluder = SubResource( 13 ) +7/navigation_offset = Vector2( 69.5, 89 ) +7/shape_offset = Vector2( 69.5, 89 ) +7/shapes = [ SubResource( 14 ) ] +8/name = "s_left_bottom" +8/texture = ExtResource( 2 ) +8/tex_offset = Vector2( 0, -62 ) +8/material = ExtResource( 3 ) +8/region = Rect2( 665, 350, 139, 178 ) +8/occluder_offset = Vector2( 69.5, 89 ) +8/occluder = SubResource( 15 ) +8/navigation_offset = Vector2( 69.5, 89 ) +8/shape_offset = Vector2( 69.5, 89 ) +8/shapes = [ SubResource( 16 ) ] +9/name = "s_left_top" +9/texture = ExtResource( 2 ) +9/tex_offset = Vector2( 0, -62 ) +9/material = ExtResource( 3 ) +9/region = Rect2( 292, 350, 139, 178 ) +9/occluder_offset = Vector2( 69.5, 89 ) +9/occluder = SubResource( 17 ) +9/navigation_offset = Vector2( 69.5, 89 ) +9/shape_offset = Vector2( 69.5, 89 ) +9/shapes = [ SubResource( 18 ) ] +10/name = "s_right_top" +10/texture = ExtResource( 2 ) +10/tex_offset = Vector2( -12, -62 ) +10/material = ExtResource( 3 ) +10/region = Rect2( 842, 350, 139, 178 ) +10/occluder_offset = Vector2( 69.5, 89 ) +10/occluder = SubResource( 1 ) +10/navigation_offset = Vector2( 69.5, 89 ) +10/shape_offset = Vector2( 69.5, 89 ) +10/shapes = [ SubResource( 2 ) ] + diff --git a/demos/2d/isometric_light/tileset_edit.tscn b/demos/2d/isometric_light/tileset_edit.tscn new file mode 100644 index 0000000000..a65d55fc35 --- /dev/null +++ b/demos/2d/isometric_light/tileset_edit.tscn @@ -0,0 +1,446 @@ +[gd_scene load_steps=22 format=1] + +[ext_resource path="res://floor_shader.tres" type="CanvasItemMaterial" id=1] +[ext_resource path="res://faceColor.png" type="Texture" id=2] +[ext_resource path="res://wall_shader.tres" type="CanvasItemMaterial" id=3] + +[sub_resource type="ConvexPolygonShape2D" id=1] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, 0, 0, -22, 48, 0, 0, 22 ) + +[sub_resource type="OccluderPolygon2D" id=2] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=3] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, 22, 0, -22 ) + +[sub_resource type="OccluderPolygon2D" id=4] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=5] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, 0, 0, -22, 0, 22 ) + +[sub_resource type="OccluderPolygon2D" id=6] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, -48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=7] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, -22, 48, 0, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=8] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, -22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=9] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, 22, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=10] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=11] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, 22, 0, 0, 48, -22, 48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=12] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, 22, 48, 0 ) + +[sub_resource type="ConvexPolygonShape2D" id=13] + +custom_solver_bias = 0.0 +points = Vector2Array( -48, -22, 0, 0, 0, 22, -48, 0 ) + +[sub_resource type="OccluderPolygon2D" id=14] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, 22 ) + +[sub_resource type="ConvexPolygonShape2D" id=15] + +custom_solver_bias = 0.0 +points = Vector2Array( 0, -44, 0, -22, -48, 0, -48, -22 ) + +[sub_resource type="OccluderPolygon2D" id=16] + +closed = false +cull_mode = 0 +polygon = Vector2Array( -48, 0, 0, -22 ) + +[sub_resource type="ConvexPolygonShape2D" id=17] + +custom_solver_bias = 0.0 +points = Vector2Array( 48, 0, 0, -22, 0, -44, 48, -22 ) + +[sub_resource type="OccluderPolygon2D" id=18] + +closed = false +cull_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0 ) + +[node name="base" type="Node2D"] + +[node name="floor1" type="Sprite" parent="."] + +material/material = ExtResource( 1 ) +transform/pos = Vector2( 140.869, 111.332 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, 28 ) +region = true +region_rect = Rect2( 311, 760, 197, 151 ) + +[node name="floor2" type="Sprite" parent="."] + +material/material = ExtResource( 1 ) +transform/pos = Vector2( 372.62, 109.06 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, 28 ) +region = true +region_rect = Rect2( 591, 772, 197, 151 ) + +[node name="block" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 528, -132 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -60 ) +region = true +region_rect = Rect2( 844, 527, 138, 180 ) + +[node name="collision" type="StaticBody2D" parent="block"] + +input/pickable = false +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="block/collision"] + +build_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0, 0, 22, -48, 0 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="block"] + +occluder = SubResource( 2 ) +light_mask = 1 + +[node name="q_right" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 336, -154 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -60 ) +region = true +region_rect = Rect2( 665, 528, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="q_right"] + +input/pickable = false +shapes/0/shape = SubResource( 3 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="q_right/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, -22, 48, 0, 0, 22 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="q_right"] + +occluder = SubResource( 4 ) +light_mask = 1 + +[node name="q_left" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 96, -110 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -60 ) +region = true +region_rect = Rect2( 292, 528, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="q_left"] + +input/pickable = false +shapes/0/shape = SubResource( 5 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="q_left/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, 22, -48, 0, 0, -22 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="q_left"] + +occluder = SubResource( 6 ) +light_mask = 1 + +[node name="q_top" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 288, 0 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -60 ) +region = true +region_rect = Rect2( 479, 528, 139, 178 ) + +[node name="collision2" type="StaticBody2D" parent="q_top"] + +input/pickable = false +shapes/0/shape = SubResource( 7 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="q_top/collision2"] + +build_mode = 0 +polygon = Vector2Array( -48, 0, 0, -22, 48, 0 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="q_top"] + +occluder = SubResource( 8 ) +light_mask = 1 + +[node name="q_bottom" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 192, -242 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -60 ) +region = true +region_rect = Rect2( 103, 528, 139, 178 ) + +[node name="collision3" type="StaticBody2D" parent="q_bottom"] + +input/pickable = false +shapes/0/shape = SubResource( 9 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="q_bottom/collision3"] + +build_mode = 0 +polygon = Vector2Array( -48, 0, 48, 0, 0, 22 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D1" type="LightOccluder2D" parent="q_bottom"] + +occluder = SubResource( 10 ) +light_mask = 1 + +[node name="s_right_bottom" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 288, -330 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -62 ) +region = true +region_rect = Rect2( 480, 350, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="s_right_bottom"] + +input/pickable = false +shapes/0/shape = SubResource( 11 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="s_right_bottom/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, 22, 48, 0, 48, -22, 0, 0 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="s_right_bottom"] + +occluder = SubResource( 12 ) +light_mask = 1 + +[node name="s_left_bottom" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 432, -330 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -62 ) +region = true +region_rect = Rect2( 665, 350, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="s_left_bottom"] + +input/pickable = false +shapes/0/shape = SubResource( 13 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="s_left_bottom/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, 22, -48, 0, -48, -22, 0, 0 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="s_left_bottom"] + +occluder = SubResource( 14 ) +light_mask = 1 + +[node name="s_left_top" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 528, -330 ) +texture = ExtResource( 2 ) +offset = Vector2( 0, -62 ) +region = true +region_rect = Rect2( 292, 350, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="s_left_top"] + +input/pickable = false +shapes/0/shape = SubResource( 15 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="s_left_top/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, -22, -48, 0, -48, -22, 0, -44 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="s_left_top"] + +occluder = SubResource( 16 ) +light_mask = 1 + +[node name="s_right_top" type="Sprite" parent="."] + +material/material = ExtResource( 3 ) +transform/pos = Vector2( 576, -330 ) +texture = ExtResource( 2 ) +offset = Vector2( -12, -62 ) +region = true +region_rect = Rect2( 842, 350, 139, 178 ) + +[node name="collision1" type="StaticBody2D" parent="s_right_top"] + +input/pickable = false +shapes/0/shape = SubResource( 17 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="s_right_top/collision1"] + +build_mode = 0 +polygon = Vector2Array( 0, -22, 0, -44, 48, -22, 48, 0 ) +shape_range = Vector2( -1, -1 ) +trigger = false + +[node name="LightOccluder2D" type="LightOccluder2D" parent="s_right_top"] + +occluder = SubResource( 18 ) +light_mask = 1 + +[node name="instructions" type="Label" parent="."] + +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +margin/left = 0.0 +margin/top = 0.0 +margin/right = 40.0 +margin/bottom = 13.0 +text = "This scene is used to edit the tileset.\nSave to the tileset with Scene -> Convert to -> TileSet\nThen, overwrite \"tileset.tres\"" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + + diff --git a/demos/2d/isometric_light/tileset_scene.scn b/demos/2d/isometric_light/tileset_scene.scn Binary files differdeleted file mode 100644 index 4841cc18a7..0000000000 --- a/demos/2d/isometric_light/tileset_scene.scn +++ /dev/null diff --git a/demos/2d/isometric_light/torch.scn b/demos/2d/isometric_light/torch.scn Binary files differdeleted file mode 100644 index 9d6a8e2eae..0000000000 --- a/demos/2d/isometric_light/torch.scn +++ /dev/null diff --git a/demos/2d/isometric_light/torch.tscn b/demos/2d/isometric_light/torch.tscn new file mode 100644 index 0000000000..5ceeb57401 --- /dev/null +++ b/demos/2d/isometric_light/torch.tscn @@ -0,0 +1,138 @@ +[gd_scene load_steps=9 format=1] + +[ext_resource path="res://shadow_blob.png" type="Texture" id=1] +[ext_resource path="res://torch_shader.tres" type="CanvasItemMaterial" id=2] +[ext_resource path="res://faceColor.png" type="Texture" id=3] +[ext_resource path="res://torch_light.png" type="Texture" id=4] +[ext_resource path="res://fire.png" type="Texture" id=5] + +[sub_resource type="Animation" id=1] + +resource/name = "firecol" +length = 5.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("light:color") +tracks/0/interp = 1 +tracks/0/keys = { "cont":true, "times":FloatArray( 0, 0.4, 0.6, 1, 1.6, 1.9, 2.3, 2.8, 3, 3.5, 3.9, 4.2, 4.5, 4.8 ), "transitions":FloatArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), "values":[ Color( 1, 0.664806, 0.432623, 1 ), Color( 0.648063, 0.341868, 0.308913, 1 ), Color( 0.796534, 0.145722, 0.198635, 1 ), Color( 0.648063, 0.341868, 0.308913, 1 ), Color( 1, 0.664806, 0.432623, 1 ), Color( 0.796534, 0.145722, 0.198635, 1 ), Color( 0.648063, 0.341868, 0.308913, 1 ), Color( 0.796534, 0.145722, 0.198635, 1 ), Color( 1, 0.664806, 0.432623, 1 ), Color( 0.796534, 0.145722, 0.198635, 1 ), Color( 1, 0.664806, 0.432623, 1 ), Color( 0.796534, 0.145722, 0.198635, 1 ), Color( 0.648063, 0.341868, 0.308913, 1 ), Color( 1, 0.664806, 0.432623, 1 ) ] } + +[sub_resource type="ColorRamp" id=2] + +offsets = FloatArray( 0, 0.2, 0.6, 1 ) +colors = ColorArray( 1, 0.658047, 0, 0.175658, 0.741369, 0.262782, 0, 1, 0.210534, 0, 0, 0.608392, 0, 0, 0, 0 ) + +[sub_resource type="CircleShape2D" id=3] + +custom_solver_bias = 0.0 +radius = 10.0 + +[node name="Node2D" type="Node2D"] + +[node name="Sprite" type="Sprite" parent="."] + +transform/pos = Vector2( 0.880249, 3.08089 ) +texture = ExtResource( 1 ) + +[node name="sprite" type="Sprite" parent="."] + +material/material = ExtResource( 2 ) +transform/pos = Vector2( 1.95071, 0.487679 ) +texture = ExtResource( 3 ) +offset = Vector2( 0.0395508, -22.1477 ) +region = true +region_rect = Rect2( 817, 271, 42, 54 ) + +[node name="light" type="Light2D" parent="sprite"] + +transform/pos = Vector2( -0.975342, 0.975357 ) +enabled = true +texture = ExtResource( 4 ) +offset = Vector2( 0, 0 ) +scale = 8.0 +color = Color( 1, 0.664806, 0.432623, 1 ) +energy = 1.0 +mode = 0 +range/height = 50.0 +range/z_min = -1024 +range/z_max = 1024 +range/layer_min = 0 +range/layer_max = 0 +range/item_mask = 1 +shadow/enabled = true +shadow/color = Color( 0, 0, 0, 0 ) +shadow/buffer_size = 2048 +shadow/esm_multiplier = 80.0 +shadow/item_mask = 1 + +[node name="anim" type="AnimationPlayer" parent="sprite"] + +playback/process_mode = 1 +playback/default_blend_time = 0.0 +root/root = NodePath("..") +anims/firecol = SubResource( 1 ) +playback/active = true +playback/speed = 1.0 +blend_times = [ ] +autoplay = "firecol" + +[node name="fire" type="Particles2D" parent="."] + +visibility/blend_mode = 1 +transform/pos = Vector2( 1.08072, -42.4183 ) +transform/scale = Vector2( 0.59473, 0.5694 ) +config/amount = 12 +config/lifetime = 1.0 +config/texture = ExtResource( 5 ) +params/direction = 180.0 +params/spread = 20.0 +params/linear_velocity = 100.0 +params/spin_velocity = 1.0 +params/orbit_velocity = 0.0 +params/gravity_direction = 180.0 +params/gravity_strength = 9.8 +params/radial_accel = 0.0 +params/tangential_accel = 0.0 +params/damping = 0.0 +params/initial_angle = 180.0 +params/initial_size = 0.7 +params/final_size = 1.0 +params/hue_variation = 0.0 +params/anim_speed_scale = 1.0 +params/anim_initial_pos = 0.0 +randomness/spin_velocity = 1.0 +randomness/initial_angle = 1.0 +color/color_ramp = SubResource( 2 ) + +[node name="VisibilityEnabler2D" type="VisibilityEnabler2D" parent="."] + +transform/pos = Vector2( 1.08071, -50.2535 ) +transform/scale = Vector2( 4.29619, 6.51167 ) +rect = Rect2( -10, -10, 20, 20 ) +enabler/pause_animations = true +enabler/freeze_bodies = true +enabler/pause_particles = true +enabler/process_parent = false +enabler/fixed_process_parent = false + +[node name="col" type="StaticBody2D" parent="."] + +input/pickable = false +shapes/0/shape = SubResource( 3 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0.880249, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +constant_linear_velocity = Vector2( 0, 0 ) +constant_angular_velocity = 0.0 +friction = 1.0 +bounce = 0.0 + +[node name="shape" type="CollisionShape2D" parent="col"] + +transform/pos = Vector2( 0.880249, 0 ) +shape = SubResource( 3 ) +trigger = false +_update_shape_index = -1 + + diff --git a/demos/2d/isometric_light/torch_shader.res b/demos/2d/isometric_light/torch_shader.res Binary files differdeleted file mode 100644 index 31a35de1da..0000000000 --- a/demos/2d/isometric_light/torch_shader.res +++ /dev/null diff --git a/demos/2d/isometric_light/torch_shader.tres b/demos/2d/isometric_light/torch_shader.tres new file mode 100644 index 0000000000..6a45b41fa2 --- /dev/null +++ b/demos/2d/isometric_light/torch_shader.tres @@ -0,0 +1,14 @@ +[gd_resource type="CanvasItemMaterial" load_steps=3 format=1] + +[ext_resource path="res://faceNormal.png" type="Texture" id=1] + +[sub_resource type="CanvasItemShader" id=1] + +_code = { "fragment":"uniform texture normaltex;\nvec4 ntex = tex(normaltex,UV);\nntex.rgb = ntex.rgb * vec3(-2,-2,1) - vec3(-1,-1,0);\nvec2 tile_vec=vec2(47,22);\nfloat r = asin(tile_vec.y / tile_vec.x);\nmat3 rot_mat = mat3( vec3(1,0,0), vec3(0,cos(r),-sin(r)), vec3(0,sin(r),cos(r)));\nNORMAL = rot_mat * ntex.rgb;\n\n\n\n\n", "fragment_ofs":0, "light":"LIGHT_VEC.y=40; //from light towards up, where is the torch\?\nvec3 light_normal = normalize(vec3(LIGHT_VEC,-LIGHT_HEIGHT));\nLIGHT=LIGHT_COLOR*COLOR*max(dot(-light_normal,NORMAL),0.0);\n\n", "light_ofs":0, "vertex":"", "vertex_ofs":0 } + +[resource] + +shader/shader = SubResource( 1 ) +shader/shading_mode = 0 +shader_param/normaltex = ExtResource( 1 ) + diff --git a/demos/2d/isometric_light/wall_shader.res b/demos/2d/isometric_light/wall_shader.res Binary files differdeleted file mode 100644 index 7e33c26201..0000000000 --- a/demos/2d/isometric_light/wall_shader.res +++ /dev/null diff --git a/demos/2d/isometric_light/wall_shader.tres b/demos/2d/isometric_light/wall_shader.tres new file mode 100644 index 0000000000..42d967cf76 --- /dev/null +++ b/demos/2d/isometric_light/wall_shader.tres @@ -0,0 +1,16 @@ +[gd_resource type="CanvasItemMaterial" load_steps=4 format=1] + +[ext_resource path="res://faceMask.png" type="Texture" id=1] +[ext_resource path="res://faceNormal.png" type="Texture" id=2] + +[sub_resource type="CanvasItemShader" id=1] + +_code = { "fragment":"uniform texture normal;\n\nvec2 ywnormal=tex( normal,UV).wy * vec2(2.0,2.0) - vec2(1.0,1.0);\nNORMAL=vec3(ywnormal,sqrt(1 - (ywnormal.x * ywnormal.x) - (ywnormal.y * ywnormal.y) ));\n", "fragment_ofs":0, "light":"// this is the half size of the tile in pixels\n\nvec2 tile_vec=vec2(47,22);\n\n// this mask is used to see which part of the tile is the background (^)\n// or the foregronud (v)\n\nuniform texture bg_mask;\n\nbool behind = tex(bg_mask,UV).a>0.5;\nfloat y_ofs;\n\nif (behind) {\n\t// ^ part\n\t\n\ty_ofs = tile_vec.y*2 - abs(VAR1.x * tile_vec.y / tile_vec.x);\n} else {\n\t// v part\n\t\n\ty_ofs = abs(VAR1.x * tile_vec.y / tile_vec.x);\n}\n\nvec2 point_2d = vec2(VAR1.x,(tile_vec.y - VAR1.y));\n\n// compute a pseudo 3D point for both the light and the texel\n// this makes the normalmap calculation work properly\n\nvec3 point_3d = vec3( point_2d.x, point_2d.y - y_ofs, y_ofs );\nvec3 light_3d = vec3(point_2d.x-LIGHT_VEC.x,LIGHT_HEIGHT,(-(VAR1.y - (LIGHT_VEC.y))+tile_vec.y));\n\n//this could be optimized\n//a rotation matrix is created to convert the normalmap vector\n//to the same coordinate space as our pseudo 3d point and light\n\nfloat r = asin(tile_vec.y / tile_vec.x);\nmat3 rot_mat = mat3( vec3(1,0,0), vec3(0,cos(r),-sin(r)), vec3(0,sin(r),cos(r)));\nvec3 n = rot_mat * NORMAL;\nn.y=-n.y;\n\n//finally compute the dot product. Simple diffuse is computed here,\n//but specular could be added and it will look prettier\n\nfloat dp = max(dot(normalize(n),-normalize(light_3d-point_3d)),0);\nLIGHT=vec4(vec3(dp),1.0)*COLOR*LIGHT_COLOR*3.0;\n\n//finally, after light was cmoputed, make the light \"flat\"\n//this makes the shadows work properly\n//the +2 is added to avoid z-fighting between caster and pseudo 3d coords.\n\nLIGHT_VEC.y+=point_3d.y+2;\n\n", "light_ofs":0, "vertex":"//assign the local vertex coordinates to a varying\n//the center coordinates (0,0) matches the sprite center \n// (shows as a cross when the sprite is selected)\n\nVAR1.xy=SRC_VERTEX;\n", "vertex_ofs":0 } + +[resource] + +shader/shader = SubResource( 1 ) +shader/shading_mode = 0 +shader_param/normal = ExtResource( 2 ) +shader_param/bg_mask = ExtResource( 1 ) + |