My scene setup image direct link
Thanks for you answer. Can you tell what causes it to increase memory (For example a checklist)
It is my scene setup and i repeat these in other level. Level by level some object (like bricks) and animation are increase.
"audio" have several sound (StreamPlayer type).
"camera" have a code for shaking when ball is lose. (I learn this code from Angega Studios youtube user)
"Player" and "enemy" have 2 animation and i set those to play random when finished animation.
anim.connect("finished", self, "_random_animation")
var randNum = randi() % 2
if randNum == 0: anim.play("idle")
"brick container" have 24 bricks, and level by level these will be increase.
"ball" have a for loop condition for collision check and bricks queue_free, play sound when contact to object. and a condition for check ball that when ball get out at scene, reset ball position for new game.
if _global.is_ball_play && self.get_global_pos().x <= 0:
_global.is_ball_play = false
_global.player_life -= 1
ballSpeed = BALL_SPEED
# Colliding ball
var collision = get_colliding_bodies()
for i in collision:
ballSpeed += 3
ballSpeed = clamp(ballSpeed, BALL_SPEED, BALL_SPEED*2)
# Ball sound
# Change direction ball by hit
if i.get_name() == "hit_player":
var p = i.get_node("position2D").get_global_pos()
var changPos = self.get_global_pos() - p
var velocity = changPos.normalized() * ballSpeed
"container" is a place for add "white fade-out animation" when ball is lose and "hit shape" for change direction ball (like a paddle), and after finished animation these will be queue_free.
"ui" is a simple menu for go to next level, close or restart game.
I hope these information be enough