Isometric Game with Character Selection

Hello All!
So, as you may have guessed from the title, I am trying to make an isometric game with character selection. A Google search of this returns nothing, so I have been winging it, and am not even sure I’m on the right path. As you may remember from an earlier post, I have made a character selection scene. There was a tut for that, but the rest of it did not pertain to my situation. So, though the cursor slides between the avatars OK in the character selection scene, and pressing the “OK” button then sends you to scene 1, the selected character is not there in scene 1. The first character, which I have dragged into the scene, is there, fully animated and controllable. I don’t even know whether to drag the other three characters into the scene. Is it a matter of hiding/showing characters? In the events, I have the idle and 8 animations/directions for each character. The attachment shows the events for the first character. I did the same for the other three characters, right under those for the first character.

I don’t even know if that was correct. I would appreciate it if someone could tell me exactly what to do, as theory here will probably just leave me dumbfounded.

                                                       Best regards,
                                                        Bill Carey

Are your characters different sprites? If so, consider the following :

  • Put all the possible characters into a group.
  • Give each character’s avatar an instance variable that holds the name of the sprite it represents.
  • When an avatar is selected, store the name from it into a global variable.
  • At the start of the scene, create the sprite from the group using the global variable.
  • Replace all references to Kirsti with the name of the group.

Hopefully I’ve explained is well enough. I think this should let you use the character the avatar represents.

Thanks, I’ll try it! And yes, my characters are different sprites. Two questions first. Do I not need to have the idle and 8 directional animations with their key presses in the Events for each character? Do I drag all the characters into the scene?

No to both. By using a group, GDevelop will apply the actions to all instances of objects from the group in the scene. So if you create 3 instances from the group, they’d all move the same way at the same time.

Make sure you have the same animation numbers for each character’s same animation. So all characters’ left animation is #2, right animation is #4 etc.

Don’t drag any of the characters into the scene in the editor. Create the character from the group by name once, at the start of the scene.

Thanks much! Time to try it.

[quote=“MrMen, post:2, topic:32233”]

  • Give each character’s avatar an instance variable that holds the name of the sprite it represents.

No problem completing steps 1, 3, 4, and 5. No clue how to do step 2. I don’t see adding an “instance variable” anywhere. Is this just an object variable? Do I add it to the avatar by going into “edit object variables”, or is it done by adding an event?

Yes, instance/object variable. They’re pretty much interchangable - an object variable becomes the instance variable when the object is created in the scene.

Create and set the variable on each of the character avatar sprites, when you select “Edit Object Variables” from the 3 vertical dots to the left of the object in GDevelop Editor. Make sure the variable name is the same for all avatar sprites, but that they hold different values.

Like this?

Yep, that’ll be fine. Do you want to upload it online and either post the link here or PM it to me?

Oops! Didn’t even see there is a SECOND line in the Object Variables field. Too much time on the computer must be destroying my vision! LOL
OK, got all that now. Thanks for the help! Even with all my bumbling, I’ve still already gone further with my game concept in GDevelop than with Unreal or Unity. I just added all my cinematics with no problems.

Guess I’m not done bumbling yet! And I still have to redo all the character animations, because I DIDN’T make sure the animation #'s were the same for all characters.

This is what I have in the Character Selection events now. Can’t figure out how to store the name from it in a global variable when an avatar is selected.

Snap. What took me over 6 months with Unity I did in a matter of weeks in GDevelop.



Ah, I see I omitted a group with the avatars in it. Let’s call it AvatarGroup. Since all the avatar sprites have the SpriteName object variable, it can be accessed via the group and set to a global variable:

This one event will replace all 4 that you have at the mo.


Then, in the game scene, you use it like :

@#%&#$%!!! I couldn’t get the events quite like you have them. At this time, the frame (character selection highlighter) doesn’t slide/move anymore. It just stays on the first avatar. When I hit OK, though, the first character does spawn in Scene 1, fully animated.

You’ve got a typo and an incorrect create command:

  1. You’re moving frame to Avatars (plural, with an ‘s’), whereas it looks like you named the group Avatar (singular). They both need to be the same name.
  2. In the first event of Level1, you’ve got Create Object, where it should be Create Object from Name…(when you click on Add Action in the event, type in “create” in the search of the pop up screen, and it’ll offer a couple of options).

Now the frame works properly again in the Character Selection scene, but no character spawns in Level 1. The names of the two object groups are Avatars & Characters. I have a variable named Avatar.

Remove the quotes around Avatars.VariableString(SpriteName) in CharacterSelection events, and remove the quotes around GlobalVariableString(Character) in Level1 events.

GlobalVariableString and VariableString return string values. If you wrap them in quotes, then the expression will be used as a string, and not the result of the expression.

e.g.
GlobalVariableString(Character) returns “Kirsti”
“GlobalVariableString(Character)” returns “GlobalVariableString(Character)”.

Hello! Realizing that you must be getting tired of this, I tried posting it new again, but the problem still didn’t get solved. Everything seems to work fine in the Character Selection scene, but when I hit “OK” and Scene 1 opens, there is no character. A major problem, of course, but the only thing in the game that isn’t functioning. I actually don’t see that I’ve done anything with the variables I highlighted in red in the attachment.

No, not in the slightest. So there was no need to start another thread to in order to spare me. I appreciate the thought, though :slight_smile:

The problem at present is a typo - in the Character Selection script you set global variable Character to the value of SpriteName, but in the Level1 script you are accessing global variable CharacterName (which, because it’s not set, will be empty or nonsensical). You’ll have to use the same global variable name in both places.

And those events you highlighted with the red box can all be deleted. They’re not doing anything.

Still there is no character in Scene 1. Something I changed along the way caused this, since the Kristi character was spawning at one point, though it was always her no matter which character was selected, but though I tried switching back some things, I can’t seem to get the character spawning again.

There’s a typo in the 4th action of the first event in Level1. It’s GlobalVariableString, with capital letters for the G, V and S. You’ve got a lower case V in your statement.