Sprite object interferes with different scene even though it is not being used in that scene

Hi, I’m an old guy who decided to try making games a few months back.

I have isolated the issue down to a single sprite (global object) that is created on scene1. If I disable the creation of it, then scene2 works perfectly. (Scene2 uses nothing from scene1, it’s an inventory management screen) Scene2 always runs perfectly from preview.
I can literally disable one line of creation on scene1 and everything works perfectly on scene2.
I got rid of any possible global variables linking to scene2.

Do events/conditions/scenevariables ever somehow impact the next scene??
Specifically I press X to select something (a sprite completley unrelated and unique to scene2) and it wont work if the other global sprite is created on scene1 .

So technically this isn’t a “how do I”, I’m just wondering if anyone has ever noticed something like this and if there is a fix rather than try to delete and redo the sprite. The sprite is a deck of cards (think magic) with a tonne of animations and it is present in most lines in scene1, so deleting it would be quite annoying.

a) I’ve not used any external events ( i dont know how yet)
b) I have lots of other scenes which I don’t use, they are just testing areas - is it possible they interfere somehow? I have been duplicating my main scene to make the test areas

c) The global card sprite is linked to my first ever attempt at a function (truley awful code with many blanks and misunderstandings of what the hell I was doing) - This function isn’t used with anything on scene2 nor is the sprite or anything else from scene1.

Any suggestions would be appreciated before I start over and stop using global objects

If you’ve read this far cheers! :slight_smile:

What exactly is happening or not happening? What’s the 1 line that you’re disabling and what events aren’t working. A screenshot of the specific events might help. I can’t see how unrelated items in separate scenes could affect each other but bugs in the system do appear from time to time. Although, this could just be a coincidence and one thing might be causing something else and it’s the something else that’s causing the problem. It might even be something that only happens under certain situations.

Thank you for replying

Literally the part I can disable (and makes scene2 work properly) is:

At the beginning of the scene > Create Object Cards at position 400,900

I’ve tried deleting this object just before the scene changes, but no luck, I just do not understand how it can affect a different scene when not being used at all.

You asked what is happening:

  • In scene2 (works perfeclty from preview) I press X to select an object which moves to a new position.
    If I do not disable that global object creation in scene1, this X press doesnt register at all, it’s so weird. I’ve used the same process in other games and it works fine.
    I’ve tried restarting and loading previous saves, but get the same issue. No idea how they’re linked.

To change the scene I use a key press or if all the enemies are dead. Perhaps I should be adding something else?
All enemies dead,trigger once > Change the scene “scene2”
P key is pressed, trig once > change the scene “scene2”

If the card exists then does that trigger something else. It might not be the card but the something else. Unless it’s a bug, the only thing that should carry over to another scene is a global variable.

Have you tried just deleting the object and making a new one (that has all the same settings/animations/etc.) If that works then perhaps it was just a strange bug, if it doesn’t then that might mean there is something deeper going on like as Keith suggested their could be events that are somehow related to this object. BTW you can save the animations as .piskel and then import them back into the new global object if you decide to make a new one. It might also be a good idea to try cleaning the project up, like getting rid of any external functions, scenes, variables, objects, events that you aren’t using and don’t plan to use.

Thank you, that’s really helpful advice.
I guess the biggest battle is time and hope,really. I can either make a new card sprite and keep it local or delete and try what you say. I didn’t know about that piskel trick! honestly thought I’d have to trawl through the code and keep inserting the new sprite. Speaking of cleaning up sometimes I wonder what would happen if I put this much time into actual DiY or home issues

I tried making a new blank scene with this card sprite created and nothing else. Still messes up scene2!
There are global variables linkedt to inventory items but they have no impact if I activate them on the blank scene or scene2 start.
Baffling! lol

Yeah in fact I am constantly saving animations as .piskel mainly due to the fact that piskel 90% of the time is corrupting my animations and most of the time will ruin hours of work if I don’t save everything. You can also save individual frames as well, but saving as .piskel is exceptionably useful when you have a large animation with a lot of frames. You can easily import them back into a piskel instance. Have you tried it yet?

Can you post a screenshot of the code that doesn’t register or work properly?

Are the events being triggered? I’ll often put something else on the action side to make sure the conditions are being met. Sometime a simple play sound. If I’m checking which instances are picked I’ll use add 5 to the angle and see which instances spin. Other times I’ll use debug or add a text object to view a value. There are times I’ll even add a shape painter and draw the coordinates. The count of picked instances expression is also useful.

The first step is seeing if it’s being triggered. Is the problem the conditions or the actions? Sometimes, things get triggered but the condition filters out the needed objects.

I had a look but couldnt find the .piskel option to save - Does i’t save every animation within the object? I’ve just started remaking it and loading each one separatley. No biggie, happy to just remake everything but better.
at some point i’ll watch a load of piskel vids and learn it properly

Yep i’m pretty good at doing that kind of thing. Usually I’ll puzzle it all out for weeks untill I get a workaround.

