User Tag List

Results 1 to 3 of 3

Thread: Random Speed + Ypos at random times

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Keehan's Avatar
    Join Date
    May 2011
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random Speed + Ypos at random times

    im trying to make a game where your in a tower and enemies come from the right of the screen.

    but i dont know how to make them have a speed of 4-6, y pos of maybe 250-400, and spawn at random times like 1 - 3 seconds.

    if there is anyway to do this, please reply

  2. #2
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Speed + Ypos at random times

    OK so there are 50 frames per second if your FPS is set to 50. Constantly add to a counter 0.02 and when it equals random(4) then create an enemy at -16,-16 or whatever the size of your enemy sprite is. In the same event that the enemy is created, set its Y position to Y Top Frame + 250 + random(151) (you can leave out Y Top Frame if you don't want it to spawn based on the Y position of the screen) and set its speed to 4 + random(3). Also set its X position to whatever the x position is you want.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random Speed + Ypos at random times

    If you want any random time from 1-3 seconds (including 1 second, 2.35 seconds, and 3 seconds), do what Corlen suggested but instead constantly add 20 to a counter. Then, create another counter (I call this RandomCounter) that will be used to hold the random number. Your events should look like this:

    Always:
    --- Add 20 to TimeCounter

    Start of Frame:
    --- Set RandomCounter to Random(2001)+1000

    value(TimeCounter) is greater than or equal to value(RandomCounter):
    --- [Spawn Enemy]
    --- Set TimeCounter to 0
    --- Set RandomCounter to Random(2001)+1000

    Not entirely sure that's correct, but it should work. The reason you need the extra counter is that the "Random" expression will change every frame loop. This means that either enemies would never be spawned, or it would be very rare for them to spawn after 3 seconds (a lot would spawn after 1 second or so).

    Hope that helps.

Similar Threads

  1. Every 10 seconds random speed between 2 and 10 (how?)
    By Aloan in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 23rd October 2012, 10:16 AM
  2. Random Speed
    By Dave_of_Canada in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd April 2010, 03:25 PM
  3. Random speed between 40 and 50
    By thps13 in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd December 2008, 06:36 AM
  4. Making animation play random number of times....
    By mussashimits in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 18th July 2007, 12:37 AM
  5. Animate a Random number of times
    By Sarah in forum File Archive
    Replies: 0
    Last Post: 17th July 2007, 07:20 PM

Posting Permissions

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