Added Ball Factory and Removed container.png using a Polygond2D instead

This commit is contained in:
Henrique Campos
2019-10-07 21:04:40 -03:00
parent d29b987235
commit 1ae9f1b549
6 changed files with 30 additions and 38 deletions

View File

@@ -0,0 +1,16 @@
extends Position2D
export (PackedScene) var ball_scene = preload("res://ball.tscn")
func _unhandled_input(event):
if event.is_echo():
return
if event is InputEventMouseButton and event.is_pressed():
if event.button_index == BUTTON_LEFT:
spawn(get_global_mouse_position())
func spawn(spawn_global_position = global_position):
var instance = ball_scene.instance()
instance.global_position = spawn_global_position
add_child(instance)

View File

@@ -3,6 +3,9 @@
importer="texture"
type="StreamTexture"
path="res://.import/bowling_ball.png-0fe48f78a8537b41cee7fd03e5ee14fe.stex"
metadata={
"vram_texture": false
}
[deps]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,31 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/container.png-08b8c30d2209234da421d1db5c67b811.stex"
[deps]
source_file="res://container.png"
dest_files=[ "res://.import/container.png-08b8c30d2209234da421d1db5c67b811.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

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=13 format=2]
[ext_resource path="res://container.png" type="Texture" id=1]
[ext_resource path="res://ball_factory.gd" type="Script" id=1]
[ext_resource path="res://ball.tscn" type="PackedScene" id=2]
[sub_resource type="PhysicsMaterial" id=1]
@@ -35,16 +35,18 @@ bounce = 0.4
[node name="container" type="Node"]
[node name="ball_factory" type="Position2D" parent="."]
script = ExtResource( 1 )
[node name="static" type="StaticBody2D" parent="."]
[node name="sprite" type="Sprite" parent="static"]
position = Vector2( 3, -4 )
texture = ExtResource( 1 )
centered = false
[node name="collision" type="CollisionPolygon2D" parent="static"]
polygon = PoolVector2Array( 8.68994, 22.1976, 50.4445, 556.656, 292.621, 501.54, 335.36, 550.855, 510.039, 563.135, 542.137, 526.368, 567.463, 515.822, 612.463, 506.822, 667.291, 495.079, 747.553, 553.575, 793.806, 6.70509, 802.465, 601.097, 4.43558, 596.186 )
[node name="polygon2d" type="Polygon2D" parent="static"]
color = Color( 1, 0.266667, 0.419608, 1 )
polygon = PoolVector2Array( 8.68994, 22.1976, 50.4445, 556.656, 292.621, 501.54, 335.36, 550.855, 510.039, 563.135, 542.137, 526.368, 567.463, 515.822, 612.463, 506.822, 667.291, 495.079, 747.553, 553.575, 793.806, 6.70509, 802.465, 601.097, 4.43558, 596.186 )
[node name="ball 1" parent="." instance=ExtResource( 2 )]
position = Vector2( 223.823, 161.773 )
physics_material_override = SubResource( 1 )
@@ -84,4 +86,3 @@ physics_material_override = SubResource( 9 )
[node name="ball 10" parent="." instance=ExtResource( 2 )]
position = Vector2( 143.756, 295.139 )
physics_material_override = SubResource( 10 )

View File

@@ -3,6 +3,9 @@
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]