[Help]Creating a clicker game
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
[Help]Creating a clicker game
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 .
Thanks in advance.
Itay .
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
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
If you have a field with a number in it, do you know that you can:
Code: Select all
add X to field "yourField"
Craig Newman
Re: [Help]Creating a clicker game
Yes I do know that.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?Code: Select all
add X to field "yourField"
Craig Newman
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
Re: [Help]Creating a clicker game
Yes I do know that.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?Code: Select all
add X to field "yourField"
Craig Newman
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
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
Hi.
OK, then. But if you are already doing that, what can we help you with?
Craig
OK, then. But if you are already doing that, what can we help you with?
Craig
Re: [Help]Creating a clicker game
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.dunbarx wrote:Hi.
OK, then. But if you are already doing that, what can we help you with?
Craig
Thanks for willing to help .
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
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
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
Sure, sorry.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
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.
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
OK.
Your first lesson in sending messages in time. Make a button and a field on a new card.
In the button script:
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
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
Craig Newman
Re: [Help]Creating a clicker game
Thank you very much Craig!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: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?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
Craig Newman
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.
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
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
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
Thanks Craig. I do think LC is fun .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
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.
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
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.how can I make the script you gave me stop adding the points to the field, after a button is clicked?
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
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9662
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: [Help]Creating a clicker game
How did you stop the handler? The "Alt" key is the Windows version.I also didn't understand what option key is.
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
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...
Write back. There may be much to talk about.
Craig