How do I create character selections with information boxes?

I’m trying to show characters, if a user clicks on one, it shows the character’s information. If they choose ‘select’ on the information box, the character becomes their game character, and showsthe selected character on the ‘your character’ layer. However, both character1 and 2 are showing to be selected at the same time and the chosen character is not created on the ‘your character’ layer, nor is playerselected updated.


Start with this:
1- check the hitboxes of the Sprites and make sure they are not overlapping.
2 - In your click event add a Trigger Once when the click is performed.
3 - Tip: Add some variable scene or global like selected_character_var = 0 or 1 or 2 or n, to store the selected character number or name depending on your needs. So it’s going to be easy for you to check later that variable and get the character selected.
4 - You don’t need to repeat the events just add one sprite with the animation of character_0, character_1, then add an object variable to that sprite named character_number in the click event just compare the character_number with 0 or 1 and set the variable scene character_selected to the animation of the sprite.

1 Like

Thanks, 'PlayerSelected’is the global variable suggested in Tip 3 I think. Suggestion number 1 worked for changing the appropriate CharacterSelected but it still doesn’t show the character even with all changes applied.

Take another screenshot with your current setup so I can check it out.

1 Like

Okay, so I redid the structure and though it takes out the functionality I was looking for, it allows for proper character selection. My only issue is the character is not being placed directly on top of the PlayerHitBox which is throwing off the collision with other objects. Like an object collides with the hit box - but the character is off by a cm, since the player doesn’t see the hitbox, its like the character never collided because its not aligned properly with the hitbox.



image

Remove the Always just leave blank event to make the position of CharacterGroup.
Plus you need to have a hitbox and charactergroup the same points, if you don’t you need to adjust the charactergroup to Hitbox.X()±xx where xx is a number value to fit the position of your characterGroup.

For instance in my game I have:
Hitbox is 16x16 with points in x=8 y=16 so is the middle on x and bottom on y.
Player is 22x22 with points in x=11 y=22 so is the middle on x and bottom on y.

To position my player to Hitbox I just : Change position of Player to Hitbox.X(), Hitbox.Y()

1 Like