general update

This commit is contained in:
ajuvercr 2020-02-08 11:36:48 +01:00
parent fce540a122
commit 02ebacf45d
5 changed files with 17 additions and 27 deletions

View file

@ -3,8 +3,6 @@ extends Node
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 = 250
var last_built = 500
@ -20,15 +18,6 @@ func build_tower():
add_child(tower)
last_built += tower_density
func update_view():
var canvas_transform = get_viewport().get_canvas_transform()
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():
randomize()

View file

@ -22,7 +22,7 @@ collision_layer = 0
motion_scale = Vector2( 0.5, 1 )
motion_mirroring = Vector2( 420, 0 )
[node name="Background" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 209.839, 320 )
scale = Vector2( 2.91891, 2.5 )
texture = SubResource( 1 )

View file

@ -34,7 +34,7 @@ func _process(delta):
position += Vector2(speed, speed_y * speed)
# TODO find the correct rotation, noob
rotation = atan(speed_y / speed)
if position.y > screen_size.y:

View file

@ -3,10 +3,6 @@
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://res/sprites.png" type="Texture" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 12.8837
height = 4.07484
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 2 )
region = Rect2( -4, 488, 84, 16 )
@ -16,7 +12,7 @@ length = 0.8
loop = true
step = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("Node2D/Sprite1:frame")
tracks/0/path = NodePath("Node2D/Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@ -25,24 +21,25 @@ tracks/0/keys = {
"times": PoolRealArray( 0, 0.2, 0.4, 0.6 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ 1, 2, 1, 0 ]
"values": [ 0, 1, 2, 1 ]
}
[node name="Player" type="Area2D"]
[sub_resource type="CapsuleShape2D" id=1]
radius = 12.8837
height = 4.07484
[node name="Area2D" type="Area2D"]
position = Vector2( 9.25964, 6.09653 )
script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( 1 )
[node name="Node2D" type="Node2D" parent="."]
scale = Vector2( 2, 2 )
[node name="Sprite1" type="Sprite" parent="Node2D"]
[node name="Sprite" type="Sprite" parent="Node2D"]
position = Vector2( -3.46641, -2.14102 )
scale = Vector2( 2.14565, 2.14019 )
texture = SubResource( 2 )
hframes = 3
frame = 1
@ -52,6 +49,10 @@ root_node = NodePath("../..")
autoplay = "fly"
anims/fly = SubResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( 1 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true
limit_top = 0