need help with one calculation

0 favourites
  • 11 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I starting prepare capx example but im stuck on moment where i need help

    explonation what i need

    on start we have small baloon, baloon can have maximum size (sprite with low opacity show maximum)

    we have two textboxes

    so we can type 'grow time' and 'decrease time'

    So when we click start baloon should

    -grow to his maximum size with x seconds

    -pause 0.5 s

    -decrease size with typed time

    -and pause 0.5

    end

    capx

    https://dl.dropboxusercontent.com/u/447 ... eTime.capx

  • Hi IGDev!

    I can't enter your capx cause I'm on the stable version, but I'll try without it.

    First, your balloon needs the Timer Behavior.

    Then, you should try something like this :

    On start button clicked : Start ballon.Timer "growTimer", with a duration of float(growtime.text)
    
    Every tick if ballon.Timer.Duration("growTimer") > 0 : Set ballon width (resp. height) to maximum width (resp. height) * balloon.Timer.TotalTime("growTimer") / balloon.Timer.Duration("growTimer")
    
    On balloon.Timer("growTimer") :  Start balloon.timer "decreaseTimer" with duration of float(decreasetime.text)
    
    Every tick if ballon.Timer.Duration("decreaseTimer") > 0 AND if width & height not inferior than minimum width and height : Set ballon width (resp. height) to maximum width (resp. height) - (maximum width (resp. height) * balloon.Timer.TotalTime("decreaseTimer") / balloon.Timer.Duration("decreaseTimer"))[/code:1eo1g3ua]
    
    When the ballon grows, you can use a simple cross multiplication based on the progression of the timer. When it decreases, since the TotalTime still grows, you must substract the result of the cross multiplication from the maximum size. Do not forget to prevent the ballon to have a width and height of 0, by setting their minimums.
  • One has to add Increase or decrease variable then using these you can do your calculation

  • thanks, can you write more about this?

    One has to add Increase or decrease variable then using these you can do your calculation

  • Hi, thanks im stuck on this line,

    On balloon.Timer("growTimer") : Start balloon.timer "decreaseTimer" with duration of float(decreasetime.text)

    really dont know how i should type this expressions

    https://www.dropbox.com/s/egifw18onzxg6 ... 9.png?dl=0

  • IGDev at moment my health is little bad. give me little time and I will help you

  • IGDev, the screen does not match exactly what I suggested. I'll give you a commented capx this evening to show you.

    EDIT : As promised, here is the capx : balloon_problem capx

    I voluntarily used actions Set Width and Set Height instead of Set Size, for you to read it more easily. If you have any questions about what I did, ask.

  • oh man thats great and dificult one more thing for end this example

    grow x seconds (you add this)

    pause x second before start decrease (missing)

    decrease x seconds (you add this)

    and pause x seconds ( missing before start over again

    will be great if you add this two little things THANKS!

  • Your welcome, but I'm not sure to understand the effects wanted with these pauses. You want the balloon to decrease before it reaches its maximum size? I think you can try something on your own with my capx. I gave you the main mechanic, but testing is always the better to really understand.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are right, need to know how it works, you make lot of work THANKS

  • Thats the spirit, I appreciate it. Keep up the good work!

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