If I run into problems again after my overhaul, I’ll post screenshots (currently i dont know how lol) - I love turrn based strat games with deckbuilding - this is my first attempt at making a game, so it’s a labour of love and I’ll go and fix my rookie mistakes first and see what happens. It’s the same old cycle - I go too complicated testing all the limits then eventually it all comes back around to cause issues!

I do wonder how the hell these random scenes are linked though!

1 Like

I made a NON global cards sprite and the issue still happens!!
(if I disable the card sprite creation line in scene1, scene2 works perfectly! )

I made a new scene2 as well and it’s exactly the same issue

The first pic shows the cards created on scene1 with an array to help with shuffles.
The other pics are from scene2 where you press X to move inventory items to a box.
If the cards are created on scene1 then the X press does not work on scene2
(Ahhh it wont let me upload 3 pics. I’ll do the next ones if you dont see an isse with the card sprite)

Also - I disabled every other bit of code in scene1 except the “press p to go scene2”

(The global variables - Yes the spelling is different for woodendoor since I tried redoing that sprite too - it works fine if I preview directly from scene2)

I only see 1 picture.

These aren’t criticisms just suggestions.

I would move all of the at the beginning events outside of the repeats. Make the repeats a sub event of the at the beginning There’s no need for it inside the loop plus since it’s inside the loop, the loop will probably still run on each frame. (I realize you might change scenes after this but it’s always good practice to be efficient as possible with code that runs around 60 times per second, it adds up fast)

I would combine the 1st and 2nd for each I don’t think it needs to repeat twice.

I’m not sure how the 3rd repeat works with all of the trigger once conditions. I’m not sure if both are needed. Trigger once and loops don’t work well together. The shuffle probably doesn’t need to be inside the repeat. I don’t see a need to shuffle each time. I’m not sure if the purpose if the 3rd repeat.

Otherwise, I don’t see anything that would effect another scene. Let’s see the other scene.

Sorry it said “new members only one picture”

Ah yes, I’ll try some of that. I think I ended up separating bits to try to debug what was causing the issue.
I’ve tried to upload the other two pics, if it stops me I’ll do the next one separately. Not sure if it will break some rules or look like spam

3rd picture for scene2

Pressing X won’t work like it does if i directly preview.

Thank you again for your comments :slight_smile:

Nothing jumps out at me. Which event isn’t working? I would try to figure out if something isn’t being triggered or an action isn’t working as intended. Does it work if you replace the gamepad condition with a keypress? That would remove that as a possible problem. Just keep testing things and checking variables.

The 2nd X button press would not work if I came from scene1 if card sprite was created scene1 (not used in scene2)
I replaced it with keypresses only and no luck.

So I have reworked it all on a fresh new scene with less variables and booleans triggering.

Good news - It started working (i can send objects to slots using button X) when coming from scene1 (even if Cards sprite is created on scene1)


Bad news - It takes an extra button press for some reason to do things IF card sprite is created on scene1. For example I can press B to put the objects back after pressing X… But if that cardsprite gets made, I have to press B twice. It’s just so weird.

EDIT So I put a textbox to show me the count of button presses etc and streamlined a little more. Now the cursor stops working (it moves using a variable that adds or subtracts ) - But works if I dont create the cards as usual on scene1

Edit2 2am - So Now things are working on this super basic fresh scene, entering from scene1 with the cards created.
The joke is I have no idea what’s changed since I seemed to enter into a silent rage for about 2 hours whilst changing bits until suddenly it worked. But now im too scared to start adding all the nice stuff back lol

I just don’t get how scene one can impact another scene if there are no linked variables being used??

All I can guess at is that I’m using arraytools for the card shuffles etc and not for any other variables or perhaps the assigning of IDs using the +1 variables is somehow going strange. Lol Maybe I should give making a turn based deckbuilding game a miss and go back to finishing my toddler’s octonaughts game :joy:

1 Like

It’s tough to tell. It could be your events or Gdevelop or one of the behaviors. It’s weird.

Final update unless others start finding the same issue.

So it’s the same as above really - Preview works but when coming from Scene1 I am selecting things in a menu which moves objects. But when i press a button to go back/undo things jam or do something that does not happen in preview.

For example. I select 2 objects and a combination menu appears. I choose an option but want to go back.
If I press ‘B’ in preview it goes back a menu stage. If I do it after scene change it skips bits and then jams on the next ‘B’ press.
It all works fine in preview, it’s like something is still running from scene1 somehow?

Is there a code to stop everything from scene1 before changing scenes?

SOLVED : (but also scary! )

I removed an extension on the sprite that gets created in scene1 (extension called Object Stack"

For some reason this interferes with various button presses on scene2 even though that sprite is not created and the extension and no common variables are used.

Before i got rid of the extension, I deleted some global variables used to count (nothing to do with the offending scene1 sprite) and still had the same weird issues. Maybe in combination this all helped??

I have included a screenshot of the debug screen using ctrl shift i (no idea what it means)