diff --git a/prototype/unit/unit.gd b/prototype/unit/unit.gd index 5edbf5a6..b8d5ff75 100644 --- a/prototype/unit/unit.gd +++ b/prototype/unit/unit.gd @@ -151,10 +151,14 @@ func set_behavior(s): func setup_team(new_team): self.team = new_team - # hide fog setup - get_node("light").visible = false - if new_team == game.player_team: get_node("light").visible = true - sprites.use_parent_material = true + # fog setup + if has_node("light"): + var light = get_node("light") + light.visible = false + if new_team == game.player_team: light.visible = true + var s = self.vision / 16 + light.scale = Vector2(s,s) + sprites.use_parent_material = true # color body sprite set_text_anim(new_team, body) diff --git a/prototype/unit/unit.tscn b/prototype/unit/unit.tscn index 679b2297..c7dc1694 100644 --- a/prototype/unit/unit.tscn +++ b/prototype/unit/unit.tscn @@ -37,18 +37,6 @@ region = Rect2( 24, 0, 24, 24 ) atlas = ExtResource( 3 ) region = Rect2( 48, 0, 24, 24 ) -[sub_resource type="AtlasTexture" id=47] -atlas = ExtResource( 13 ) -region = Rect2( 0, 0, 24, 24 ) - -[sub_resource type="AtlasTexture" id=48] -atlas = ExtResource( 13 ) -region = Rect2( 24, 0, 24, 24 ) - -[sub_resource type="AtlasTexture" id=49] -atlas = ExtResource( 13 ) -region = Rect2( 48, 0, 24, 24 ) - [sub_resource type="AtlasTexture" id=50] atlas = ExtResource( 17 ) region = Rect2( 0, 0, 24, 24 ) @@ -61,6 +49,18 @@ region = Rect2( 24, 0, 24, 24 ) atlas = ExtResource( 17 ) region = Rect2( 48, 0, 24, 24 ) +[sub_resource type="AtlasTexture" id=47] +atlas = ExtResource( 13 ) +region = Rect2( 0, 0, 24, 24 ) + +[sub_resource type="AtlasTexture" id=48] +atlas = ExtResource( 13 ) +region = Rect2( 24, 0, 24, 24 ) + +[sub_resource type="AtlasTexture" id=49] +atlas = ExtResource( 13 ) +region = Rect2( 48, 0, 24, 24 ) + [sub_resource type="SpriteFrames" id=53] animations = [ { "frames": [ SubResource( 54 ), SubResource( 55 ), SubResource( 56 ) ], @@ -68,14 +68,14 @@ animations = [ { "name": "default", "speed": 5.0 }, { -"frames": [ SubResource( 47 ), SubResource( 48 ), SubResource( 49 ) ], +"frames": [ SubResource( 50 ), SubResource( 51 ), SubResource( 52 ) ], "loop": true, -"name": "red", +"name": "neutral", "speed": 5.0 }, { -"frames": [ SubResource( 50 ), SubResource( 51 ), SubResource( 52 ) ], +"frames": [ SubResource( 47 ), SubResource( 48 ), SubResource( 49 ) ], "loop": true, -"name": "neutral", +"name": "red", "speed": 5.0 } ] @@ -200,11 +200,9 @@ position = Vector2( 0, 8 ) texture = ExtResource( 2 ) [node name="body" type="AnimatedSprite" parent="sprites"] -visible = false use_parent_material = true position = Vector2( 0, 9 ) frames = SubResource( 53 ) -animation = "neutral" offset = Vector2( -2, -11 ) [node name="collisions" type="Area2D" parent="."] @@ -224,8 +222,7 @@ shape = SubResource( 19 ) disabled = true [node name="light" type="Light2D" parent="."] -visible = false -scale = Vector2( 10, 10 ) +scale = Vector2( 6.25, 6.25 ) texture = ExtResource( 16 ) mode = 2 shadow_enabled = true