first commit

This commit is contained in:
zoe-bat 2021-09-08 10:27:14 +02:00
commit fafcbd1530
223 changed files with 107395 additions and 0 deletions

View file

@ -0,0 +1,31 @@
extends KinematicBody2D
enum {IDLE, MOVEUP, MOVEDOWN}
var state = IDLE
func _on_Killzone_body_entered(body):
if body.has_method("reset_ball"):
body.reset_ball()
state = MOVEUP
GameStats.add_balls(-1)
if body.has_method("explode"):
if (body.has_method("set_particle_direction")):
body.set_particle_direction(Vector2(0, -10))
body.explode()
func _physics_process(_delta):
match state:
IDLE: pass
MOVEUP: moveup()
MOVEDOWN: movedown()
func moveup():
var _collide = move_and_collide(Vector2(0, -5))
func movedown():
var _collide = move_and_collide(Vector2(0, 5))
func _on_ZoneDetection_area_entered(_area):
if (state == MOVEUP):
state = MOVEDOWN
else: state = IDLE

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://ControlElements/Killzone.gd" type="Script" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 195, 9 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 303 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 192, 10 )
[node name="Killzone" type="KinematicBody2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource( 1 )
[node name="Killzone" type="Area2D" parent="."]
position = Vector2( 192, 0 )
[node name="Bottom" type="CollisionShape2D" parent="Killzone"]
shape = SubResource( 1 )
[node name="Left" type="CollisionShape2D" parent="Killzone"]
position = Vector2( -202, 0 )
shape = SubResource( 2 )
[node name="Right" type="CollisionShape2D" parent="Killzone"]
position = Vector2( 202, 0 )
shape = SubResource( 2 )
[node name="ZoneDetection" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="ZoneDetection"]
position = Vector2( 192, 0 )
shape = SubResource( 3 )
[connection signal="body_entered" from="Killzone" to="." method="_on_Killzone_body_entered"]
[connection signal="area_entered" from="ZoneDetection" to="." method="_on_ZoneDetection_area_entered"]

View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ControlElements/Killzone.gd" type="Script" id=1]
[ext_resource path="res://Effects/stars.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 195, 7 )
[node name="Killzone" type="Area2D"]
position = Vector2( 192, 0 )
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
[connection signal="body_entered" from="." to="." method="_on_Killzone_body_entered"]