Variables comparison tooltip

Hello there.
I would like to add a usefull feature to my hack and slash game.
I would like a tooltip to show the player what’s the differences between two object/items.
For example the player has a sword +5 power in his hand and another sword +8 power in his inventory. (power is objects variable)
If the +8 sword is clicked i would like a tooltip showing :"+8 power (+3) "so the player know the gain/loss with new items.
In addition items can have multiple “bonus” like +power,+ dexterity, +vitality. So the tooltip must be able tho show multiple comparisons at once.

I don’t want a final answer but maybe some hints to help me because it seems it will be rather complicated to achieve
Thanks in advance and sorry for my poor english

It depends on where you decide to store all of these data.
I think that overall it should be pretty obvious how to make a popup like that. All requirements are easily broken down into simple tasks:

How do I make a popup when hovering an item?

  • How do i make something when hovering an object? The cursor over object condition.
  • How do i make something appear? Create an object.
  • How do i make something when no longer hovering the object? Inverted cursor over condition.
  • How do i make something disappear? Delete the objects that compose that thing.

How do I display the power of an item?

  • How do i display a number in the screen? Text object.
  • How do i store the score of an item? An object variable could work.
  • How do I get an object variable as text for the text objei? Object.VariableString(variable name)
  • How to get the object variable of the object that’s hovered? Object picking - let’s get the value of the object after the “cursor is hovering” condition so that GDevelop knows to get it from that object.

Etc…

GDevelop is a visual scripting based engine - while you do not have to learn a programming language, you still have to learn problem solving and logic. Try to break down a project in smaller and smaller pieces if logic, until you can map basically an event or expression to every logical step.

Remember: Divide to conquer :wink:

3 Likes