[SOLVED] How do I make glow for batch buy buttons ?

0 favourites
  • 6 posts
From the Asset Store
Glow Effects
$2.49 USD
Outline Glow and Glow Worms Effects for Construct 3
  • Hi,

    I been trying to make batch buttons that will buy multiple upgrades at once when clicked like in here when there is enough cash to purchase them. I am trying to get them to glow by changing their animation to blue when there is enough cash.

    It's quite simple really. I want to use the same sprite for the buttons x5, x10, x20.etc with the number of times they need to run as it's instance variable.

    But all of them are causing many types of errors. One time i got it right, all of them glow together as if the events ran only for the final one. Right now, it is however conflicting with the entire upgrade batch purchase eventhough otherwise it works fine.

    The following are the events that i am using for it. I have disabled that in the project file attached and it just needs to be enabled to see the problem coming up.

    Here is the attached project (.capx) file.

    https://drive.google.com/open?id=1sSTsy ... 8Lj-k4bg2A

  • Hey Exion,

    its because the sub-events of the for-loop do not specify which button to turn blue. Right now it says: is there a button that matches the condition? -> turn each one blue.

    Try this:

    I suggest to create another instance variable 'TotalCost' for your BatchBuyButton, so you dont need the division 'Cash/10'.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You are trying to use "include" as a function or macro. That's not how include works. Copy the code in-place and you'll see it starts working better. Include is generally added at the top, once, which is like having that code all at the top of the same event sheet, running as if it was physically there.

  • Hey Exion,

    its because the sub-events of the for-loop do not specify which button to turn blue. Right now it says: is there a button that matches the condition? -> turn each one blue.

    I suggest to create another instance variable 'TotalCost' for your BatchBuyButton, so you dont need the division 'Cash/10'.

    It should purchase the upgrade 5 times with including the cumulative upgrade costs with x5. Each upgrade bought increases the upgrade cost by 10% by multiplying the previous upgrade cost by x1.1. So when it is clicked once while upgrade cost is 10, it will have the total cost of 10 + 11 + 12 + 14 + 15. Why i am not using a formula here instead is for both accuracy and to retain the accuracy for any new mechanics to be added so it will emulate to imitate the single click purchases done multiple times.

    I have tried many methods including the one suggested right now but still i am very confused how the Include and Sprite operation priority works with conditions. The problem is likely with the Include itself. When the include is used even the batch button purchases are messed up eventhough on it works fine. When i include it for finding total upgrade cost for the glow, it gets messed up.

    I have even tried this here with direct value comparison with 'else'. But when clicking batch buy button the upgrade costs are not working eventhough it should not be effected while trying to just do an animation change for a sprite.

    In this one, only x 5 glows and rest of them does not glow on top of messing the batch button purchases with the included event sheet to convert the cost. Problem is there with the way use 'include' too conflicting with other 'includes' which i would like to understand on top of this.

    Here is the .capx project file for the above implementation.

    BatchBuyTest2.capx

    https://drive.google.com/open?id=1ps4DvNR4kWmN1dTgtfkPH4xtSN1rNlbi

    It will be great if someone can correct it with an efficient example so i could understand. Eventhough that might be asking too much. I self-learned most of Construct 2.

    You are trying to use "include" as a function or macro. That's not how include works. Copy the code in-place and you'll see it starts working better. Include is generally added at the top, once, which is like having that code all at the top of the same event sheet, running as if it was physically there.

    The Include and Event Sheets were used this way with the Repeat event in another event sheet to be copied to anywhere where i want to get total upgrade cost. It was used to create a temporary variable to find the total upgrade cost to be used for any operations. Instead the entire events should be copied to where ever it's required ? Is there any way to run the same events like Go To Events or run a group with a event link ?

  • Exion , here you go:

    https://www.dropbox.com/s/982t5oiunhri3 ... .capx?dl=0

    You don't really need the second event sheet, but I left it to demonstrate how to properly use "Include"

  • Thanks a lot. It's solved now. dop2000's example fully cleared it out and it was also educational and well laid out. Thanks a lot for everyone else's guidance too.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)