DricomDragon 3 роки тому
батько
коміт
a1f6a88a40

BIN
godot/image/launcher.png


+ 34 - 0
godot/image/launcher.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/launcher.png-84f13e2148f4b340ee3f5eae794706e7.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://image/launcher.png"
+dest_files=[ "res://.import/launcher.png-84f13e2148f4b340ee3f5eae794706e7.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

BIN
godot/image/visor.png


+ 34 - 0
godot/image/visor.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/visor.png-c1b70b21df80efcc97fabf2bd085ef7f.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://image/visor.png"
+dest_files=[ "res://.import/visor.png-c1b70b21df80efcc97fabf2bd085ef7f.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 10 - 17
godot/scenes/main.tscn

@@ -1,9 +1,10 @@
-[gd_scene load_steps=11 format=2]
+[gd_scene load_steps=12 format=2]
 
-[ext_resource path="res://scenes/Ball.tscn" type="PackedScene" id=1]
+[ext_resource path="res://image/launcher.png" type="Texture" id=1]
 [ext_resource path="res://image/brik.png" type="Texture" id=2]
 [ext_resource path="res://scripts/Catcher.gd" type="Script" id=3]
 [ext_resource path="res://scripts/Launcher.gd" type="Script" id=4]
+[ext_resource path="res://image/visor.png" type="Texture" id=5]
 
 [sub_resource type="PhysicsMaterial" id=5]
 friction = 0.0
@@ -64,18 +65,6 @@ cell_custom_transform = Transform2D( 40, 0, 0, 20, 0, 0 )
 format = 1
 tile_data = PoolIntArray( 65540, 0, 0, 65541, 0, 0, 393217, 0, 0, 393218, 0, 0, 393223, 0, 0, 393224, 0, 0, 458753, 0, 0, 458754, 0, 0, 458759, 0, 0, 458760, 0, 0, 524289, 0, 0, 524290, 0, 0, 524295, 0, 0, 524296, 0, 0, 720899, 0, 0, 720900, 0, 0, 720901, 0, 0, 720902, 0, 0 )
 
-[node name="Ball" parent="." instance=ExtResource( 1 )]
-position = Vector2( 306.503, 282.76 )
-linear_velocity = Vector2( 100, -100 )
-
-[node name="Ball2" parent="." instance=ExtResource( 1 )]
-position = Vector2( 280.601, 315.137 )
-linear_velocity = Vector2( 100, -100 )
-
-[node name="Ball3" parent="." instance=ExtResource( 1 )]
-position = Vector2( 254.699, 347.514 )
-linear_velocity = Vector2( 100, -100 )
-
 [node name="Catcher" type="Area2D" parent="."]
 position = Vector2( 200, 470 )
 script = ExtResource( 3 )
@@ -84,9 +73,13 @@ script = ExtResource( 3 )
 shape = SubResource( 8 )
 
 [node name="Launcher" type="Node2D" parent="."]
-position = Vector2( 200, 400 )
 script = ExtResource( 4 )
 
-[node name="Target" type="Position2D" parent="Launcher"]
-position = Vector2( 0, -200 )
+[node name="Target" type="Sprite" parent="Launcher"]
+position = Vector2( 200, 400 )
+texture = ExtResource( 5 )
+
+[node name="Source" type="Sprite" parent="Launcher"]
+position = Vector2( 200, 400 )
+texture = ExtResource( 1 )
 [connection signal="body_entered" from="Catcher" to="Catcher" method="_on_Catcher_body_entered"]

+ 3 - 1
godot/scripts/Launcher.gd

@@ -11,6 +11,7 @@ const BULLET_SPEED = 200.0
 var _ballScene = preload("res://scenes/Ball.tscn")
 
 onready var target = $Target
+onready var source = $Source
 
 onready var current_state = State.WAITING
 
@@ -22,6 +23,7 @@ func _input(event):
 
 func shoot():
 		var bullet = _ballScene.instance()
-		bullet.linear_velocity = (target.position - position).normalized()
+		bullet.position = source.position
+		bullet.linear_velocity = (target.position - source.position).normalized()
 		bullet.linear_velocity *= BULLET_SPEED
 		add_child(bullet)