#Respawn Feature

1 messages · Page 1 of 1 (latest)

worthy cradle
#

Yes

#

What's the setup?

graceful wharf
#

what do you mean by that?

glad sail
#

what does ur code look like

graceful wharf
#

would you like me to send a vid of the game

worthy cradle
#

how is the game structured, and what do you want to respawn inside it? when, where?

glad sail
#

what do you have written so far

worthy cradle
glad sail
#

we're not just gonna write it for you

graceful wharf
#

there are 6 rooms with traps inside and 2 enemies at the last 2 rooms, im looking to be able to respawn my player once he dies before completing the game (aka he fails to kill both the enemies)

#

what code would you like me to post there

#

i've been following an unfinished tutorial from youtube for this game, respawning is not a feature added thats why im lookign to add it

#

@worthy cradle

#

i've tried brackeys tutorial on it but it doesnt seem to work for me like it works for him

worthy cradle
#

how many files of code are there?
Give us the names of the scripts
or just post all of them with a gdl.space link

#

respawning itself is easy, but how you implement it depends on the coding pattern of your project

graceful wharf
#

all of my scripts?

worthy cradle
#

that would be the best
(what have I done, lol)

worthy cradle
#

that's all of them?

graceful wharf
#

should be yes

west arch
#

Hmm,isnt there method to reload scene?

#

Just check if player is dead(you should have bool for it) and if he is just reload current scene...

worthy cradle
#
#

wipes sweat

#

is that script currently in working condition?

#

is the code there currently your attempt at making this feature?

#

I see Deactivate() but it's not called anywhere

graceful wharf
#
 if (!dead)
            {
                anim.SetTrigger("die");
                GetComponent<PlayerMovement>().enabled = false;
                dead = true;
                SoundManager.instance.PlaySound(deathSound);
                SceneManager.LoadScene(1);
#

adding the last line to this code does in fact reload the scene

worthy cradle
#

good stuff

#

I don't think you need to deactivate the PlayerMovement script

#

seems redundant

graceful wharf
#

i'll probably need to add a game over screen now to load to that screen instead

#

true it's not necessary to be honest

#

okay i think i'll be able to continue this on my own for now if i need any extra help i'll notify you guys

#

thanks

worthy cradle
#

alright good luck