Page 1 of 5
[Help]Creating a clicker game
Posted: Mon Aug 24, 2015 8:58 pm
by AgentItay
Hello, I am developing a clicker game, and I do know the basics and I think I am pretty much ready to go, except two important things, I don't know how to make the score go up by X amount for every X upgrade that is bought, and I don't know how to make the score gow up by X amount when an item is bought, generally.
Thanks in advance.
Itay
.
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 9:16 pm
by dunbarx
We would need to know more about how things are "bought".
If you have a field with a number in it, do you know that you can:
This is basic stuff, which you say you are already OK with. Is that so? Or am I missing your point?
Craig Newman
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 9:19 pm
by AgentItay
dunbarx wrote:We would need to know more about how things are "bought".
If you have a field with a number in it, do you know that you can:
This is basic stuff, which you say you are already OK with. Is that so? Or am I missing your point?
Craig Newman
Yes I do know that.
I am using an if command for "buying" stuff, for example
Code: Select all
if field "name" >49
then
subtract 50 from field "name"
else
answer "You can't buy this upgrade yet!"
end if
Thanks for your response.
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 9:20 pm
by AgentItay
AgentItay wrote:dunbarx wrote:We would need to know more about how things are "bought".
If you have a field with a number in it, do you know that you can:
This is basic stuff, which you say you are already OK with. Is that so? Or am I missing your point?
Craig Newman
Yes I do know that.
I am using an if code for "buying" stuff, for example
Code: Select all
if field "name" >49
then
subtract 50 from field "name"
else
answer "You can't buy this upgrade yet!"
end if
Thanks for your response.
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 10:28 pm
by dunbarx
Hi.
OK, then. But if you are already doing that, what can we help you with?
Craig
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 10:40 pm
by AgentItay
dunbarx wrote:Hi.
OK, then. But if you are already doing that, what can we help you with?
Craig
As I said, I need to know how to do that once the upgrade is purchased, it will add X amount to the said field, every X amount of time. And also, that for every X upgrades bought, it will add X multiplied by Y (the amount bought) in F amount of time.
Thanks for willing to help
.
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 11:14 pm
by dunbarx
Is there a timer of some sort involved in your process? Or is each instance of a purchase an isolated event?
Without knowing a bit more of how your project is constructed, it is hard, at least for me, to answer your questions. So, given the above two queries, can you lay out the procedure under which you want to make these changes? Perhaps describe a brief scenario of a typical purchase or series of purchases and the tasks that should go along with them. Do this in a step by step fashion.
Craig
Re: [Help]Creating a clicker game
Posted: Mon Aug 24, 2015 11:20 pm
by AgentItay
dunbarx wrote:Is there a timer of some sort involved in your process? Or is each instance of a purchase an isolated event?
Without knowing a bit more of how your project is constructed, it is hard, at least for me, to answer your questions. So, given the above two queries, can you lay out the procedure under which you want to make these changes? Perhaps describe a brief scenario of a typical purchase or series of purchases and the tasks that should go along with them. Do this in a step by step fashion.
Craig
Sure, sorry.
Well, you may or may not know the game Cookie Clicker, and AdVenture Capitalist, in those games you buy upgrades, for example cookie factories, etc, every upgrade gives you X amount of money per Y amount of time, for example: If you buy a cookie factory, it will raise the score field by 0.2 every second, or every 10 seconds, and so on.
So, it basically goes like this:
1. You start, and can at anytime, click a button, this button raises your score by 1 every click, and I know how to do this.
2. Then, after you've clicked for 50 times for example, you will be able to buy something, an upgrade, as soon as you buy this upgrade, score will be reudced from your score, only if you have the required amount, and I know how to do this as well.
3. Now let's say I have bought a factory, the factory will raise my score by 0.2 every second, once I purchase it. I don't know how to do this.
4. Let's say I buy another factory, the factories will now raise my score by 0.4 every second, because there are two factories right now, and so on. I don't know how to do this.
Thanks in advance
P.S I am taking examples from cookie clicker but it's pretty obvious that my concept is different.
Re: [Help]Creating a clicker game
Posted: Tue Aug 25, 2015 1:16 am
by dunbarx
OK.
Your first lesson in sending messages in time. Make a button and a field on a new card.
In the button script:
Code: Select all
on mouseUp
addDough
end mouseUp
on addDough
if the optionKey is down then exit addDough --how else could you get out of this madness?
add 0.2 to fld 1
send "addDough" to me in 12 ticks --0,2 seconds
end addDough
Now can you better this in that the addition is made only if some other condition is met, for example, the hilite of a factory button is "true"? Or if two factory button hilites are true, the value that is added is not an explicit "0.2" but rather a multiple of that?
Craig Newman
Re: [Help]Creating a clicker game
Posted: Tue Aug 25, 2015 8:56 am
by AgentItay
dunbarx wrote:OK.
Your first lesson in sending messages in time. Make a button and a field on a new card.
In the button script:
Code: Select all
on mouseUp
addDough
end mouseUp
on addDough
if the optionKey is down then exit addDough --how else could you get out of this madness?
add 0.2 to fld 1
send "addDough" to me in 12 ticks --0,2 seconds
end addDough
Now can you better this in that the addition is made only if some other condition is met, for example, the hilite of a factory button is "true"? Or if two factory button hilites are true, the value that is added is not an explicit "0.2" but rather a multiple of that?
Craig Newman
Thank you very much Craig!
I've changed the code to my needs and it's working perfectly, even the part of the 0.2/s multiplied by the number of factories bought.
When the game will be out on the android store (open source, community edition ), would you like a credit for this?
Thanks once again.
Re: [Help]Creating a clicker game
Posted: Tue Aug 25, 2015 2:02 pm
by dunbarx
Hi.
There is no reason at all to give me any credit. Please do not. As long as you think LC is fun, I am satisfied.
Craig
Re: [Help]Creating a clicker game
Posted: Wed Aug 26, 2015 3:37 pm
by AgentItay
dunbarx wrote:Hi.
There is no reason at all to give me any credit. Please do not. As long as you think LC is fun, I am satisfied.
Craig
Thanks Craig. I do think LC is fun
.
Also, how can I make the script you gave me stop adding the points to the field, after a button is clicked?
For example, a button that is meant to reset the progress of the player.
Re: [Help]Creating a clicker game
Posted: Wed Aug 26, 2015 8:08 pm
by dunbarx
how can I make the script you gave me stop adding the points to the field, after a button is clicked?
I included a line that allowed the process to end when the optionKey was pressed. If you look at the code, there is no other way to exit, short of command-period or unplugging or shooting the machine.
But what does that line do? It is executed first thing each time the handler is called. It simply tests the state of a key, whether up or down, no?
There are a handful of ways to detect whether a button is clicked in a running handler. Either directly, by testing the mouse condition and the mouseLoc, or indirectly, by having some other condition or property set by the button script itself.
Getting any hints?
Craig
Re: [Help]Creating a clicker game
Posted: Wed Aug 26, 2015 9:58 pm
by AgentItay
Uhm, no not really.
I also didn't understand what option key is.
And also, when the player quits the game, the "upgrade" stops it's script, which is not what I want it to do.
Thanks for your help.
Re: [Help]Creating a clicker game
Posted: Wed Aug 26, 2015 11:12 pm
by dunbarx
I also didn't understand what option key is.
How did you stop the handler? The "Alt" key is the Windows version.
So my first question stands. How did you stop the handler? It will run forever, unless you have a means of exiting. I had:
Code: Select all
if the optionKey is down then exit addDough
I was trying to lead you to something similar, like:
Code: Select all
if the mouseLoc is within the rect of button "yourStopButton" and the mouse is down...
or
if the stopFlag of this stack is "Stop"...
or
if the hilite of button "yourStopButton" is "true" then...
"stopFlag" would be a custom property (do you know what those are?) set by that button. The hilite of your stop button could be set when you click it. All these and more are possible, and the choice is yours.The point is that the looping handler tests some condition or property in order to know whether to continue or exit.
Write back. There may be much to talk about.
Craig