Skip to content

Commit

Permalink
fog vision light scale
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcastrocouto committed Aug 7, 2022
1 parent e3ca112 commit 57ab1d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
12 changes: 8 additions & 4 deletions prototype/unit/unit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 17 additions & 20 deletions prototype/unit/unit.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -61,21 +49,33 @@ 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 ) ],
"loop": true,
"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
} ]

Expand Down Expand Up @@ -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="."]
Expand All @@ -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
Expand Down

0 comments on commit 57ab1d9

Please sign in to comment.