very cool

This commit is contained in:
Tabby 2025-04-20 17:31:40 +10:00
parent 0f67687c55
commit c7bda26eed
12 changed files with 172 additions and 16 deletions

View file

@ -4,6 +4,7 @@ class_name Player
var id : int = 0
var score : int = 0
var scorecard : Scorecard
var alive : bool = true
@export var start_speed = 100
@export var animated_sprite : AnimatedSprite2D
@ -17,3 +18,30 @@ func _ready() -> void:
func setup():
animated_sprite.frame = id
func respawn_shiny():
var shiny = load("res://shiny.tscn").instantiate()
var ranPos = randi_range(0,GM.shine_spawns.size()-1)
shiny.position = GM.shine_spawns[ranPos].position
get_tree().get_root().add_child(shiny)
func _process(delta: float) -> void:
scorecard.score = score
scorecard.alive = alive
if(linear_velocity.length() < 35):
linear_velocity *= 1.1
if(not alive):
modulate = Color("ffffff42")
contact_monitor = false
scorecard.alive = false
for i in range(score):
respawn_shiny()
process_mode = Node.PROCESS_MODE_DISABLED
func _on_body_entered(body: Node) -> void:
#print("mew")
if body.is_in_group("player") :
print("playersHit")
if(score > 0):
score -= 1
respawn_shiny()