User Tag List

Results 1 to 7 of 7

Thread: Grid lock ingame? plz help!

  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)

    Grid lock ingame? plz help!

    im working on a a "block" type game and i need to be able to place objects by clicking.. you are able to create objects but not on a grid if you know what i mean.

    kind of like minecraft where you can only create blocks on a grid based thing.

    is there anyway to make my cursor allign with the grid?

    thankyou

  2. #2
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Grid lock ingame? plz help!

    I would think to align the block movement with the grid rather than be too concerned about the cursor. The player clicks anywhere in the grid and the block will move into that square.

    There are several examples on Nivram's site [I should be getting commission here ]
    snaptogridexample.mfa
    fastloopgridmovement2.mfa
    customgridmovement.mfa

    use the site map to find the page

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Re: Grid lock ingame? plz help!

    You just need an object (either invisible, or in the form of a custom cursor), that is always snapped to a grid.
    Then you create the blocks relative to that.

    + Always
    -> Cursor: Set X position to mouseX / cellWidth * cellWidth
    -> Cursor: Set Y position to mouseY / cellHeight * cellHeight
    (logically that shouldn't work, but what happens is that MMF2 rounds off the remainder of the division before it performs the multiplication).

    + Left mouse button is clicked
    -> Create Block at 0,0 from Cursor

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Grid lock ingame? plz help!

    That's still unnecessary :_

    Left Mouse Button is clicked:
    ->Create Block at 0,0
    ->Block: Set X position to xmouse/32*32
    ->Block: Set Y position to ymouse/32*32

    For a 32x32 grid. For anything else, just change the numbers in the formula.

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,731
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: Grid lock ingame? plz help!

    I think there is more than one way to do what Keehan wants to accomplish. This is what makes us dribble spit from our mouths when using MMF2. Whichever method is best for the coder is the method they should use.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  6. #6
    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: Grid lock ingame? plz help!

    The above two examples are basically what I used to pull off tile editing in my game for the level editor, since tiles are 16x16. I made the editor cursor be placed at:
    X = (XMouse / 16) * 16
    Y = (YMouse / 16) * 16

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Grid lock ingame? plz help!

    Order of operations says the division will be calculated first anyways, so the parentheses are unnecessary (all though they help illustrate the point, so kudos for that)

    All these ways work, I agree with Marv.

Similar Threads

  1. how switch on the led (caps lock, scroll lock, num lock) in the keyboard??
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 24th April 2012, 01:09 AM
  2. [help]flip horizontal sprite ingame
    By ou in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 30th July 2011, 04:55 PM
  3. mmf2 and ingame purchases
    By Jason in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 30th May 2010, 04:42 AM
  4. Editing arrays / preparing them for ingame use
    By RayMarble in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 24th September 2008, 07:53 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
  •