Skip to content

Commit

Permalink
Auto-Format GDScript
Browse files Browse the repository at this point in the history
  • Loading branch information
monochromia authored and github-actions[bot] committed Apr 18, 2022
1 parent d9b8ad5 commit 839c441
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/Food.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ var vel_y = 0
var vel_rotation = 0
var is_pie = false


func randomize_me():
vel_rotation = int(rand_range(-2, 2))
vel_y = int(rand_range(50, 150))
position.y = int(rand_range(0, -100))
position.x = int(rand_range(32, 1000))

if randf() > 0.5:
var x = int(rand_range(0, 7)) * 32
var y = int(rand_range(0, 2)) * 32
Expand All @@ -20,15 +21,17 @@ func randomize_me():
$Sprite.region_rect = Rect2(1 * 32, 3 * 32, 32, 32)
is_pie = true


func _physics_process(delta: float):
$Sprite.rotation_degrees += vel_rotation
var collision = move_and_collide(Vector2(0, vel_y * delta))
if collision:
var collider = collision.collider as Object
if collision:
var collider = collision.collider as Object
if collision.collider as TileMap:
randomize_me();
randomize_me()
elif collision.collider.name == "Player" and is_pie:
EventBus.emit_signal("player_died")

func _ready():

func _ready():
randomize_me()

0 comments on commit 839c441

Please sign in to comment.