User Tag List

Results 1 to 9 of 9

Thread: change position consistently by math

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator ProPatch Maker

    Join Date
    Jun 2006
    Location
    Norway
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    change position consistently by math

    Upon pressing any key, I'd like an active object to change its position.
    It's position must remain within an area in MMF's frame/level.
    Each position must be predictable, meaning the user may press any key and update its position multiple times, and if the game/frame is reset, the position will be the same as the previous cycle. And it must appear random, so I can't have it showing up in a sine wave or something.

    It's a little difficult to explain, so I made this illustration
    consistant.png
    The red box should change it's position on each click 1,2,3 etc. and if the frame is reset, the position should be the same as the previous cycle.

    Is there some way to do this, I guess through some kind of math?

  2. #2
    Clicker

    Fusion 2.5Android Export Module

    Join Date
    Jan 2007
    Posts
    259
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Hello, Willy.

    Here is an example that I believe solves your problem. Press Z or Hold X to randomize.

    It requires a custom menu because the default "New - F2" menu function restarts Global Values when selected. Jumping to your Title Screen using a custom Menu Bar & The Event editor will not reset Global Values.

    If you need any help with any of the code feel free to ask or PM me.
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator ProPatch Maker

    Join Date
    Jun 2006
    Location
    Norway
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, thanks! But not quite what I mean. I don't want the position to be actually random.

    Let's say the frame just loaded, and I press "z" to change the position 1000 times.
    I'd like these 1000 positions to appear random, but if the user restarts the frame, the next 1000 positions should follow the same pattern as the previous session.

  4. #4
    Clicker

    Fusion 2.5Android Export Module

    Join Date
    Jan 2007
    Posts
    259
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Are you saying you want the game to generate these movement "amounts" on its own and that the amounts should be exactly the same every time the game is run?


    IE:
    Start of game generates the movement amounts like so.

    1,7,35,12,19,66,53,204,100

    Then when you restart it generates the same string of movements and applies them under your control (ie: when you press a button?)

    1,7,35,12,19,66,53,204,100

    Does this "string" of movements need to be identical on all computers that the game is installed on, or can it be different for each one? I'm not overly array savvy or anything, but I believe you could generate the movements using an array and a loop (and maybe a counter to specify min and max movement amounts) the first time the user runs the game, and then use that Array to handle the movements for the rest of the time the game is installed on a users computer.

    IF you want it to be identical on everyones computer, you can generate the array on YOUR computer, then distribute that array with the game.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator ProPatch Maker

    Join Date
    Jun 2006
    Location
    Norway
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, thanks! That's what I am trying to do, but I'd like to avoid predetermining the pattern and was hoping there was some clever maths I could do

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You could try making the Random seed 0 or 1.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    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
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah change the Fusion random seed from -1 to a positive number. Then when you use "Random( )" it will always return the same random sequence of numbers.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    929
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i made an example, press space to change position:
    http://hungryfishgame.com/link/randomize.mfa

    but yeah, you actually don't need to specify the random seed, you could just set it to 0 at start of frame.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator ProPatch Maker

    Join Date
    Jun 2006
    Location
    Norway
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes! This is exactly what I want, thanks!

Similar Threads

  1. [Edif]Change the position of other object
    By Xenon3000 in forum Extension Developers Lobby
    Replies: 4
    Last Post: 5th December 2014, 06:25 AM
  2. easy math to convert mouse position to frame?
    By BrashMonkey in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 17th February 2010, 05:12 AM
  3. D&D movement object cannot change the Y position
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th January 2010, 06:07 PM
  4. Anyway to change the frame starting position?
    By Zenoff64 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th October 2007, 06:14 PM
  5. Counters change position without being told to!
    By DeepGames in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 13th September 2006, 06:23 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
  •