User Tag List

Results 1 to 4 of 4

Thread: Centre Point of Device Screen?

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Jan 2014
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Centre Point of Device Screen?

    Hi,

    I'm wondering if there is a way to determine what the centre of a device screen is? For instance, in order to be able to use that point as a reference when creating and positioning other objects and making sure nothing falls off-screen.

    I know you can position in relation to the screen edges, but that only goes so far in helping me achieve this. I really want to centralise things in my game.

    Thanks in advance!


    Edit:

    I think I may have just realised that it is as simple as selecting the "Virtual Height" / 2. Can anyone confirm / deny that this is the appropriate way of doing it?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The center is always (Width/2, Height/2)

  3. #3
    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)
    Sparckman's Avatar
    Join Date
    Feb 2011
    Location
    Planet of the Kangaroos
    Posts
    1,395
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Center of a Screen Answer

    (Width/2, Height/2) does not give you the center of the window, it only tells you what half the width / height of the frame is. If the frame is bigger than the window, you will need something else.

    To get the center of the X axis: X Right Frame - (( X Right Frame - X Left Frame ) / 2 )
    To get the center of the Y axis: Y Bottom Frame - (( Y Bottom Frame - Y Top Frame ) / 2 )

    That will give you the center of the window, regardless of how big the frame is, and it will adjust at gameplay if it is on an 'always' command.

    To explain what it means For X Coordinate:
    • The brackets are working out what the value of half the width of the visible window is - not the frame
    • We then take that value from the X position of the Right Visible Edge of the screen to get the center of the window
    • The Y coord is done the same way, just with the Y axis values


    Hopefully that helps some people. If you're doing a scrolling game, this will be more useful.

Similar Threads

  1. Device Physical Screen Size / DPI
    By Bipolar_Games in forum Android Export Module Version 2.0
    Replies: 10
    Last Post: 27th September 2013, 01:19 PM
  2. Device Screen Size
    By Jeff in forum Android Export Module Version 2.0
    Replies: 5
    Last Post: 20th December 2011, 08:47 PM
  3. balle direction du centre
    By geantvert in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 29th June 2009, 03:11 PM
  4. R241 Bug - Do not centre checkbox
    By joewski in forum File Archive
    Replies: 1
    Last Post: 24th August 2006, 12:49 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
  •