User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Preparing games for cloning (resizing)

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,367
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Preparing games for cloning (resizing)

    So, you tried the new beta feature of MMF2 Developer to resize your entire application, and to your confusion all your hard worked-out expressions messed up your object's positions. You read the report MMF generated for you and tried to fix up the errors, but soon realized your game was either too big or the expressions too complicated to do anything with.

    In this little article I'll tell those of you who struggle with this how to prepare your game for resizing, so that you only need to make your game once, and not do any alterations after cloning what so ever.

    Imagine you want to move an object 16 pixels to the right when a key is pressed. That works fine in your big game, but when you make the gamewindow alot smaller, 16 pixels is way too much for the object to move, since it would reach the other end of the window quite fast.

    The main trick is to include the width and height of the game's window in every calculation that posisions objects. Make two counters, one called width and one called height. Give them the values of the game window's size (not the play area, but the window).

    The second trick is to store the new positions in alterable values, and then set the actual positions to the alterable values. The calculation might produce a position with a decimal, and that's why it has to be stored in an alterable value first.

    In the following example we will move an object 16 pixels to the right when the direction key Right is pressed.

    Normally we would have this event:

    * Player1 moved right
    - Active: set x-position to x-position of Active + 16

    As I wrote above, when the windowsize is smaller, 16 pixels is now too much, and needs to be reduced. Using our counters, we will calculate the position instead of actually hardcode 16.

    Let's say our original game window is 240 * 300 pixels.
    If we do a fast calculation, we find out that 240 / 16 = 15 and 300 / 16 = 18.75.

    These are the values we are going to use in our calculation.
    Here is the optimized event as well as the once making the object move down:

    * Player1 moved right
    - Active: set Alterable Value X to Alterable Value X of Active + (value("Width") / 15.0)

    * Player1 moved down
    - Active: set Alterable Value Y to Alterable Value Y of Active + (value("Height") / 18.75)

    * Always (or when any control key is pressed)
    - Active: set x-position to Alterable Value X
    - Active: set y-position to Alterable Value Y

    The first expression will make the object move 16 pixels to the right, and the second one will make it move 16 pixels down. This of course is a strange way to tell it to move 16 pixels. But now let's clone the game and resize it to 128 * 160. Change the width and height counters to the new width and height and play the game. The objects will move correctly!

    That's becuase you never actually tell the object to move 16 pixels. You tell it to move what was 16 pixels in the orignal game!

    MMF2 will continue to give you error reports because it don't think you are this clever! It has no way to know that you have actually taken care of the expression made positions.

    Now, go make some cool java mobile games!


  2. #2
    Forum Moderator

    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,778
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    Thanks Popcorn.

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

  3. #3
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Preparing games for cloning (resizing)

    Nice tips Popcorn, thanks for sharing.

    We could really use MMF native expressions to get the width/height of an app window. Because cloning is mostly used for Java Mobile, and the Window Control extension isn't or won't be available.

  4. #4
    No Products Registered

    Join Date
    Aug 2006
    Location
    Stockholm, Sweden
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    Hi,

    But a mobile app may suffer, performance-wise, from using all these divisions and floats - no?



  5. #5
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,367
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    Hm, I don't know. I didn't notice any slowdown, but then I haven't made any big mobile apps yet either..

  6. #6
    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: Preparing games for cloning (resizing)

    Im MMF2 suffers from division multiply.
    Take that 240/16. Divide 1 by 16 and you get 0.0625. 240*0.0625==240/16=15. Not sure if this helps, but multiplying is always an option.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,367
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    MMF2 uses integers (whole numbers, no decimals) by default.
    If a float value is present in the calculation, the output value will be given as a float value as well.

    1 / 16 = 1
    1 / 16.0 = 0.0625

    I hope that clarified it a bit.

  8. #8
    No Products Registered

    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    1,654
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    There's an event to resize the window?!

  9. #9
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Preparing games for cloning (resizing)

    Nice article, Popcorn.

    stephen1980
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  10. #10
    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: Preparing games for cloning (resizing)

    Quote Originally Posted by Popcorn
    MMF2 uses integers (whole numbers, no decimals) by default.
    If a float value is present in the calculation, the output value will be given as a float value as well.

    1 / 16 = 1
    1 / 16.0 = 0.0625

    I hope that clarified it a bit.
    I meant in a different program(like Windows Calculator) so you could stop MMF2 from having to divide at all. Calculator is always float.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Preparing for a commercial project - Q&A
    By Jonas_Kyratzes in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 4th July 2011, 11:31 PM
  2. Cloning vs Copying
    By Gullyking in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th December 2010, 03:54 AM
  3. Patch Maker - Preparing original file
    By ionside in forum Install Creator and Patch Maker
    Replies: 3
    Last Post: 29th November 2010, 06:53 AM
  4. Cloning Frames
    By Mazeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 25th November 2008, 07:28 PM
  5. Editing arrays / preparing them for ingame use
    By RayMarble in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 24th September 2008, 06: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
  •