Number next to cursor

I want to try to make Cookie clicker like game and I want to add when clicked the button to have little number that pops up and to tell you how many cookie you got next to the cursor, and I tried some things but I cant get it to work, so if you can help i’d appreciate it.
That’s what I tried:

Thanks in advance!

Hello DeiankataTV, I took a look at a “cookie clicker” type of game. I suppose this is an idle type of game where you can just aimlessly click.

Are you referring to the little numbers that show up after clicking the subject? Like the little +1?

If so, I would try to get the mouse position and set the render transform than make the text visible. You will have to ensure the anchor is set in your designer tab. This is dependent on the anchor of your button.
Here is an example:

I hope this helps.

You can add a Text to your Widget and make it to be a Variable

Then on Event Tick - Get Mouse Location on Viewport (you can save to a variable if necessary)

Now you want to GET the Text → Slot as Canvas → Set Position (The mouse Location 2D Struct)

With that it’s gonna update its location on every frame to be where the mouse is

If you need it on side you can ‘Split Struct Pin’ (2D Struct of XY Location) and add some value to the X and/or Y floats to the Mouse Location before you apply it in the Text Position

The Slot as Canvas is necessary here as it’s allowing you to use things like “Get/Set Position”, it’s not available by default (afaik you have to use it even if you use a Canvas itself)

This is what I did:


But it doesn’t seem to work. The code so the numbers follow the mouse works but I couldn’t first of all get it to work with the animation so I just used showing and hiding up.
Here are some more details about the code:

  1. The +1,2 and 3 numbers are in the same widget with… everything else.
  2. The click variable indicates that the button has been clicked (I know it’s obvious but…)
  3. The Is 1,2 and 3 variables indicate how many points you got from the click (I added these variable at the end of the Multigate I used so it can decide on random how many points to give you)
    That’s all I hope that gives you more details to my problem.

Instead of nesting Branches - use Switches (f.ex. Switch on Int Value)
Instead of doing multiple references to same object (+1, +2, +3) name the Variable accordingly (N_Cookies?) and use an Array

I can prepare something for you but I need some answers:

  • What’s the max ammount of cookies?
  • What should happen when you click them?
  • Is the System working like - every next cookie that you click it should show a number, but you can click again and show another number underneath and so on, right? (Just like some clicker games show the damage f.ex.)
  1. The min amount of cookies you can get is 1 with 6/10 chance and the max amount is 3 with 1/10 chance
  2. It’s one big cookie that you can click multiple times and every time it gives you a random amount of cookies
  3. Yes whenever you click the cookie it gives you random value from 1 - 3.
    I hope I answered your questions correctly.