Problem with creating sprites

Hey guys,

I sometimes have problems where I copy a code and it sometimes doesn’t work after repeating it a few times.
I have screenshots attached to make it more understandable.

In my first screenshot it creates the first sprite, but not the one for player 2. All sprites in the codes excist and have been checked. I just can’t see how it works one time but not the other one.
I tested already if the sprite is out of the screen by adjusting the X and Y coordinates. I also checked the Z-Layers.

The second one is a build I had a few days ago, the first 3 characters worked in my character selection screen and in the actual game screen. But after adding the fourth the whole game just stopped working. Even simple non conditional events stopped worked completely (screen 3).

I hope it’ s something obvious some can point out.
Thanks. Cheers!

Hard to tell, for the first image check if the global variable for the player 2 pick is not misspelled (in the events you are showing and in other events modifying the variable).
In the second image, the events 13 and 14 are deactivated, maybe it’s because you are testing why it doesn’t work, recheck it :slight_smile:

Hey mate, thanks for your reply!
I know that it’s hard to just from the information I gave, but I assume it’s more like a general problem that is hard to point out.

Thanks for all your suggestions but the deactivated part was just later, since suddenly every events in any scene stopped working. I checked the names as well, by picking them manually from the menues and typing them myself.

I’ll probably just have to put more time into the program and I will figure it out eventually, hopefully.
Anyway, cheers!

Sorry for the double post, I just found better way to show my problem by using the debugger.
Two different problems again, but both with creating sprites.

Pic1: While trying to show that sprite2 isn’t generated while sprite 1 is, even though they have the same code, and both their required variable values are true, I found that there is a variable that might interfere. In my screenshot you will see it as “Player2Picked” and “Player2picked”. Obviously I only want one of them, the one with the value 2, so that might be the reason for zero sprites of Dancer2P2, even though the corresponding variable is set on the right value.
But when I open my global variables overlay (the overlay you see in the screenshot) there’s only “Player2picked”. So while I finally found my problem but I don’t know how to delete this ghosted variable. I tried to change the variable on 2 as well and then the sprite showed up.

Pic2: The game gets stuck at 89% when I leave the event with the object creation active. The codes you see in the screenshot are the only activated ones. I made sure there are no typos.

Anyone able to help with that?

Thanks heaps!

About the ghost variable: The variable is surely misspelled in an event (variable names are case-sensitive, the variable “Var” is not the same than “var”), if the variable “Player2Picked” doesn’t exist but you check its value with a condition (Variable Player2Picked is = 2) then GD will create it and assign the default value 0 (as you can see in the debugger), search for the misspelled variable :slight_smile:
About the game loading stuck: If it works without the event to create the object, then it means the error is not a missing resource/image. It seems the event is generating an invalid JavaScript code, it shouldn’t happen… never. If you are sure the object name is not misspelled or the object has no something weird (for example you have deleted its collision mask) then you could send it to me in a PM, so I can check it :neutral_face:

It’s a pity there are no event numbers, but this pair of events looks to be the problem (the problem Lizard-13 suggested):

It looks like you want to be testing one global variable to see if it has the value of 1 or 2, but what you are actually doing is testing the value of two global variables because of the case sensitivity of the variable names. GDevelop is very case sensitive and not just in variable names.

Yep, I screwed up with the case sensitivity. I thought I checked that thoroughly but probably had a tunnel vision.
That’s another lesson learned and I will be more sensitive with that from now on. Thank you both a lot!
I’ll send you a PM once I figure out how to attach something in a PM, Lizard.
Cheers guys, apprechiated!