#StackBounty: #2d #isometric #godot #gdscript How to transfer the player into a new scene, loaded in the background?

Bounty: 50

I’m porting an old BuidBox 2 game to the Godot game engine. I already added all assets and scenes to the Godot project. The game is a 2.5D (isometric) endless runner. What I want now is to add a mechanism to load the next scene offscreen, remove the player’s character from the current scene, and add it to the next scene seamlessly, without breaking the game physics or causing the player character to go behind or in front of other game objects that it’s not supposed to.

For instance if I have this scenes:

Scene1
|-bg
|-player
└-fg

Scene2
|-bg
|-player
└-fg

I would like to load Scene2, remove player from Scene1 and replace player from Scene2 with the player node I removed from Scene1, without the player node changing its velocity or position abruptly in the physics world or appearing behind the bg node in Scene2 or in front of the fg node in Scene1.


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!

#StackBounty: #collision-detection #godot Godot 3.2 Bomb explosion doesn't affect player or npc

Bounty: 50

I finished the Godot 2D game tutorial Dodge the Creeps, and i’m adding a few additional features to reinforce the things learned and make more interesting the base game.

Basically i added a Scene with a area2d as root node with a collisionShape2d,a 2 timers for the Bomb scene.

The bomb appears randomlly in the main scene, for a few seconds is supposed to be ticking and then explodes.

My problem is that neither the player or the creeps( the npc enemies) are being removed from the scene.
They don’t interact at all,

This is the code for the Bomb.tscn scene:

extends Node

func _ready():
    # Area collison disabled until animation finishes
    $CollisionShape2D.disabled = true
    # Bomb ticking animation
    $AnimatedSprite.animation = "bomb"
    # Until BombTimer times out we change animation and activate collisionArea
    $BombTimer.start()

func _on_BombTimer_timeout():
    # Change animation sprite
    $AnimatedSprite.animation = "explosion"
    # Enable Collision area
    $CollisionShape2D.disabled = false
    # Start timer to remove bomb object
    $RemoveTimer.start()

func _on_RemoveTimer_timeout():
    queue_free()

The code for the creep/mob when hit by the bomb:

func _on_Mob_body_shape_entered(body_id, body, body_shape, local_shape):
     $CollisionShape2D.set_deferred("disabled", true)
     queue_free()

The code for collision detection for the player when is hit:

func _on_Player_body_entered(body):
     hide()  # Player disappears after being hit
     emit_signal("hit")
     $CollisionShape2D.set_deferred("disabled", true)

If the creep/mob touches the player the game is over, but if the bombs explodes nothing happens.
What i’m missing in the code?


Get this bounty!!!