0 votes

So, i have a clicker game and i want to make it so that every 100 clicks you get +1 point per click.

func Score():
if Score < 100: 
    Score += 1
if Score >= 100 && Score <= 200:
    Score += 2

So i want to do this, but automatic so its like an endless game. How do i do it?

in Engine by (19 points)

The below should work for you

var inc_score = 1 


func score():

If score % 100 == 0:
   inc_score += 1
   score += inc_score

2 Answers

+1 vote

you could try

func Score():
    if score % 100 == 0:  # if the score / 100 has 0 remainder
        score += score/100 # add the score / 100
by (103 points)

its not working,its just not giving any points now. but thanks anyway

Nvm im stupid i deleted the script which shows the score lol
Thank you!

+1 vote

Based on your example, I think you just want something like this:

func Score():
    score += (score / 100) + 1

Scores of:

0 - 99 will add 1
100 - 199 will add 2
200 - 299 will add 3
...

... to the score variable

by (16,810 points)

Thank you very much!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.