User Tag List

Results 1 to 7 of 7

Thread: Placing items in a grid?

  1. #1
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Placing items in a grid?

    Hello, I have a grid of 32x32 on a 640 x 480 size frame I want to place random object on it and snap it, I have tried place X position on a random range of (0,680) and Y position on a random range of (0,480) then I get the positions and / 32 * 32 to cut remainders but can't make it work at all, it snap in the middle of grids. How can I do that better?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2017
    Location
    Milano, Italy
    Posts
    124
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It should work, I tried myself. It works because the operation are already in integer value you dont need floor or ceiling function.
    Here the working mini code

    TestGrid32x32.mfa

    Or the Event List image

    gridCode.jpg

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperiOS 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)
    fnkycoldmadeanr's Avatar
    Join Date
    Jul 2017
    Location
    Melbourne, Australia
    Posts
    38
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Should be something like
    Create object (0,0)
    Set xpos Random(608) mod 32
    Set ypos Random(448) mod 32

  4. #4
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleInstall Creator ProUnicode Add-on
    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
    Jul 2006
    Posts
    571
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    That would produce a number between 0-31 for x and y.

    you could do: set xpos to Random(FrameWidth / 32) * 32 set ypos to Random(FrameHeight / 32) * 32.

    In this case you don't want the remainder so wouldn't use modular division.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2017
    Location
    Milano, Italy
    Posts
    124
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Now that I rethink about your first post, where is setted the hot spot of your active object?
    In my little example using
    (randomX/32)*32 and (randomY/32)*32
    I setted the hot spot in the top-left corner of the 32x32 active object, if you put it in the center you need to make a little offset adjustment to the position adding ActiveWidth/2 and ActiveHeight/2.
    Sorry if in my first post I did not specify this.

    Here the example with the grid in black so you can see that it works

    TestGrid32x32.mfa

  6. #6
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    2,912
    Mentioned
    12 Post(s)
    Tagged
    2 Thread(s)
    I have a sneaky suspicion this is just literally down to hotspot position...

  7. #7
    Clicker 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)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry to answere a bit late, but now i just checked it and u guys where right, it was the hotspot position, anyways thanks for your examples its cool to see many differnts to do things

Similar Threads

  1. Placing object by mouse
    By Outcast in forum Fusion 2.5
    Replies: 12
    Last Post: 27th August 2015, 10:49 AM
  2. Import library items as unique items?
    By Alpha17x in forum Fusion 2.5
    Replies: 0
    Last Post: 23rd January 2015, 04:54 AM
  3. Placing an ID on Counter Objects
    By ZayLong in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 29th August 2008, 01:26 AM
  4. Placing rotated objects in a grid...
    By JohnC in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 14th January 2008, 10:17 PM
  5. Placing objects in front
    By kmarshall in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 11th June 2007, 06:01 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
  •