0 votes

So i have a game that ends when we got hitted by a creature and a video playing in the background of the game with a timer-node but when the game ends video get stuck in the last image and dont reset when the game start again, i dont have any script related to the videoplayer

this is the script of the main

  func game_over():
$ScoreTimer.stop()
$MobTimer.stop()
$HUD.show_game_over()
$Music.stop()
$DeathSound.play()
$gg.play()

     func new_game():
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
$HUD.update_score(score)
$HUD.show_message("Get Ready")
$Music.play()
$GetReadyy.play()
pass


    func _on_MobTimer_timeout():
$MobPath/MobSpawnLocation.set_offset(randi())
var mob = Mob.instance()
add_child(mob)
var direction = $MobPath/MobSpawnLocation.rotation + PI/2
mob.position = $MobPath/MobSpawnLocation.position

direction += rand_range (-PI/4, PI/4)
mob.rotation = direction

mob.set_linear_velocity(Vector2(rand_range(mob.MIN_SPEED, mob.MAX_SPEED) 
    ,0).rotated(direction))


    func _on_ScoreTimer_timeout():
score +=1
$HUD.update_score(score)
pass


    func _on_StartTimer_timeout():
$MobTimer.start()
$ScoreTimer.start()
in Engine by (31 points)
edited by

1 Answer

+1 vote
Best answer

IM A GENIOUS!!!! I HAVE SOLVED MY FIRST SCRIPT PROBLEM EVER BY MYSELF!!

just like the music playing i added a command to start and stop when the game ends

func game_over():
$ScoreTimer.stop()
$MobTimer.stop()
$HUD.show_game_over()
$Music.stop()
$DeathSound.play()
**$VideoPlayer.stop()** # HERE
$gg.play()

pass #Replace with function body

    func new_game():

score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
$HUD.update_score(score)
$HUD.show_message("Get Ready")
**$VideoPlayer.play()** # 
$Music.play()
$GetReadyy.play()
pass
by (31 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.