Added magnetic paddle graphic and fixed double-hit bug
This commit is contained in:
@@ -76,7 +76,9 @@ func type(base : int, color : Color) -> void:
|
||||
value = 0
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
if not pass_mode: return
|
||||
if body is Ball:
|
||||
print("Area hit ball")
|
||||
body._on_body_exited(self)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
@@ -35,33 +35,36 @@ func _switch_effect(effect : int, time : int = 0) -> void:
|
||||
else:
|
||||
$EffectTimer.stop()
|
||||
|
||||
func show_paddle(paddle : Node2D) -> void:
|
||||
$Normal.visible = true if paddle == $Normal else false
|
||||
$Small.visible = true if paddle == $Small else false
|
||||
$Big.visible = true if paddle == $Big else false
|
||||
$Magnet.visible = true if paddle == $Magnet else false
|
||||
|
||||
$CollisionShape2D.shape.height = 32
|
||||
if paddle == $Big: $CollisionShape2D.shape.height = 40
|
||||
if paddle == $Small: $CollisionShape2D.shape.height = 24
|
||||
|
||||
|
||||
|
||||
func big() -> void:
|
||||
$Normal.visible = false
|
||||
$Small.visible = false
|
||||
$Big.visible = true
|
||||
$CollisionShape2D.shape.height = 40
|
||||
show_paddle($Big)
|
||||
$GrowSound.play()
|
||||
_switch_effect(PADDLE_LARGE, 30)
|
||||
|
||||
func small() -> void:
|
||||
$Normal.visible = false
|
||||
$Small.visible = true
|
||||
$Big.visible = false
|
||||
show_paddle($Small)
|
||||
$CollisionShape2D.shape.height = 24
|
||||
$ShrinkSound.play()
|
||||
_switch_effect(PADDLE_SMALL, 30)
|
||||
|
||||
func normal() -> void:
|
||||
$Normal.visible = true
|
||||
$Small.visible = false
|
||||
$Big.visible = false
|
||||
show_paddle($Normal)
|
||||
$CollisionShape2D.shape.height = 32
|
||||
_switch_effect(PADDLE_NORMAL)
|
||||
|
||||
func capture() -> void:
|
||||
$Normal.visible = true
|
||||
$Small.visible = false
|
||||
$Big.visible = false
|
||||
show_paddle($Magnet)
|
||||
$CollisionShape2D.shape.height = 32
|
||||
_switch_effect(PADDLE_CAPTURE, 15)
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://dndemjw7up2r6"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dndemjw7up2r6"]
|
||||
|
||||
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="1_oa72h"]
|
||||
[ext_resource type="Script" path="res://Paddle/Paddle.gd" id="1_swo0j"]
|
||||
[ext_resource type="Texture2D" uid="uid://0pjgtr5e102q" path="res://Paddle/PaddleNormal.png" id="2_po2us"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjp5oq8ors5ua" path="res://Paddle/PaddleSmall.png" id="3_jvb7q"]
|
||||
[ext_resource type="Texture2D" uid="uid://dx3a3rva5g7ex" path="res://Paddle/PaddleBig.png" id="5_w5k41"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmwoidu5wsvu6" path="res://Paddle/PaddleMagnet.png" id="6_8ubfk"]
|
||||
[ext_resource type="AudioStream" uid="uid://ds7om6qbk3p6l" path="res://Sounds/Grow.wav" id="6_hpb6a"]
|
||||
[ext_resource type="AudioStream" uid="uid://bd2o8lynhy3wn" path="res://Sounds/Shrink.wav" id="7_3krfd"]
|
||||
|
||||
@@ -69,6 +70,22 @@ offset_right = 20.0
|
||||
offset_bottom = 4.0
|
||||
texture = ExtResource("5_w5k41")
|
||||
|
||||
[node name="Magnet" type="Node2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="Magnet"]
|
||||
z_index = -1
|
||||
position = Vector2(2, 4)
|
||||
color = Color(0, 0, 0, 0.247059)
|
||||
polygon = PackedVector2Array(-14, -4, 14, -4, 16, -2, 16, 2, 14, 4, -14, 4, -16, 2, -16, -2)
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Magnet"]
|
||||
offset_left = -16.0
|
||||
offset_top = -4.0
|
||||
offset_right = 16.0
|
||||
offset_bottom = 4.0
|
||||
texture = ExtResource("6_8ubfk")
|
||||
|
||||
[node name="EffectTimer" type="Timer" parent="."]
|
||||
|
||||
[node name="GrowSound" type="AudioStreamPlayer" parent="."]
|
||||
|
||||
BIN
Paddle/PaddleMagnet.png
Normal file
BIN
Paddle/PaddleMagnet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
34
Paddle/PaddleMagnet.png.import
Normal file
34
Paddle/PaddleMagnet.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bmwoidu5wsvu6"
|
||||
path="res://.godot/imported/PaddleMagnet.png-2bc67dad0fc269a5d8de28edcdd3155a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Paddle/PaddleMagnet.png"
|
||||
dest_files=["res://.godot/imported/PaddleMagnet.png-2bc67dad0fc269a5d8de28edcdd3155a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user