something something textures, bg not working
This commit is contained in:
parent
c2421926ac
commit
73ddb8e6dc
4 changed files with 85 additions and 30 deletions
|
@ -4,6 +4,7 @@ export (PackedScene) var Tower = preload("res://Tower.tscn");
|
|||
|
||||
onready var screen_size = Vector2(ProjectSettings.get("display/window/size/width"), ProjectSettings.get("display/window/size/height"))
|
||||
onready var player = get_node("Player")
|
||||
onready var bg = get_node("Background")
|
||||
|
||||
export var tower_density = 200
|
||||
var last_built = 300
|
||||
|
@ -22,6 +23,8 @@ func update_view():
|
|||
var pos = player.position
|
||||
pos.y = 0
|
||||
canvas_transform[2] = -pos + screen_size / 2
|
||||
|
||||
bg.position = player.position
|
||||
get_viewport().set_canvas_transform(canvas_transform)
|
||||
|
||||
func _ready():
|
||||
|
|
12
Main.tscn
12
Main.tscn
|
@ -7,14 +7,12 @@
|
|||
[node name="View" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
margin_left = -1.16638
|
||||
margin_top = -321.166
|
||||
margin_right = 1244.83
|
||||
margin_bottom = 318.834
|
||||
[node name="Background" type="Sprite" parent="."]
|
||||
position = Vector2( 774.747, 318.138 )
|
||||
scale = Vector2( 10, 10 )
|
||||
texture = ExtResource( 2 )
|
||||
expand = true
|
||||
stretch_mode = 2
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 144, 256 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 155.182, -2.28882e-05 )
|
||||
|
|
80
Player.tscn
80
Player.tscn
|
@ -1,32 +1,84 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
[ext_resource path="res://res/sprites.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 12.8837
|
||||
height = 4.07484
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "fly"
|
||||
length = 0.4
|
||||
loop = true
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite1:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite2:frame")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.1, 0.3 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0, 0 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite3:frame")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0.2 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0 ]
|
||||
}
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
position = Vector2( 0.581787, 0 )
|
||||
position = Vector2( 9.25964, 6.09653 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.498334, 0.531778 )
|
||||
frames = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
scale = Vector2( 2, 2 )
|
||||
|
||||
[node name="Sprite1" type="Sprite" parent="Node2D"]
|
||||
texture = ExtResource( 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 3, 491, 17, 12 )
|
||||
|
||||
[node name="Sprite2" type="Sprite" parent="Node2D"]
|
||||
texture = ExtResource( 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 31, 491, 17, 12 )
|
||||
|
||||
[node name="Sprite3" type="Sprite" parent="Node2D"]
|
||||
texture = ExtResource( 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 59, 491, 17, 12 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Node2D"]
|
||||
root_node = NodePath("../..")
|
||||
autoplay = "fly"
|
||||
anims/fly = SubResource( 3 )
|
||||
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
|
||||
|
|
20
Tower.tscn
20
Tower.tscn
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Tower.gd" type="Script" id=1]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://res/sprites.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 29.9672, 264.93 )
|
||||
|
@ -12,11 +12,12 @@ script = ExtResource( 1 )
|
|||
[node name="Lower" type="RigidBody2D" parent="."]
|
||||
position = Vector2( -32, 100 )
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Lower"]
|
||||
margin_right = 64.0
|
||||
margin_bottom = 500.0
|
||||
[node name="Sprite" type="Sprite" parent="Lower"]
|
||||
position = Vector2( 30.9827, 265.322 )
|
||||
scale = Vector2( 2.55196, 3.34805 )
|
||||
texture = ExtResource( 2 )
|
||||
expand = true
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 84, 323, 26, 160 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Lower"]
|
||||
position = Vector2( 31.5038, 267.238 )
|
||||
|
@ -26,11 +27,12 @@ shape = SubResource( 1 )
|
|||
position = Vector2( 32, -100 )
|
||||
rotation = 3.14159
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Upper"]
|
||||
margin_right = 64.0
|
||||
margin_bottom = 500.0
|
||||
[node name="Sprite" type="Sprite" parent="Upper"]
|
||||
position = Vector2( 33.3285, 264.086 )
|
||||
scale = Vector2( 2.41273, 3.32748 )
|
||||
texture = ExtResource( 2 )
|
||||
expand = true
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 84, 323, 26, 160 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Upper"]
|
||||
position = Vector2( 32.6698, 265.913 )
|
||||
|
|
Loading…
Reference in a new issue