User Tag List

Results 1 to 5 of 5

Thread: Need help with random items and button clicks.

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with random items and button clicks.

    Hey there!
    I just got CTF 2.5 and I am obviously still learning but I got stuck and couldn't find any threads with the answer.

    So I am trying to re-create a simple game I made (but never finished due to getting stuck).
    But I can't seem to get this part working:

    Player clicks on the food button. The food button then spawns food <-- this so far works.
    I need a timer or an if statement that if the food is spawned the player cannot click on the button again to get more food (once the player has given the food to the pet there should be a countdown) <-- no idea how to get this working.
    The second part is that I have different kinds of food, I've got an apple, a cherry, and a banana so far.
    Now, in the other game engine I got it working that it would spawn the food random and the food gives different kinds of points.
    So an apple would give +20 hunger and a cherry +15. To get the idea.

    But I can't seem to get these to become randomly spawned when clicked on the button.

    Another thing that I can't get to work, which I've never got to work is that when you press a button.
    Little menu pops op <-- that works. But clicking on the same button again to make the menu go away never works.
    Any idea how that can be done? Right now you just click on the x that is drawn on the menu and since you click in that area the menu goes away.

    I'm sorry if this doesn't make any sense, I've never been great in explaining things.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Hey welcome here!

    I need a timer or an if statement that if the food is spawned the player cannot click on the button again to get more food
    if statement version:

    player clicks button
    +number of food=0
    >>> create food

    timer version:

    player clicks button
    +timer_value=0
    >>> create food
    >>> set timer to (i.e.) 1000

    timer > 0
    >>> sub 1 from timer


    But I can't seem to get these to become randomly spawned when clicked on the button.
    Quick example just to understand,
    you can do something like:

    player clicks button
    >>> create food
    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)

    But clicking on the same button again to make the menu go away never works.
    player clicks button
    >>> toggle flag (xx) of button

    flag (xx) of button ON
    (+ only one action when events loop)
    >>> show menu

    flag (xx) of button OFF
    (+ only one action when events loop)
    >>> hide menu

  3. #3
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Now, in the other game engine I got it working that it would spawn the food random and the food gives different kinds of points.
    So an apple would give +20 hunger and a cherry +15. To get the idea.

    But I can't seem to get these to become randomly spawned when clicked on the button.
    If I understand this correctly, you're looking to spawn a random piece of food when the button's clicked right?
    In that case you can add a counter and say:

    Always -> Set "counter" to Random(2)+1

    And then add these conditions to what schrodinger says above:

    player clicks button
    + Value of "counter" = 1
    >>> create "apple"

    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)

    player clicks button
    + Value of "counter" = 2
    >>> create "cherry"

    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)

  4. #4
    Clicker iOS Export ModuleInstall Creator Pro
    Dex's Avatar
    Join Date
    Jun 2015
    Location
    West Yorkshire, England
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there Skaiya. The other two posts deal with your problems, but just wanted to add another thing.
    But clicking on the same button again to make the menu go away never works
    You can also just hide it!

    So you would:
    check if player is pressing button
    + menu (your active object) is "visible"
    then set menu to "invisible"

    Or you could destroy menu too?!

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wooh, sorry for the late reply!
    As I was waiting I started working on a mini game and I understand more of CTF now.

    But I am here to reply!

    Hey welcome here!
    Thank you for the welcome

    if statement version:

    player clicks button
    +number of food=0
    >>> create food

    timer version:

    player clicks button
    +timer_value=0
    >>> create food
    >>> set timer to (i.e.) 1000

    timer > 0
    >>> sub 1 from timer
    Ah of course!

    Quick example just to understand,
    you can do something like:

    player clicks button
    >>> create food
    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)
    That positions the food on a random place, I should've explained it better but didn't know that when I said spawn random that everyone
    would think that I meant the object. I actually meant the image. I spawn the object on a position where all the food should spawn but the image and value should change.
    However, I believe Del_Duio explained that part.

    player clicks button
    >>> toggle flag (xx) of button

    flag (xx) of button ON
    (+ only one action when events loop)
    >>> show menu

    flag (xx) of button OFF
    (+ only one action when events loop)
    >>> hide menu
    I actually figured this one out today (could've figured it out if I looked at the replies sooner)
    But thank you, now if I ever forget it I can look here how to do it
    Thank you very much for your reply! I really appreciate it.

    Always -> Set "counter" to Random(2)+1

    And then add these conditions to what schrodinger says above:

    player clicks button
    + Value of "counter" = 1
    >>> create "apple"
    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)

    player clicks button
    + Value of "counter" = 2
    >>> create "cherry"
    >>> set food X position to Random(frame width)
    >>> set food Y position to Random(frame height)
    Alright! Thank you very much, that is what I needed for the random food pieces.

    I'll try this later and then I will post the results!

    You can also just hide it!

    So you would:
    check if player is pressing button
    + menu (your active object) is "visible"
    then set menu to "invisible"

    Or you could destroy menu too?!
    I tried something like this and failed so badly, hahah.
    This way makes sense to me now.
    Thank you very much for replying.

    Thank you all three for replying! I didn't actually think I would get one reply let alone 3.
    I am really happy right now, thank you so much

Similar Threads

  1. Random Items Rising From the Ground (aka Off Screen)
    By mjcampisi in forum Fusion 2.5
    Replies: 2
    Last Post: 12th August 2015, 01:06 AM
  2. Help with creating random items
    By Emerson3 in forum Fusion 2.5
    Replies: 14
    Last Post: 30th March 2015, 04:06 PM
  3. How do I get random items to continuously drop?
    By Simflare in forum Fusion 2.5
    Replies: 5
    Last Post: 7th August 2014, 12:41 PM
  4. [Bug] User Clicks with left button
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 4
    Last Post: 3rd September 2012, 04:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •