which expresion to event?

0 favourites
  • 6 posts
  • I want something like this every 3-6 seconds do something

    i use int(random(3,6)) and this doing something only every 3 seconds

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • and second question how spawn object always in center of window ?

  • Your random expression looks fine to me, might have to see your .capx to find the problem. If you want to spawn something in the center of the window, you can use "WindowHeight/2" and "WindowWidth/2".

  • if you do your event "every random(3,6) seconds" it won't do what you want, because random is evaluated only once in this case and then the "timer" is set on that value.

    You might need to use System.wait ACTION (not condition / event), and probably you need to modify your game logic a bit to switch from every (random) seconds to wait (random) seconds.

  • I tried every radnom (3,7) seconds, every choose (3,4,5,6) seconds, and every private variable X = random (3,7), there is no way to set something every radnom seconds with Every x seconds expresion...You must triger it by calculating time of action(do something), curent time, and random time period.

    Do something if curent time=action time+radnom time, then set action time to curent time, set new radnom time period...

    less words more action


    random from 3 to 6 is radnom(3,7)

    edit: update capx now is more readable

  • podpathos I was afraid there will be no simpler solution than using a global variable

    Nimtrix Thanks its working fine :)

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