What am I doing wrong here?

Hi there, I’m trying to set up a shop system in my game where you buy little cat heads to play the main game with, I currently have it so that, when you have enough coins, it shows a popup to buy it, but when i press buy, nothing happens! I’ve tried a few different ways to structure this and I’m thinking it has something to do with global variables, but I’m so new to those that I can hardly tell what is doing what exactly…sorry if this makes no sense-this is my first time with GDevelop!

Edit- this screenshot is from an external event sheet called “lockedCats” and I have three ‘cat heads’ that are currently ‘locked’ in this sheet, but again, cannot buy

Hello, quwu

Is it possible for the player to press the button in the same frame where he is with the cursor on top of the cat?

image

Along with what @Rasterisko wrote (how can the cursor be in two places at once?):

  1. you are setting the selectedCharacter variable after you change the scene. This will never be actioned, as the scene will be changed and anything after that ignored. Swap the two actions.

  2. you have an unconditional event setting the animation of Cat4 to locked.

  3. there’s no need for the "If all these conditions are true" condition. All the conditions in an event need to be true for the actions to happen. This type of condition is usually only used with an OR condition.

2 Likes

Thank you! i was able to make it work, but now I’m just running into an issue where, if you have more than enough currency, it will unlock multiple cats at a time and drain the currency :sweat_smile:

Move the trigger once to the parent/previous event.