mirror of
https://git.kittycat.homes/zoe/pegchamp.git
synced 2024-08-15 03:15:39 +00:00
first commit
This commit is contained in:
commit
fafcbd1530
223 changed files with 107395 additions and 0 deletions
31
ControlElements/Killzone.gd
Normal file
31
ControlElements/Killzone.gd
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue