Help with my code on my newest game

https://c.gethopscotch.com/p/138fu4t54v

So when the “Player” object is destroyed my game suddenly reloads I did not put code that does that. It has been quite a problem for me for quite a while, This is similar to my game “Free Hopscotch Admin” Where if the NPCs are destroyed the game suddenly reloads, I really need help of what’s going on here.







Screenshots of “Player” Object’s code

11 Likes

“reloads” as in that the game restarts, or that Hopscotch crashes?

Also…

Welcome to the forum!

4 Likes

I meant that the game reloads(NOT THE APP) but like the game.

5 Likes

That’s a sign the game itself crashed. If the same occurs a second time, you’ll get a womp message saying something is wrong with your code.

5 Likes

welcome to the forum!

if your project attempts to run code after an object is destroyed it often crashes (for me at least)

i saw a spot in your code where it said “when invisibility = 100” destroy, and after that was an additional block. maybe try changing that to

when invisibility = 100 (
destroy
) else (
(add the rest of your code here)
)

that might fix the problem

i could be wrong though haha

6 Likes

How does it reload?

ex. it crashes, the object just comes back

5 Likes

Oh thanks! I just remembered i put an extra after the destroy block! I’ll just remove it tommorow

5 Likes

no problem! hope it helps!

5 Likes

Sadly, The fixes didn’t work, so I added a little oof screen. Thank you for the advice though.

5 Likes

Welcome to the forum!
Feel free to introduce yourself and/or read the community guidelines!

Hope you have a great stay!

Also, it looks like the code might just be crashing

1 Like

Is there someway to fix it though? That would be very nice.

3 Likes

So when it dies you want it to respawn?

2 Likes

that bug is related to accessing a deleted object’s property/variable, and immediately crashes the project. i havent been able to consistently reproduce that bug tho, so best bet right now is to hide the scene with an ending screen, or instead of destroying, put the invisibility to 100%

4 Likes

No I wanted it to move on with the stages even when the player object is destroyed but clearly I couldn’t do that because of the bug, That’s Why I just made an oof screen(oof screen is reference to oof screen that shows up in UU MUGEN version lol) that shows up whenever the player dies. But I can’t do the same for Stages like “Standard Object Destroy” Since I have ti check if the player object is destroyed but i don’t know how though.

4 Likes

Yea I did the “Oof screen” already when the player dies but I can’t do it with further stages like “Standard Object Destroy” I just hope the same bug does not occur in my V2 of the game above.

5 Likes

Couldn’t you put a “broadcast message” block right before the “destroy” block?
That way another object can receive the message and run the code you want.

Unless I’m not understanding correctly, which is probably what’s happening, lol.

4 Likes

I had a similar problem with a Pokemon game, just make the player turn invisible instead.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.